java - Redirection with method in Seam -
let's have button:
<h:commandbutton value="assign task" action="#{taskassigner.assignto(user)}"/>
which assigns new task user. i'd able redirect task page, equivalent clicking on link like
<s:link value="#{task.description}" action="#{workontask.start}"> <f:param name="taskid" value="#{task.id}" /> </s:link>
assuming in web-inf/pages.xml have like
<page view-id="/task-list.xhtml"> <navigation from-action="#{workontask.start}"> <redirect view-id="/task.xhtml"/> </navigation> </page>
i can't see how can in java in taskassigner.assignto(). need access seam component, right? need redirect /task.xhtml , set param taskid needed , run workontask.start() initialization on component.
first, not recommended use s:link
-tag action
-attribute (see jboss forum).
for navigation issue replace (or combine) from-action
tag if-outcome
1 , return value behind if-outcome
@ assignto
- , workontask.start
-methods.
<page view-id="/task-list.xhtml"> <navigation> <rule if-outcome="navtotask"> <redirect view-id="/task.xhtml"/> </rule> </navigation> </page>
and @ method:
public string assignto(user u) { [...] // in case of success return "navtotask"; }
Comments
Post a Comment