struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maven apache <apachemav...@gmail.com>
Subject binding paramters in struts2 without the form
Date Mon, 29 Nov 2010 10:58:58 GMT
<s:form action="register">

      <s:textfield name="personBean.firstName" label="First name" />

      <s:submit/>
</s:form>

public class Register extends ActionSupport {

    private static final long serialVersionUID = 1L;

    private Person personBean;

        //................
}


Using the s:form tag one can bind the parameter from the client to a java
object(the personBean in the Register action).

However it seems that the struts tag is required,but my action is not called
from the web form,so any way?

And I tried this way:

public class ParaWrapper(){

  private String firstName;

  public void setFirstName(String ..){

    this.firstName=...

  }
  //the getter of firstName

  public ....
}


public MyAction extends ActionSupport{

  private ParaWrapper wrapper;

  public void setXXX()...

  public void getXXX()...

  public void execute(){

    System.out.println(wrapper.getFirstName()); //here I can not get
the parameters,it seems that the parameters are not populated to this
object.

  }
}

It does not work since struts does not know which object should be
used to bind the parameter.


I wonder there is any way to using this manner?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message