• 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

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing the HFJSP tutorial and trying to understand url rewriting. Since it's already done, I'm simply making
modifications to the beer example to gain an understanding of this.

In my servlet code, after getting a list of my favorite beers, I use the 3rd version of the app that uses the
RequestDispatcher, in which I attempted to encode the url. At first, the url I tried to encode was myresult page,
beer.jsp. It didn't like that, so I went digging and put in the action I had listed in my form. Similar error. So,
next, I created a logger, encoded the url and logged it. I was expecting something with a sessionid listed in the
url, but all that printed was "selectbeer.do". I've tried encoding the action with both a slash -- "/selectbeer.do" as
well as without the slash, nothing. What SHOULD I be seeing?

John
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well if you've done everything correctly then session tracking via cookies is in force. that's all :-) ...

disable cookies, clear the cache and all stored cookies and then try again. Now your urls should be rewritten containing JSESSIONID as a parameter.
 
John Gregory
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sebastian,

Yep, it worked! I switched briefly to MSIE and turned off cookies. In my servlet, I did not
encode the url. However, suppose I wanted to. If my servlet mapping is selectbeer.do, what
String do I pass to my RequestDispatcher, the encoded one, or the jsp to which I'm forwarding?

Should it be this:


or this:


Thanks,

John
 
I was her plaything! And so was 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