Forums Register Login

document.location context jumbled up in Chrome and Safari using Struts mappings ?

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
Don't use a relative link.
My pie came with a little toothpic holding up this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1463 times.
Similar Threads
Ajax not working on IE. Undefined error
onpaste event in a drop down list
Spring MVC Request Mapping
hml:link
how to get ajax response on click of an a href?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:31:54.