Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pass parameter inside action path in struts-config.xml

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a search screen where in if there is an exact match I have to show the detail page diretcly. If the search returns more than one record then I show a list of records. The user double clicks and then reaches the detailed page.

When there is a direct match inside my action class.


if search returns a list of records



Firstcase the url is http:.../'showGroupDetails.do
secondcase my url is like http:.../'showGroupDetails.do?groupid=1


I want same kind of url for both. how can this be achieved? Is there way I can change my struts-config to accept query parameter?
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should be very easy...just append the parameters to the end of the path after calling findForward. The problem is that a forward cannot be modified after it is created. Maybe there is an easier way to do this, but I created this utility method for doing this:


- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic