Topic
1 reply Latest Post - ‏2011-11-14T20:51:56Z by seohulu
RRTF_Srineel_Mazumdar
1 Post
ACCEPTED ANSWER

Pinned topic Issue with Struts 2 interceptor

‏2011-11-11T15:29:58Z |
I am creating a small Struts 2 project. If I enable the interceptor, the values are not getting passed from JSP to Action. Attached the code.

struts.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<include file="struts-default.xml" />
<package name="practice" extends="struts-default">
<interceptors>
<interceptor name="logger1" class="com.home.practice.LoggerInterceptor" />
<interceptor name="before" class="com.home.practice.PreViewInterceptor" />
<interceptor name="after" class="com.home.practice.PostViewInterceptor" />
<interceptor-stack name="myStack">
<interceptor-ref name="logger1" />
<!-- <interceptor-ref name="before"/> <interceptor-ref name="after"/> -->
</interceptor-stack>
</interceptors>
<action name="loginCancel">
<result>/Login.jsp</result>
</action>
<action name="login" class="com.home.practice.LoginAction">
<!-- <interceptor-ref name="myStack" />
--> <result name="input">/Login.jsp</result>
<result name="error">/Login.jsp</result>
<result name="cancel" type="redirect">/Login.jsp</result>
<result>/UserInfo.jsp</result>
</action>
<action name="userinfo" class="com.home.practice.UserInfoAction">
<result name="summary">/Welcome.jsp</result>
</action>

</package>
</struts>
Updated on 2011-11-14T20:51:56Z at 2011-11-14T20:51:56Z by seohulu
  • seohulu
    seohulu
    6 Posts
    ACCEPTED ANSWER

    Re: Issue with Struts 2 interceptor

    ‏2011-11-14T20:51:56Z  in response to RRTF_Srineel_Mazumdar
    1)that value is passed from jsp to Action is default behavior of struts2, as long as the getter and setter has been setup correctly in your LoginAction.

    2)"<include file="struts-default.xml" />" are not needed, because you already have extends="struts-default".

    3) check your logs , like localhost.log, there might be more info about what is going wrong.
    good luck
    --
    Acoolme is an Online Marketing Software Platform And Social Community