struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam K" <ada...@gmail.com>
Subject Re: Indexed Property and Hand Cranking Lazy List
Date Mon, 20 Nov 2006 20:46:07 GMT
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 <hrabago@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 <adamk1@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
>
>

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