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

tim_ph do-not-reply at jboss.com
Fri Aug 17 18:47:21 EDT 2007


Is there a way to for action on s:button first before it jumps to the view page with params?
This is JSF code:

  | <rich:dataTable values="#{locations}" var="location"...>
  | ...
  | <a:commandLink value="Remove" action="#{applicationHome.deleteLocation}"/>
  | ...
  | </rich:dataTable>
  | 			    <s:button value="Add New Location"
  | 			    		 action="#{applicationHome.addLocation}" 
  | 			    		 view="/LocationEdit.xhtml"
  | 			    		 propagation="join"
  | 			    		 >
  | 			    	<f:param name="locationId" value="#{applicationHome.location.id}"/>
  | 			    </s:button>
  | 
I need new location added to current application before edit it in LocationEdit.xhtml
Application.addLocation() is defined as followed

  | 	@DataModelSelection("locations")
  | 	private Location location;
  | 	public Location getLocation() { return location; }
  | 
  | 	public void deleteLocation()
  | 	{
  | 			getInstance().getLocations().remove(location);
  | 			getEntityManager().remove(location);
  | 			location = null;
  | 	}
  | 
  | 	public void addLocation()
  | 	{
  | 		location = new Location();
  | 		getInstance().getLocations().add(location);
  | 		getEntityManager().persist(location);
  | 	}
  | 

location is DataModelSelection to be used within dataTable but also be used when added new. If I use the edit panel in the same page, that will be no problem, but I have to jump to new page to do it, that same code won't work because addLocation() didn't get called before #{applicationHome.location.id} assignment.

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

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



More information about the jboss-user mailing list