• 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

How can I get actual url containing parameters without .do pattern

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I have a struts web application where users are going to be emailing their friends pages they like. For example, a user reads an artice and clicks on an "Email To Friends" button.

I want my application to email the url with parameters to the recipient's email address. However, when I invoke "reques.getRequestURL()" to get the url, this is how ths URL looks like: www.whatever.com/article/emailToFriend.do

If the end user clicks on this URL, they would not be taken to that unique article page.

How can I extract the ACTUAL URL containing the parameters? Example:
www.whatever.com/article/emailToFriend.do?articleID=93907...

For security reasons, this is how I configured struts in web.xml:

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
<url-pattern>*.do</url-pattern>
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you mention in the above message, Example :

www.whatever.com/article/emailToFriend.do?articleID=93907...



You know very well that param name 'articleID' you can get is as requesr.getParameter("articleID"); Note this is Object class.. change accordingly. or use request.getQueryString();

Cheers
Dhana
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic