hi to all i'am sorry of my english and i hope that you could help me.
i have a problem:
I have a bean class "UsersClass" that has 2 fields:
int userId, and String userName.
This class has both the "get" and "set" methods of the fields.
In an Action of struts i instanziate the Class
UserClass user = new UserClass();
user.setUserId(10);
user.setUserName("username");
request.setAttribute("user", user);
and set it in the request
then in the jsp i use this code to see the properties of the class.
1) <bean:write name="user" property="username" />
2) <bean:write name="user" property="userId" />
but if i write only the first properties "username" i see the property normally, but if i use also the properties "userId" i receive in a jsp an error. Is it normal? Where is the mistake?
I use Tomcat 5.5
best regards Andrea from Roma Italia
-
<bean:write and struts errors.... (2 messages)
- Posted by: Andrea zzzzzzzzzzzzzzzzzzzzzz
- Posted on: December 15 2005 06:29 EST
Threaded Messages (2)
- <bean:write and struts errors.... by Georg Mueller on December 21 2005 12:10 EST
- bean:write cannot handle int and long by Thomas Jensen on January 26 2006 08:11 EST
-
<bean:write and struts errors....[ Go to top ]
- Posted by: Georg Mueller
- Posted on: December 21 2005 12:10 EST
- in response to Andrea zzzzzzzzzzzzzzzzzzzzzz
hm - could you show the stack trace of the error?
is "username" correct - should it not be "userName", but this one works, strange... -
bean:write cannot handle int and long[ Go to top ]
- Posted by: Thomas Jensen
- Posted on: January 26 2006 08:11 EST
- in response to Andrea zzzzzzzzzzzzzzzzzzzzzz
Try this:
<bean:write name="user" property="userId" format=""/>