can't get ModelDriven property bean from stack
----------------------------------------------
Key: WW-2578
URL: https://issues.apache.org/struts/browse/WW-2578
Project: Struts 2
Issue Type: Bug
Affects Versions: 2.0.11.1
Reporter: alex pan
Priority: Minor
hi all,
i am a beginner of struts2.
i added a new struts2 project. below is the code.
property in JSP page
bike name <stl:textfield name="bike.name" />
color<stl:textfield name="bike.color" />
size<stl:textfield name="bike.size" />
Java code,
public class Bike {
private String name;
private String color;
private String size;
public Bike() {
System.out.print("creating a new bike");
}
**getter and setter methode**
}
public class AddBikeAction extends ActionSupport implements ModelDriven {
private Bike bike
public AddBikeAction() {
}
public void setBike(Bike bike) {
this.bike =bike;
}
public String execute() {
System.out.print(bike.getName);
System.out.print(bike.getColor);
System.out.print(bike.getSize);
return SUCCESS;
}
public People getModel() {
return bike;
}
}
when i access AddBikeAction, this log is
creating a new bike
creating a new bike
creating a new bike
null
null
67(i input in JSP page)
i am confused why it always create a new Bike object when each time setting the
property. so i only can get a Bike object with one not null property.
i want to know what's wrong in my code or i was missing some config. so i got
this issue.
thanks,
Alex
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.