I've never used a form field name like "#session.formBean.firstName"
before, but if you refactor your code a little:
Make your action implement SessionAware interface and put a formBean
getter/setter in your actions (or some superclass of your wizard
actions), which takes it from the session:
public FormBean getFormBean() {
return (FormBean) sessionMap.get("formBean");
}
public void setFormBean(FormBean f) {
sessionMap.put("formBean", f);
}
then in your JSP page name your form fields like this:
<s:textfield name="formBean.firstName" label="First Name" size="16" />
2008/9/17 928572663 <[EMAIL PROTECTED]>:
> 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 -->
> </s:form>
>
>
> and then in my action class (SampleAction):
>
> public String showForm() throws Exception
> {
> MyFormBean formBean = new MyFormBean();
>
> Map session = (Map)ActionContext.getContext().get("session");
> session.put("formBean",formBean);
>
> 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
>
> Thanks.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]