8 Replies Latest reply on Jan 25, 2008 7:06 AM by pmuir

    s:link + method parameter

    w17chm4n

      I`m having a problem, couse I have to use s:link but this component cannot pass the parameter to the method.

      The view

      <div id="#{cat.categoryName}" class="showhide">
       <h:dataTable styleClass="dataTable" columnClasses="categoryName" var="question" value="#{cat.questionList}">
       <h:column>
       <h:outputText value="#{question.questionText}"/>
       </h:column>
       <h:column>
       <h:commandLink value="remove" action="#{QuestionController.removeQuestion(question)}"/>
       <s:link value="slink_remove" action="#{QuestionController.removeQuestion(question)}"/>
       </h:column>
       </h:dataTable>
       </div>
      


      The method
      public void removeQuestion(Question question) {
       if(question == null) {
       log.fatal("Question is null ! [ERROR]");
       } else {
       log.info("Question [" + question.getQuestionText() + "]");
       }
       }
      


      Error
      11:09:18,250 INFO [QuestionControllerBean] Question [null]
      


      Question Entity
      @Entity
      @Scope(ScopeType.CONVERSATION)
      @Name("question")
      @Table(name="Questions")
      public class Question implements Serializable {
      
       @Id @GeneratedValue
       private Long id;
      
       @NotNull @Length(min=5, max=100)
       private String questionText;
      
       @NotNull @OneToOne
       private QuestionType questionType;
      
       @ManyToOne
       private QuestionCategory category;
      
       @OneToOne
       private Picture picture;
      
       @NotNull
       private int questionValue;
      
       @NotNull @Temporal(value = TemporalType.TIMESTAMP)
       private Date created;
      
       //@OneToMany(cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.REFRESH})
       @OneToMany
       private List<Answer> answers;
      
       @ManyToMany
       private List<Poll> pools;
      
       @ManyToMany
       private List<Test> tests;
      .
      .
      .