how to putput a property of an object in session? (jsp/struts)

Guys,

I have an object (myGroup) that consist of 2 properties: groupName and groupTitle. The object is in a session called group_session.

On my jsp page, I would like to output the property groupName on the text field associated with the groupName:

<html:text property="name"

value=?

size="45"

maxlength="60" />

<html:errors property="name" />

Q: how can I output the value of the groupName in the value section?

thanks

[597 byte] By [xianwinwina] at [2007-10-3 9:40:48]
# 1
Simply use the setter method for the form field name before loading the JSP page. This means that in your Action servlet you will first set the value of "name" by reading from session and then your JSP will be loaded with the preset value.-Rohit
RohitKumara at 2007-7-15 4:56:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi

you can try something like this....

<input type="text" name="any" property="<bean:write name="myGroup" property="groupName " scope="session"/> " >

java_usera at 2007-7-15 4:56:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

> Hi

> you can try something like this....

>

> >

> <input type="text" name="any" property="<bean:write

> name="myGroup" property="groupName "

> scope="session"/> " >

>

This snippet is closer to JSP coding rather than struts. Leverage the capabilities of struts by setting the values in ActionServlet instead.

<html:text property="name" size="45" maxlength="60" />

-Rohit

By the way why did you add this tag

<html:errors property="name" /> ?

Message was edited by:

RohitKumar

RohitKumara at 2007-7-15 4:56:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
thanks, i did it from the action class.the<html:errors property="name" />is the error message from the ActionError
xianwinwina at 2007-7-15 4:56:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...