[jboss-user] [JBoss Seam] - Re: how to use s:button to execute action first before jump

tim_ph do-not-reply at jboss.com
Mon Aug 20 14:39:48 EDT 2007


Ok, it works if I use navigation with redirect AND param. 
(I've been using Seam Framework generated by seam-gen with modification to jump start my app.)

In ApplicationEdit.page.xhtml

  | ...
  |    <navigation from-action="#{applicationHome.addLocation}">
  |          <rule if-outcome="done">
  |              <redirect view-id="/policy/LocationEdit.xhtml">
  | 			<param name="locationId" value="#{applicationHome.location.id}"/>             
  | 		    	<param name="locationFrom" value="ApplicationEdit2"/>
  | 		    	<param name="applicationId" value="#{applicationHome.applicationId}"/>
  |              </redirect>
  |          </rule>
  |    </navigation>
  | ...
  | 
and inside ApplicationEdit.xhtml, change s:button "Add New Location" to

  | 			    <s:button value="Add New Location"
  | 			    		 action="#{applicationHome.addLocation}" 
  | 			    		 propagation="join"
  | 			    		 />
  | 

In ApplicationHome.java, change addLocation()

  | 	public String addLocation()
  | 	{
  | 		location = new Location();
  | 		getInstance().getLocations().add(location); // add new location to application
  | 		getEntityManager().persist(location); // to get id from Hibernate
  | 		return "done";
  | 	}
  | 

If you think it's not the most efficient way to do it, let me know.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075996#4075996

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075996



More information about the jboss-user mailing list