0

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

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
jayendra bhatt
  • 1,337
  • 2
  • 19
  • 41
  • 1
    You can't alter the session from the client, however you can do it on the server, but the value you want to set is not clear and related part of code is required to do so. – Roman C Jan 11 '15 at 17:17
  • right , u mean the session attribute of actioncontext class can only be set inside a java or jsp but not directly in the index/home page which is directly fed to the valuestack. – jayendra bhatt Jan 12 '15 at 12:08
  • The action context is a map, what kind of properties are you talking? *but output coming is test2 itself*, if the `test2` is not in the session map then it will output nothing. – Roman C Jan 12 '15 at 18:23

0 Answers0