Hi all!

Coming from the Struts1 world, I find Struts2 really convenient!
But I have a simple problem, maybe I miss something. I've read some
tutorials about Struts2 but didn't find something... Here it is:

I'm modifying an actual project based on struts2, spring and freemarker. I
have to add some functionnalities to a page, so I have to modify an Action,
by adding three simple pojo objects, with the getters/setters (these
class/variables names are fictional):
*
public class MyAction extends ActionSupport{

private Bean bean;
private Bean2 bean2;
private Bean3 bean3;

public Bean getBean(){
   return bean;
}

public void setBean(Bean bean){
  this.bean = bean;
}
...
}

public class Bean{
  private String title;
  private String description;

  public String getTitle(){
    return title;
  }

  public void setTitle(String title){
    this.title = title;
  }

  public String getDescription(){
    return description;
  }

  public void setDescription(String description){
    this.description = description;
  }

}*
*...*

All these objects have a title and description as variables, so on my page,
I have these inputs:
*
<@s.textfield name="bean.title" />
<*...@s.textfield** name="bean.description" />
...*

When I first print the page (input method of my action), my beans are well
filled with the values I put on the action. But when I submit the page, all
my beans stay at null (debugger on the action class)! And I don't know why
It's been one day and an half that I'm trying to get this working, but I
don't why my objects stay at null after the submit of my page (I've already
checked the name of my variables, trying to rename my beans, etc.)

Could someone please tell me if I am missing something? I thought that with
struts2, you just have to declare you're objects (String, Integer, Self made
beans, etc.) on the Action with the good getters/setters and Struts take
care of this automatically (not like Struts1 where you have to declare your
beanform on the struts.xml).


Thanks!

-- 
Philippe Goncalves
http://www.linkedin.com/in/philippegoncalves
http://www.philippegoncalves.com
Tel: +15146326816

Reply via email to