Because the textfield name is actually firstName, and because you
don't have a setFirstName(String) method in your action, the parameter
is never set.
Either you have to:
1) write <s:textfield name="formBean.firstName" label="First Name"
size="16" /> without the s:push, or
2) if you are more comfortable writing the form field names without
all the "formBean.", your action needs to implement the ModelDriven
[1] interface. This will automatically push the model (in your case
the formBean) to the top of the stack (before the action) and there is
no need of using the s:push tag in the JSP.

[1] http://struts.apache.org/2.1.2/docs/model-driven-interceptor.html

2008/10/10 928572663 <[EMAIL PROTECTED]>:
> Hello again.   Still having problems with this one.   The page displays the
> default values, but when I submit, the updated values aren't getting copied
> into the session form bean.
>
> If I remove the <s:push> tag and just reference each field independently it
> works ok.  But when <s:push> is added back into the JSP, it no longer copies
> the values.
>
> Any ideas?
>
> <s:form action="sample" method="post">
>   <s:push value="formBean">
>      <s:textfield name="firstName" label="First Name" size="16" />
>      <s:textfield name="maxValue" label="Max Value" size="10" />
>      <s:submit method="submit" />
>   </s:push>
> </s:form>
>
>
>
> @Results(
> {
>   @Result(name = SampleAction.DISPLAY_FORM_PAGE, value = "/formDetails.jsp")
> })
> public class SampleAction extends ActionSupport implements SessionAware
> {
>   final static String DISPLAY_FORM_PAGE = "displayFormPage";
>   private Map<String, Object> sessionMap = null;
>
>   public void setSession(Map<String, Object> session)
>   {
>      sessionMap = session;
>      if (!session.containsKey("formBean"))
>      {
>         setFormBean(new MyFormBean());
>      }
>   }
>
>   public void setFormBean(MyFormBean formBean)
>   {
>      sessionMap.put("formBean", formBean);
>   }
>
>   public MyFormBean getFormBean()
>   {
>      return (MyFormBean)sessionMap.get("formBean");
>   }
>
>   public String displayForm() throws Exception
>   {
>      return DISPLAY_FORM_PAGE;
>   }
>
>   public String submit() throws Exception
>   {
>      return DISPLAY_FORM_PAGE;
>   }
> }
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to