Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [s2] LazyDynaBean and ModelDriven interface

Mark Shifman

2006-12-04

Replies:

Mark Shifman wrote:
> Does anybody have an example of using a LazyDynaBean with the
> ModelDriven interface?
> http://struts.apache.org/2.x/docs/struts-1-solutions.html implies that
> it should work.
>
> I have a simple action:
> public final class MyAction extends ActionSupport implements ModelDriven{
>   private LazyDynaBean f;
>   public String execute() throws Exception {
>     String my_field = (String)f.get("my_field");
>     LOG.fatal(my_myfield); //nothing here :-(
Opps I made a typo for this example should be:
LOG.fatal(my_field);
>     return SUCCESS;
>   }
>    public Object getModel() {
>     return f = new LazyDynaBean();
>   }
> }
>
> I don't get anything from the LazyDynaBean.
> If I use a simple pojo like
> public class myBean {
> String my_field;
> public String getMy_field() {
>     return my_field;
>   }
>
>   public void setMy_field(String my_field) {
>     this.my_field= my_field
>   }
>
> Things work.
>
> What am I missing or doing wrong?
> Thanks in advance
> mas
>


--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
mark.shifman@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.