Hi Daniel!
We have the same setup here. I originally went into this mailing list asking if
there was a possibility to un-set the applicationContext name. There's no
possiblity to do this I believe. With Apache proxying to the tomcat application
name you'll run into more problems as the <s:form> also prepends the context
and there's no way to stop it and the session ID cookie that’s set for the user
is also prepending the application context's name.
I guess until this feature will be implemented some day, there are three
solutions:
1. Deploy the application on your tomcats productive root context
2. Change the struts2 code. I'm not too experienced with struts2, so I didn't
try that.
3. We couldn't deploy in the root context here, the other possibility is a
hack: Don't use <s:form>. Always includeContext="false" on <s:url>s . As this
both leads to errors on your local test environment, the best way may be to
construct your href-links yourself. And if you need user sessions, you can use
javascript to set the cookie for the right (root) context, where you include
the sessionid in one of your action's getters:
<script type="text/javascript">
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
$(document).ready(function() {
createCookie("JSESSIONID","<s:property value='sessionid' />",3);
});
</script>
As I wrote, a dirty hack. I'd love the struts2 people to include a setter of
some kind to manually define your appContext, that would solve all these
problems.
Best regards,
Tim
-----Ursprüngliche Nachricht-----
Von: Daniel Rindt [mailto:[email protected]]
Gesendet: Freitag, 3. September 2010 11:25
An: Struts Users Mailing List
Betreff: Re: AW: Question about Usage of Tasks
Am Freitag, den 03.09.2010, 10:24 +0200 schrieb Tim Dellas:
> Use the includeContext="false" attribute like so:
> <s:url action="category" includeContext="false" var="tagurl" />
Thank you Tim, that is working.
But i run in a different problem now. Local Debugging is done here with Tomcat
5.5 in Eclipse. So there the Context is needed. On the Production Machine is
running Apache as Proxy which proxies to Tomcat and back.
There i don't want display the Context Name.
Another way can be to set a Application Context, but the Documentation told me,
that can not defined in web.xml.
You have another hint for me?
Thank you
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]