Setting the session property of Actioncontext in the home.jsp

284 Views Asked by At

By default if i have a struts homepage which is home.jsp which can be something like:

<%@taglib uri="/struts-dojo-tags" prefix="sd"  %>
<%@taglib uri="/struts-tags" prefix="s"  %>
<head>
<sd:head/>

</head>

<s:form action ="verify">
<s:textfield name="uname" label="name" required="true"/>
<s:textfield name="session.test2" label="test2"></s:textfield> ------(X)
<s:textfield name="age" label="age" required="true"/>
<sd:autocompleter name="country" list="cricketnations" showDownArrow="false" label ="cricket playing nations">
</sd:autocompleter>
<sd:datetimepicker name="dob" label="date of birth" displayFormat="dd-mm-yyyy" value="todayDate"/>
<s:submit  value="check"/>

</s:form>

As you can see i have pointed out line X , i want to set test2 parameter straight in the Session property of the actioncontext and not in the valuestack. i want to print this value in view.jsp as - <s:property value="%{#session.test2}" /> but output coming is test2 itself. how to do this correctly ? The one i have used above seems certainly wrong :(

Any help will be appreciated

Thanks Jayendra

0

There are 0 best solutions below