5 Replies Latest reply on Aug 20, 2007 2:39 PM by Tim

    how to use s:button to execute action first before jump to v

    Tim Newbie

      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}"/>
       <s:button value="Add New Location"
       <f:param name="locationId" value="#{applicationHome.location.id}"/>

      I need new location added to current application before edit it in LocationEdit.xhtml
      Application.addLocation() is defined as followed
       private Location location;
       public Location getLocation() { return location; }
       public void deleteLocation()
       location = null;
       public void addLocation()
       location = new 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.