-
1. Re: s:link + method parameter
nickarls Jan 16, 2008 5:39 AM (in response to w17chm4n)Well, it looks like the function gets a non-null question (the log.fatal branch is not hit).
Do you mean that the question.questiontext outputted in the table is non-null for the row? -
2. Re: s:link + method parameter
w17chm4n Jan 16, 2008 5:45 AM (in response to w17chm4n)Yes. The table is displayed properly with question.questionText for every question.
But when I try to click link<s:link value="slink_remove" action="#{QuestionController.removeQuestion(question)}"/>
The parameter question is not passed to the method.
Though using commandLink works perfectly<h:commandLink value="remove" action="#{QuestionController.removeQuestion(question)}"/>
-
3. Re: s:link + method parameter
everlastx1 Jan 16, 2008 9:15 AM (in response to w17chm4n)I have the same problem like you
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=127673
I am also still looking for a solution.
the weired thing about it is that the same code did work with seam 1.2.1 but not with 2.0.0GA
This can be maybe a bug, but I am not sure. -
4. Re: s:link + method parameter
pmuir Jan 17, 2008 10:26 AM (in response to w17chm4n)I wrote a section into the ref doc about what will/won't work:
http://snapshots.jboss.org/maven2/org/jboss/seam/jboss-seam-reference-documentation/2.0.1-SNAPSHOT/jboss-seam-reference-documentation-2.0.1-SNAPSHOT.pdf -
5. Re: s:link + method parameter
cyberanto Jan 24, 2008 3:29 PM (in response to w17chm4n)I have the same problem with 2.0.1.CR1; the parameter is null when the action gets called. My action class is a simple POJO in Seam SESSION scope.
encasing the s:link in a form did not fix the problem, as described in the other post.
Will this be fixed in a future version of SEAM 2.x?
Thanks -
6. Re: s:link + method parameter
damianharvey Jan 24, 2008 5:54 PM (in response to w17chm4n)This has been discussed on this forum a lot. As Pete says in section 31.1.2 of the doc linked to, if you want to use s:link or s:button inside an iterative component then the list that the iterative component uses must be annotated with @DataModel.
In your case your "cat" bean will be something like:@DataModel List<Question> questionList = new ArrayList<Question>();
but note that this will outject a context variable called "questionList", so your datatable will have to refer to it like:<h:dataTable styleClass="dataTable" columnClasses="categoryName" var="question" value="#{questionList}">
(note that the value attribute has changed)
Cheers,
Damian -
7. Re: s:link + method parameter
ericjava Jan 24, 2008 6:00 PM (in response to w17chm4n)I ran into the same thing. Rather than using DataModel, I simply put an <f:param name="..." value="#{cat.id}"/> inside the <s:link>, and then I used a @RequestParameter annotation. It's a bit more verbose but it's clear what it does and how it works.
-
8. Re: s:link + method parameter
pmuir Jan 25, 2008 7:06 AM (in response to w17chm4n)No, it won't be fixed, there is nothing to fix, these are fundamental limitations of a get request.
As EricJava, I much prefer using page parameters as they conceptually much simpler and have no gotchas to look out for. Unfortunately, they don't suit all needs.