Yup, I am using the struts html tag library and thus the html:form tag has
been used.
Yes the Person class exposes attributes through getters and setters. I am
here quoting the Person class and NameForm:
public class NameForm extends ActionForm
{
private Person p;
public void setP(Person p) {
this.p = p;
}
public Person getP() {
return p;
}
}
And the Person class is as follows:
public class Person
{
private String firstName;
private String lastName;
private int age;
public void setFirstName(String firstname) {
this.firstName = firstName;
}
public String getFirstName() {
return firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getLastName() {
return lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
And the nameForm.jsp uses these. The code of concern is as follows:--
<nested:nest property="p">
<nested:text property="firstName"/>
</nested:nest>
I even tried this:
<html:text property="p.firstName"/>
On Fri, Nov 5, 2010 at 11:40 PM, Dave Newton <[email protected]> wrote:
> Are you using the Struts form tag? Does the Person class expose its
> attributes through getters and setters?
>
> Dave
> On Nov 5, 2010 12:42 PM, "Abhishek Agarwal" <[email protected]> wrote:
> > It's killing me.
> >
> > I am unable to use a pojo(simple java class akin Employee or Person)
> > in my struts 1.3 ActionForm as a formbean's property. I am referring
> > complete reference second edition, and I see in it, it has been
> > mentioned that owing to java's reflection one can use the nested
> > properties in formbeans.
> >
> > But when I use it, and try to access it in the form's input jsp page,
> > then I get this exception:
> >
> > org.apache.jasper.JasperException: javax.servlet.ServletException:
> > javax.servlet.jsp.JspException: Invalid argument looking up property
> >
> > Actually I created a Person property named "p" for my form, and this
> > Person class has certain attributes, one of them being,
> > firstName(String).
> > When I create a form for taking this firstName as input, by using:
> > <html:text property="p.firstName"/> inside <form action="/Calc"/>, it
> > gives the above mentioned exception.
> > I even tried the nested tag library tag for the same, but it i also
> > having the same problem.
> >
> > Mercy, please. :(
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>