469,291 Members | 1,814 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,291 developers. It's quick & easy.

How to retain values in JSP using Struts2

SaiRockinGuy
Hi,
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 10446
r035198x
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
r035198x
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"
  10.  
  11.                 list="%{#session.EMPLOYEE_LIST}" /></td>
  12.             <td><s:submit cssClass="button_css" label="select"></s:submit></td>
  13.  
  14.         </tr>
  15.     </table>
  16.     </from>
Feb 9 '09 #5
r035198x
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
r035198x
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 zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.