Hi,
I have a BillingInterceptor that throws up a Confirmation Screen after
submitting the input parameters and before processing the action. I am using
the session to hold the parameter map so it's available to the action after
the user Confirms their purchase. I have confirmed that the "PARMS" is being
stored in the session.  Sometimes "PARMS" manages to keep its value, and
sometimes the value disappear. This seems to have something to do with the
weather or the alignment of the stars.  I see absolutely no rhyme or reason
for why it only works sometimes! I've been struggling with this off and on
for weeks.  Thanks to those who have tried to help with this issue in the
past.  Any more ideas would be greatly appreciated!


BillingInterceptor.java:

public class BillingInterceptor extends AbstractInterceptor implements
StrutsStatics {

    private static final String URL_GOING_TO = "URL_GOING_TO";

    public String intercept (ActionInvocation invocation) throws Exception {

        ActionContext context = invocation.getInvocationContext();
        HttpServletRequest request = (HttpServletRequest)
context.get(HTTP_REQUEST);
        HttpSession session =  request.getSession(false);

        if ((request.getParameter("CONFIRM_SCREEN") != null) &&
                (request.getParameter("CONFIRM_SCREEN").equals("TRUE"))) {

            String urlGoingTo = invocation.getProxy().getNamespace()+
                                invocation.getProxy().getActionName()+
                                ".action";

            session.setAttribute(URL_GOING_TO, urlGoingTo);
            session.setAttribute("PARMS", request.getParameterMap());

            return "confirm";
            } else {
            Object action = invocation.getAction();
            if (action instanceof BillingAware) {
                if (session.getAttribute("PARMS") != null) {
                    BeanUtils.populate(action, (Map)
session.getAttribute("PARMS"));
                    session.setAttribute("PARMS", null);
                }
            }
            return invocation.invoke();
        }
    }
}


confirm.jsp

<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head><title>Confirm</title></head>
<body>

<table width="750"><tr><td align="center">

    <h2>Please confirm purchase.</h2>
    <br>
    <p>This could take several minutes depending on the request.</p>

    <s:form action="%{#session.URL_GOING_TO}" method="post">
        <s:submit value="Confirm" align="center">
                    <s:param name="colspan" value="%{2}" />
                    <s:param name="align" value="%{'center'}" />
            </s:submit>

    </s:form>


</td></tr></table>


</body>
</html>

My interceptor-stack:

<interceptor-stack name="defaultLoginStack">
                <interceptor-ref name="servlet-config"/>
                <interceptor-ref name="billing"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="login"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="chain"/>
                <interceptor-ref name="model-driven"/>
                <interceptor-ref name="fileUpload"/>
                <interceptor-ref name="static-params"/>
                <interceptor-ref name="params"/>
                <interceptor-ref name="conversionError"/>
                <interceptor-ref name="validation">
                            
                                execute
                    
                </interceptor-ref>
                <interceptor-ref name="workflow">
                            
                                execute
                    
                </interceptor-ref>
</interceptor-stack>
-- 
View this message in context: 
http://www.nabble.com/Need-help-with-Struts-Interceptor-session-problem.-tp15598155p15598155.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to