Joel Alvim

Greenhorn
+ Follow
since Mar 29, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joel Alvim

Hi!

First of all I'm new to the forum, so hopefully I'll find here a nice and cozy place to discuss Java matters ;)

Now to my problem, suppose you have a struts mapping defined as contract.do, which points to a jsp located in the war file at /contracts/contract.jsp
The application runs at a defined context of /contractsapp for example. So you would access http://server/contractsapp/contract.do

On that page you would have a div with onclick="document.location='listDetails.do'"

When you click the div in IE or Firefox, you get forwarded to http://server/contractsapp/listDetails.do as I would expect. Since the document.location declares no context, I would assume the browser to just reuse the same context as the current page and replace the last bit (the struts mapping) with the new one.

However in Chrome or Safari you get redirected to http://server/contractsapp/contracts/listDetails.do

This last mapping doesn't work! It seems like Chrome and Safari react differently to document.location when no context is specified. Chrome and Safari will take what's on document.location, and append that to the actual folder where the jsp is located, not just the struts mapping.

The solution to this in my case would be to replace everything in document.location with a little jsp bean that contains the context (using jsp's application object) and then manually appending the struts mapping I want. But this means changing my app in lots of places and re-testing. Is there an easier way to go about this ? Some meta-tag that I'm missing that will change Safari and Chrome's behaviour ?

Thanks for any replies, I hope I explained the problem properly!
13 years ago