You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam K <ad...@gmail.com> on 2006/11/20 20:21:51 UTC

Indexed Property and Hand Cranking Lazy List

Hello all, I am sorry to subject this list to yet another person who doesn't
understand something, but I can't for the life of me figure out hand
cranking lazy lists.

I am using 1.2.9 with java 1.5.0_06 And I can't get lazy lists to work.

I am trying to use what I found at :

http://wiki.apache.org/struts/StrutsCatalogLazyList

And as such have :
In the ProdSelectionFrom:

      private List skills = new ArrayList();

      public List getSkills() {
          return skills;
      }

      // non-bean version so as not to confuse struts.
      public void populateSkills(List skills) {
          this.skills.addAll(skills);
       }

      public void setSkills(Product skill) {
          this.skills.add(skill);
      }

      public Product getSkills(int index) {

          // automatically grow List size
          while (index >= skills.size()) {
              skills.add(new Product());
          }

          return (Product)skills.get(index);
      }

In the JSP:

   <logic:iterate name="ProdSelectionForm" property="skills" id="skills">
    <tr>
        <td>
                   <html:text name="skills" property="skillId"
indexed="true"/>
        </td>
    </tr>
   </logic:iterate>

And can't even get this to display properly.
I am getting the error message:

No getter method for property: "skills" of bean: "ProdSelectionForm"
javax.servlet.ServletException: javax.servlet.jsp.JspException: No
getter method for property: "skills" of bean: "ProdSelectionForm"


Could someone please point me in the right direction as I am at my wits end
on this.

The entire point of what I am trying to do is to be able to post a list of
information about a product (such as description, number, price etc) and
allow the user to edit the number and have them submit the form so that I
can update a database with a new order.
I am using a product Object which has all of the characteristics mentioned
before as well as others, and each of them have publically available getter
and setter methods.

I would also like to confirm that the comment I read that I should be using
strictly strings when dealing with the jsp is correct - can someone confirm
that  ?
Also is there a problem using ArrayList over List ?

Thanks so much for any thoughts/ time you can give me.

Re: Indexed Property and Hand Cranking Lazy List

Posted by Hubert Rabago <hr...@gmail.com>.
I'm just saying I'm not too confident about the example you followed.
If I had the time right now, I'd test it in a sample app just to see
if it would work.  Your message seems to say it doesn't, though.

Try modifying the form so that getter and setter return and accept a
List.  And for your other question, the answer is yes, indexed or not,
<html:text> should be referring to string properties.

Hubert

On 11/20/06, Adam K <ad...@gmail.com> wrote:
> I had modified it after you are correct, I am trying to get it to fit in
> with my work.
> Hubert are you suggesting what I am trying to do will not work in the manner
> I am trying to do it ?
>
> thanks in advance
>
> On 11/20/06, Hubert Rabago <hr...@gmail.com> wrote:
> >
> > Struts is getting confused by:
> >
> > >       public List getSkills() {
> > >           return skills;
> > >       }
> >
> > >       public void setSkills(Product skill) {
> > >           this.skills.add(skill);
> > >       }
> >
> > The getter and setter should be consistent.
> >
> > -----
> >
> > Hmm... I just looked at the link you sent and it looks like your code
> > was modelled after that.  I've never done it that way, and I would not
> > have expected it to work.  What I've done in the past is much closer
> > to the examples under the "Using Commons Collections for lazy Lists"
> > section, where the getter and setter return and accept the same type.
> >
> > Hubert
> >
> >
> > On 11/20/06, Adam K <ad...@gmail.com> wrote:
> > > Hello all, I am sorry to subject this list to yet another person who
> > doesn't
> > > understand something, but I can't for the life of me figure out hand
> > > cranking lazy lists.
> > >
> > > I am using 1.2.9 with java 1.5.0_06 And I can't get lazy lists to work.
> > >
> > > I am trying to use what I found at :
> > >
> > > http://wiki.apache.org/struts/StrutsCatalogLazyList
> > >
> > > And as such have :
> > > In the ProdSelectionFrom:
> > >
> > >       private List skills = new ArrayList();
> > >
> > >       public List getSkills() {
> > >           return skills;
> > >       }
> > >
> > >       // non-bean version so as not to confuse struts.
> > >       public void populateSkills(List skills) {
> > >           this.skills.addAll(skills);
> > >        }
> > >
> > >       public void setSkills(Product skill) {
> > >           this.skills.add(skill);
> > >       }
> > >
> > >       public Product getSkills(int index) {
> > >
> > >           // automatically grow List size
> > >           while (index >= skills.size()) {
> > >               skills.add(new Product());
> > >           }
> > >
> > >           return (Product)skills.get(index);
> > >       }
> > >
> > > In the JSP:
> > >
> > >    <logic:iterate name="ProdSelectionForm" property="skills"
> > id="skills">
> > >     <tr>
> > >         <td>
> > >                    <html:text name="skills" property="skillId"
> > > indexed="true"/>
> > >         </td>
> > >     </tr>
> > >    </logic:iterate>
> > >
> > > And can't even get this to display properly.
> > > I am getting the error message:
> > >
> > > No getter method for property: "skills" of bean: "ProdSelectionForm"
> > > javax.servlet.ServletException: javax.servlet.jsp.JspException: No
> > > getter method for property: "skills" of bean: "ProdSelectionForm"
> > >
> > >
> > > Could someone please point me in the right direction as I am at my wits
> > end
> > > on this.
> > >
> > > The entire point of what I am trying to do is to be able to post a list
> > of
> > > information about a product (such as description, number, price etc) and
> > > allow the user to edit the number and have them submit the form so that
> > I
> > > can update a database with a new order.
> > > I am using a product Object which has all of the characteristics
> > mentioned
> > > before as well as others, and each of them have publically available
> > getter
> > > and setter methods.
> > >
> > > I would also like to confirm that the comment I read that I should be
> > using
> > > strictly strings when dealing with the jsp is correct - can someone
> > confirm
> > > that  ?
> > > Also is there a problem using ArrayList over List ?
> > >
> > > Thanks so much for any thoughts/ time you can give me.
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Indexed Property and Hand Cranking Lazy List

Posted by Adam K <ad...@gmail.com>.
I had modified it after you are correct, I am trying to get it to fit in
with my work.
Hubert are you suggesting what I am trying to do will not work in the manner
I am trying to do it ?

thanks in advance

On 11/20/06, Hubert Rabago <hr...@gmail.com> wrote:
>
> Struts is getting confused by:
>
> >       public List getSkills() {
> >           return skills;
> >       }
>
> >       public void setSkills(Product skill) {
> >           this.skills.add(skill);
> >       }
>
> The getter and setter should be consistent.
>
> -----
>
> Hmm... I just looked at the link you sent and it looks like your code
> was modelled after that.  I've never done it that way, and I would not
> have expected it to work.  What I've done in the past is much closer
> to the examples under the "Using Commons Collections for lazy Lists"
> section, where the getter and setter return and accept the same type.
>
> Hubert
>
>
> On 11/20/06, Adam K <ad...@gmail.com> wrote:
> > Hello all, I am sorry to subject this list to yet another person who
> doesn't
> > understand something, but I can't for the life of me figure out hand
> > cranking lazy lists.
> >
> > I am using 1.2.9 with java 1.5.0_06 And I can't get lazy lists to work.
> >
> > I am trying to use what I found at :
> >
> > http://wiki.apache.org/struts/StrutsCatalogLazyList
> >
> > And as such have :
> > In the ProdSelectionFrom:
> >
> >       private List skills = new ArrayList();
> >
> >       public List getSkills() {
> >           return skills;
> >       }
> >
> >       // non-bean version so as not to confuse struts.
> >       public void populateSkills(List skills) {
> >           this.skills.addAll(skills);
> >        }
> >
> >       public void setSkills(Product skill) {
> >           this.skills.add(skill);
> >       }
> >
> >       public Product getSkills(int index) {
> >
> >           // automatically grow List size
> >           while (index >= skills.size()) {
> >               skills.add(new Product());
> >           }
> >
> >           return (Product)skills.get(index);
> >       }
> >
> > In the JSP:
> >
> >    <logic:iterate name="ProdSelectionForm" property="skills"
> id="skills">
> >     <tr>
> >         <td>
> >                    <html:text name="skills" property="skillId"
> > indexed="true"/>
> >         </td>
> >     </tr>
> >    </logic:iterate>
> >
> > And can't even get this to display properly.
> > I am getting the error message:
> >
> > No getter method for property: "skills" of bean: "ProdSelectionForm"
> > javax.servlet.ServletException: javax.servlet.jsp.JspException: No
> > getter method for property: "skills" of bean: "ProdSelectionForm"
> >
> >
> > Could someone please point me in the right direction as I am at my wits
> end
> > on this.
> >
> > The entire point of what I am trying to do is to be able to post a list
> of
> > information about a product (such as description, number, price etc) and
> > allow the user to edit the number and have them submit the form so that
> I
> > can update a database with a new order.
> > I am using a product Object which has all of the characteristics
> mentioned
> > before as well as others, and each of them have publically available
> getter
> > and setter methods.
> >
> > I would also like to confirm that the comment I read that I should be
> using
> > strictly strings when dealing with the jsp is correct - can someone
> confirm
> > that  ?
> > Also is there a problem using ArrayList over List ?
> >
> > Thanks so much for any thoughts/ time you can give me.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Indexed Property and Hand Cranking Lazy List

Posted by Hubert Rabago <hr...@gmail.com>.
Struts is getting confused by:

>       public List getSkills() {
>           return skills;
>       }

>       public void setSkills(Product skill) {
>           this.skills.add(skill);
>       }

The getter and setter should be consistent.

-----

Hmm... I just looked at the link you sent and it looks like your code
was modelled after that.  I've never done it that way, and I would not
have expected it to work.  What I've done in the past is much closer
to the examples under the "Using Commons Collections for lazy Lists"
section, where the getter and setter return and accept the same type.

Hubert


On 11/20/06, Adam K <ad...@gmail.com> wrote:
> Hello all, I am sorry to subject this list to yet another person who doesn't
> understand something, but I can't for the life of me figure out hand
> cranking lazy lists.
>
> I am using 1.2.9 with java 1.5.0_06 And I can't get lazy lists to work.
>
> I am trying to use what I found at :
>
> http://wiki.apache.org/struts/StrutsCatalogLazyList
>
> And as such have :
> In the ProdSelectionFrom:
>
>       private List skills = new ArrayList();
>
>       public List getSkills() {
>           return skills;
>       }
>
>       // non-bean version so as not to confuse struts.
>       public void populateSkills(List skills) {
>           this.skills.addAll(skills);
>        }
>
>       public void setSkills(Product skill) {
>           this.skills.add(skill);
>       }
>
>       public Product getSkills(int index) {
>
>           // automatically grow List size
>           while (index >= skills.size()) {
>               skills.add(new Product());
>           }
>
>           return (Product)skills.get(index);
>       }
>
> In the JSP:
>
>    <logic:iterate name="ProdSelectionForm" property="skills" id="skills">
>     <tr>
>         <td>
>                    <html:text name="skills" property="skillId"
> indexed="true"/>
>         </td>
>     </tr>
>    </logic:iterate>
>
> And can't even get this to display properly.
> I am getting the error message:
>
> No getter method for property: "skills" of bean: "ProdSelectionForm"
> javax.servlet.ServletException: javax.servlet.jsp.JspException: No
> getter method for property: "skills" of bean: "ProdSelectionForm"
>
>
> Could someone please point me in the right direction as I am at my wits end
> on this.
>
> The entire point of what I am trying to do is to be able to post a list of
> information about a product (such as description, number, price etc) and
> allow the user to edit the number and have them submit the form so that I
> can update a database with a new order.
> I am using a product Object which has all of the characteristics mentioned
> before as well as others, and each of them have publically available getter
> and setter methods.
>
> I would also like to confirm that the comment I read that I should be using
> strictly strings when dealing with the jsp is correct - can someone confirm
> that  ?
> Also is there a problem using ArrayList over List ?
>
> Thanks so much for any thoughts/ time you can give me.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org