struts-user mailing list archives

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

Hi,

 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
ServerName+ContextRoot+NameSpace+ActionName+".action".

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
http://appserver:8080/webapp1/webapp1/Login.action(http://ServerName:port/WebAppContextRoot+/WebAppContextRoot/Action).
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

<jboss-web>
  <security-domain flushOnSessionInvalidation="false"/>
  <context-root>/webapp1</context-root>
</jboss-web>

My struts.xml file is as follows.


<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

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

        <action name="Login" class="com.abc.action.LoginA">
            <result name="input">/pages/Login.jsp</result>
            <result >/pages/ListNames.jsp</result>
        </action>
        
    </package>
</struts>

My Login.jsp is like

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

The view source of Login.jsp looks like

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


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.

Thanks,
Jinzzz




-- 
View this message in context: http://www.nabble.com/Webapp-context-tp22103569p22103569.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message