Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
this week in the
Calling Action on Pageload
Joined: Feb 21, 2012
Aug 23, 2012 03:14:30
I have a create page and i what i am trying to achieve is , when a user will submit the form , s/he will navigate to the next page where s/he can see the updated data as a List.
Using Struts 2 , Add jsp >> calling an action >> calling method save >> if result success >> navigate to another page >> View List
Where do i mention an action which will call ViewDetails method and on successful return of that method what would i mention in result tag .... i mean will i mention the same page >> ViewDetail.jsp
Joined: Jul 17, 2012
Aug 23, 2012 07:03:44
AFTER the data is saved successfully you can specify in struts.xml to go other action if success like this
<action name="SaveData" method="save" class="yourpackage.YourSaveAction"> <result name="success" type="redirectAction">DisplayData</result> </action> <action name="DisplayData" method="execute" class="yourpackage.YourDisplayAction"> <result name="success">display.jsp</result> </action>
note that you need to populate saved data from resource in
or which ever method you want in
class and then access that data in
Learning some thing New Every Day
Joined: Feb 21, 2012
Aug 23, 2012 08:05:55
Thanks a lot Yogesh
I really like the way you answered my question, it shows that you have good hands on Struts 2
Please keep in touch because i am developing an application and i might face problems in future like this.
Thanks a lot once again for your help.
I agree. Here's the link:
subject: Calling Action on Pageload
Passing parameters with h: link
Confirm message on submit
Reg: Getting data after save using Spring+Hibernate
How To Handle Setting Up Pages Being Forwarded To
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014