This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I extract a value from the URL

 
archana nitya
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a URL www.test.com/myshort/myapp/mypage.jsp, where myshort is a column value in my database.

I will later query for the id of this shortName (in this example it is 'myshort') which I am doing as select id from mytable where shortName='myshort';

How can I extract the 'myshort' value from the entire URL? I can't do request.getParameter() since this is not a part of the url parameter. So I am trying to use request.getRequestURI().

Can you please tell me how do I parse and get shortName using request.getRequestURI()? I know there are parse and split functions in this. How exactly can I make use of it? Can someone please help me?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you examined the other methods on HttpServletRequest to see if there's something you can use? (Hint: path info, cough, cough)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic