You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <ma...@reumann.net> on 2002/09/05 02:34:19 UTC

Re[2]: NullPointerException when using DynaValidatorForm

On Wednesday, September 4, 2002, 10:27:08 AM, Ashish Kulkarni wrote:

AK> HI
AK> Here is my jsp page, this has only one drop down box,
AK> <html:form action="/pages/selectenv" name="test" type="DynaValidatorForm">
AK> <html:select  property="envDrop" size="5" >
AK>      <html:optionsCollection name="ll1002" property="beanCollection"/>
AK> </html:select>
AK> </html:form>
 <SNIP>

AK> So what may be the problem

  Are you sure you have teh "beanCollection" property defined in your
  form definition in you config.xml file? You only posted the
  definition for envDrop so I'm not sure if you are missing
  beanCollection, but if so you will need that defined as well.

--

Rick

mailto:maillist@reumann.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: getting data in value object out of logic:iterate

Posted by Michael Lee <ml...@hotmail.com>.
You are very correct, there is a lot of 'chimp' like work in translating
value objects to forms to jsp tags to ApplicationResource.properties. I
spend lots of time double checking upper, lower case on stuff, simple
conversions (VO.setX(ActionForm.getX()) etc).
I'll have to check it out, thanks for the help!
Mike

----- Original Message -----
From: "John Raley" <jb...@mindspring.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, September 04, 2002 10:32 PM
Subject: Re: getting data in value object out of logic:iterate


> Hi Michael,
>
> You need:
> <logic:iterate name="users" id="aUser">
> <bean:write name="aUser" property="firstName"/>
> <%-- etc --%>
> </logic:iterate>
>
> The name attr in logic:iterate must match the attribute name of the List.
>
> Any BTW you're going to get really tired of writing Beans classes like
> User.  Many folks on this list are using the DynaBean framework.  Also
> let me plug my own project, dynclass.sourceforge.net, which will
> transform an arbitrary java Map into a JavaBean...
>
> Michael Lee wrote:
>
> >I read the docs and looked through the examples and didn't see anything
that
> >did what I was trying.
> >I have an array of Value(view) objects that I want to iterate through in
my
> >jsp.
> >
> >Here it is;
> >
> >public class User
> >{
> >     private String firstName;
> >     private String lastName;
> >     public String getFirstName() { return firstName; }
> >     public void setFirstName(String firstName) { this.firstName =
> >firstName; }
> >     public String getLastName() { return lastName; }
> >     public void setLastName(String lastName) { this.lastName =
lastName; }
> >...
> >}
> >
> >public SomeAction extendsAction
> >{
> >  perform(....
> >  {
> >    User[] users = new User[3];
> >    users[0] = user1;
> >    users[1] = user2;
> >    ...
> >    request.setAttribute("users", Arrays.asList(users));
> >    return mapping.findForward("something.jsp");
> >  }
> >}
> >
> >in the something.jsp
> ><TABLE>
> ><logic:iterate id="userList" name="?">
> ><TR>
> >  <TD>
> >   ??? users.getFirstName(); ???
> >  </TD>
> >  <TD>
> >    ??? users.getLastName(); ???
> >  </TD>
> >...
> ></TR>
> ></logic:iterate>
> >
> >HELP!
> >thanks,
> >Michael Lee
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
> >
> >
>
>
> --
> Check it out: Map -> JavaBean
> http://dynclass.sourceforge.net/
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: getting data in value object out of logic:iterate

Posted by John Raley <jb...@mindspring.com>.
Hi Michael,

You need:
<logic:iterate name="users" id="aUser">
<bean:write name="aUser" property="firstName"/>
<%-- etc --%>
</logic:iterate>

The name attr in logic:iterate must match the attribute name of the List.

Any BTW you're going to get really tired of writing Beans classes like 
User.  Many folks on this list are using the DynaBean framework.  Also 
let me plug my own project, dynclass.sourceforge.net, which will 
transform an arbitrary java Map into a JavaBean...

Michael Lee wrote:

>I read the docs and looked through the examples and didn't see anything that
>did what I was trying.
>I have an array of Value(view) objects that I want to iterate through in my
>jsp.
>
>Here it is;
>
>public class User
>{
>     private String firstName;
>     private String lastName;
>     public String getFirstName() { return firstName; }
>     public void setFirstName(String firstName) { this.firstName =
>firstName; }
>     public String getLastName() { return lastName; }
>     public void setLastName(String lastName) { this.lastName = lastName; }
>...
>}
>
>public SomeAction extendsAction
>{
>  perform(....
>  {
>    User[] users = new User[3];
>    users[0] = user1;
>    users[1] = user2;
>    ...
>    request.setAttribute("users", Arrays.asList(users));
>    return mapping.findForward("something.jsp");
>  }
>}
>
>in the something.jsp
><TABLE>
><logic:iterate id="userList" name="?">
><TR>
>  <TD>
>   ??? users.getFirstName(); ???
>  </TD>
>  <TD>
>    ??? users.getLastName(); ???
>  </TD>
>...
></TR>
></logic:iterate>
>
>HELP!
>thanks,
>Michael Lee
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


-- 
Check it out: Map -> JavaBean
http://dynclass.sourceforge.net/




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


getting data in value object out of logic:iterate

Posted by Michael Lee <ml...@hotmail.com>.
I read the docs and looked through the examples and didn't see anything that
did what I was trying.
I have an array of Value(view) objects that I want to iterate through in my
jsp.

Here it is;

public class User
{
     private String firstName;
     private String lastName;
     public String getFirstName() { return firstName; }
     public void setFirstName(String firstName) { this.firstName =
firstName; }
     public String getLastName() { return lastName; }
     public void setLastName(String lastName) { this.lastName = lastName; }
...
}

public SomeAction extendsAction
{
  perform(....
  {
    User[] users = new User[3];
    users[0] = user1;
    users[1] = user2;
    ...
    request.setAttribute("users", Arrays.asList(users));
    return mapping.findForward("something.jsp");
  }
}

in the something.jsp
<TABLE>
<logic:iterate id="userList" name="?">
<TR>
  <TD>
   ??? users.getFirstName(); ???
  </TD>
  <TD>
    ??? users.getLastName(); ???
  </TD>
...
</TR>
</logic:iterate>

HELP!
thanks,
Michael Lee


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>