File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes change 'action' path dynamically inside JSP. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "change Watch "change New topic

change 'action' path dynamically inside JSP.

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124

The same searchpage is required for different process like EditHRDetails,EditSalarydetails. on choosing employee I need to call or depending on the process.

How do I change the action inside the searchpage based on the process I will be doing? Is this possible?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes, you can do this. How to do it depends on how you design the page. One way to do it would be to have the onclick event attached to the table row (i.e. the <tr>) set some hidden field to indicate which row was selected and then change the backgroud so that it looks highlighted. You could then have two different buttons, one to edit HR Details and the other to edit Salaray details. The onclick even for each of the buttons would change the action and then submit, just as you're doing now with the onclick event of the <tr> element.
[ March 02, 2007: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: change 'action' path dynamically inside JSP.
It's not a secret anymore!