471,895 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,895 software developers and data experts.

How to retain values in JSP using Struts2

How to retain values in jsp using struts2 tags.

I am using <s:select></s:select> which has inbuilt properties in it. But the values are not retained when the page gets refreshed.Can anyone help me in this.

Thanks in advance!
Feb 6 '09 #1
10 10657
13,262 8TB
Do other values on that page retain their values?
Feb 9 '09 #2
i dont have any text fields in that page, based on the drop down i get the list of employees and the current status of the employee.
Feb 9 '09 #3
13,262 8TB
Care to show the code?
Feb 9 '09 #4
Expand|Select|Wrap|Line Numbers
  1. <s:form action="control.action" method="Post">
  2.     <font color="orange"><s:text name="FILTRI" /></font>
  3.     <table style="border: solid 1px #777777;">
  4.         <tr>
  5.             <th align="left" class="cdr_label"><s:text name="CDR" /></th>
  6.         </tr>
  7.         <tr>
  8.             <td align="left"><s:select name="cdrList" headerKey="-1"
  9.                 headerValue="Select"  listKey="employeeCode" listValue="description"
  11.                 list="%{#session.EMPLOYEE_LIST}" /></td>
  12.             <td><s:submit cssClass="button_css" label="select"></s:submit></td>
  14.         </tr>
  15.     </table>
  16.     </from>
Feb 9 '09 #5
13,262 8TB
Is </from> supposed to be </form>?
Feb 9 '09 #6
Thanks, will check and ping
Feb 9 '09 #7
Mean while can u help me for adding other option tag in <s:select></s:select> tag.

My case is if the logged user is admin he should get the rights to view the entire drop down list or if normal user ,he can view only partial list.
Feb 9 '09 #8
13,262 8TB
Better do that on the server side. That is where the list is coming from isn't it?
You can then return the appropriate list based on who is logged in from the server side. Your front end (JSP) doesn't need to change for that.
Feb 9 '09 #9
Ya that is the better option but for other values in the drop down i have to send the other values as the key and for this case it is not so
Feb 9 '09 #10
actually i am adding two codes in the list key and passing it through request for other values in drop down

but for the value to be displayed for admin has different key.
Feb 9 '09 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Aniket Sule | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.