struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 928572663 <>
Subject Re: session based pojo as form variables
Date Wed, 17 Sep 2008 13:33:37 GMT
Here are some examples of how I am accessing the session pojo fields on
my form:

<s:form action="Sample!submit" method="post" >
    <s:checkbox name="#session.formBean.requeryInfo" label="Requery
Info?" />

    <s:textfield name="#session.formBean.firstName"
value="%{#session.formBean.firstName}" label="First Name" size="16" />

    <!-- etc -->

and then in my action class (SampleAction):

public String showForm() throws Exception
    MyFormBean formBean = new MyFormBean();

    Map session = (Map)ActionContext.getContext().get("session");

    return ("showFormPage");

public String submit() throws Exception
    Map session = (Map)ActionContext.getContext().get("session");
    MyFormBean formBean = (MyFormBean)session.get("formBean");

    formBean.setMessage("submit was received and processed.");

    return "showFormPage";

So when I set a break point in submit(),  I can see that it is invoked,
but when I pull the "formBean" out of session I find that it is still
the unedited copy (original).  Struts2 apparently has not copied the
form value into the pojo valueobj for me.

BTW - I am using "zero configuration" and struts2 2.1.2


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

View raw message