Meaningless Drivel is fun!*
The moose likes Struts and the fly likes URL encoding in Struts is not working! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "URL encoding in Struts is not working!" Watch "URL encoding in Struts is not working!" New topic

URL encoding in Struts is not working!

Geoffrey Falk
Ranch Hand

Joined: Aug 17, 2001
Posts: 171
I have a Struts-1.0.2-based web application running under Tomcat 4.1.x and Apache 1.3.x.
I am using the Struts <html:link> tags for all links. Unfortunately, session management only works with cookies enabled. If the user has cookies turned off, it doesn't automatically revert to URL encoding. The result is that the user cannot access the site properly.
How do I make Struts detect cookie support and use the appropriate method for session management? It should use cookies if they are supported; otherwise it should revert to use encodeURL().

Sun Certified Programmer for the Java 2 Platform
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
This actually depends on your app sever setting. If URL rewriting is enabled, it will rewrite the URL. If rewriting is not enabled, it will not rewrite the URL. At least it works in WebSphere...

"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The team, Newsletter 039.
I agree. Here's the link:
subject: URL encoding in Struts is not working!
Similar Threads
Enforcing URL rewriting for tomcat
swhy do I still see "jsessionid=.." when cookies is ON
URL encoding in Struts with/without cookies
most challenging topics in SCWCD
Regd Sess Mgmt: How do i find out if the browser has cookies disables?