struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JPJ <>
Subject Webapp context
Date Thu, 19 Feb 2009 15:57:56 GMT


 Is there anyway we can prevent the context root of the web application from
prepending to the uri of an action. I know if we use the namespace then the
url is formed by adding

I am not specifying any namespace for my struts pacakge. But when I see the
view source of the jsp my application context root(which is /webapp1) is
preppended to the action value (the URI). So my url is changed to
The URI is now /webapp1/Login.action where I expect /Login.action. This
created problem for my apache rewrite rules. Is there anyway I can avoid the
webapp context root to prepend to my action value in jsp while rendring the
page? I think this is happening while rendering the FORM tag.

I tried with namespace="/" and namespace="" in struts.xml and form tag but
still the context root is getting appended to action value.

I am using struts2.1.6 and my application server is jboss4.x. I am using
empty namespace in the struts package. My application context is /webapp1
(in jboss-web.xml). 

My jboss-web.xml is like

  <security-domain flushOnSessionInvalidation="false"/>

My struts.xml file is as follows.

"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

    <package name="mypackage" extends="struts-default">
            <interceptor name="authentication"
            <interceptor-stack name="incrstack">
                <interceptor-ref name="authentication" />
                <interceptor-ref name="defaultStack" />
        <default-interceptor-ref name="incrstack" />
        <action name="Welcome" >
            <result name="input">/pages/Login.jsp</result>

        <action name="Login" class="">
            <result name="input">/pages/Login.jsp</result>
            <result >/pages/ListNames.jsp</result>

My Login.jsp is like

<s:form name="loginForm" action="Login" method="post" theme="simple" >

The view source of Login.jsp looks like

<form name="loginForm" action="/webapp1/Login.action" method="post">

I appreciate your help in this as I tried a lot of options and read a lot of
forums, but nowwhere this issue is raised.


View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message