• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URL rewriting and Struts how-to

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to pass a parameter to my foreward page like this
<a href="mypage.jsp?valid=1"/>
how do i do that using struts?
in struts-config.xml, how do i specify a parameter like that?
HOW CAN I PASS A PARAMETER DYNAMICALLY?
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many ways to send this kind of data over to your forwarded page. Your safest bet is to create an Action and add your data string to the request as an attribute, and then fetch it from your forwarded page. I say this is the safest since it uses the framework the way it's meant to be used.
There is no way to specify dynamic parameters like that in the struts-config.xml. If you did have an Action leading to your forwarded page, and you absolutely wanted this data to be a "parameter", you could get the forward mapping (i.e. mapping.getForward("success") and then create a new forward based on the returned ActionForward, from which you could append your data to the path, but again, you'd be forced to ensure that the format of your data conforms to a query string.
I'd recommend placing it as a request attribute.
 
Sanjay Deshpande
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to struts and do not know exactly how this can b implemented.
Can u plz write 2 lines of example code or illustrate more .
 
Wanna see my flashlight? How about this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic