D
Daniel
Hi all,
I am having some difficulty accessing nested beans inside an ActionForm
with Struts (latest version).
I have a User object inside the form, and in the JSP page, I am trying
to call some properties on the User object:
<html:text property="user.username"/>
<html:text property="user.password"/>
I get the following error when accessing the JSP page:
javax.servlet.ServletException: Invalid argument looking up property
user.username of bean org.apache.struts.taglib.html.BEAN
If I use <html:text property="user"/> I don't get any errors but it
doesn't like user.username or user.password.
My form and User classes are as follows:
public class User
{
public String username;
private String password;
private String firstname;
private String lastname;
private String phone;
private String email;
private String state;
public User()
{
}
public String getUsername()
{
return username;
}
public void setUsername( String username )
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword( String password )
{
this.password = password;
}
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 String getPhone()
{
return phone;
}
public void setPhone( String phone )
{
this.phone = phone;
}
public String getEmail()
{
return email;
}
public void setEmail( String email )
{
this.email = email;
}
public String getState()
{
return state;
}
public void setState( String state )
{
this.state = state;
}
}
public class Form extends ActionForm
{
private User user;
public User getUser()
{
return user;
}
public void setUser( User user )
{
this.user = user;
}
public Form()
{
}
}
Thanks in advance!
I am having some difficulty accessing nested beans inside an ActionForm
with Struts (latest version).
I have a User object inside the form, and in the JSP page, I am trying
to call some properties on the User object:
<html:text property="user.username"/>
<html:text property="user.password"/>
I get the following error when accessing the JSP page:
javax.servlet.ServletException: Invalid argument looking up property
user.username of bean org.apache.struts.taglib.html.BEAN
If I use <html:text property="user"/> I don't get any errors but it
doesn't like user.username or user.password.
My form and User classes are as follows:
public class User
{
public String username;
private String password;
private String firstname;
private String lastname;
private String phone;
private String email;
private String state;
public User()
{
}
public String getUsername()
{
return username;
}
public void setUsername( String username )
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword( String password )
{
this.password = password;
}
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 String getPhone()
{
return phone;
}
public void setPhone( String phone )
{
this.phone = phone;
}
public String getEmail()
{
return email;
}
public void setEmail( String email )
{
this.email = email;
}
public String getState()
{
return state;
}
public void setState( String state )
{
this.state = state;
}
}
public class Form extends ActionForm
{
private User user;
public User getUser()
{
return user;
}
public void setUser( User user )
{
this.user = user;
}
public Form()
{
}
}
Thanks in advance!