-
1. Re: how to use s:button to execute action first before jump
thejavafreak Aug 20, 2007 4:05 AM (in response to tim_ph)Try adding LocationEdit.page.xml and in it write this:
Hopefully this meets your needs. -
2. Re: how to use s:button to execute action first before jump
thejavafreak Aug 20, 2007 4:09 AM (in response to tim_ph)Try adding LocationEdit.page.xml and in it write this:
<page action="#{applicationHome.addLocation}">
</page>
Hopefully this meets your needs. -
3. Re: how to use s:button to execute action first before jump
pmuir Aug 20, 2007 11:24 AM (in response to tim_ph)You can use a raiseEvent on the navigation (this was added recently, not quite sure when).
-
4. Re: how to use s:button to execute action first before jump
tim_ph Aug 20, 2007 2:21 PM (in response to tim_ph)I've been thinking how to make this transition form Joshua's suggestion and Pete's.
I can't do what Joshua said addLocation() to action because that will make LocationEdit.xhtml not suitable for the case where we use existing location id from dataTable list.
I'm trying to figure out how raiseEvent can use the ID of new Location created on applicationHome in locationHome through page parameter LocationEdit.page.xml. -
5. Re: how to use s:button to execute action first before jump
tim_ph Aug 20, 2007 2:39 PM (in response to tim_ph)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.