IntelliJ Java IDE
The moose likes JSP and the fly likes Assigning values to hidden variables Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Assigning values to hidden variables" Watch "Assigning values to hidden variables" New topic
Author

Assigning values to hidden variables

Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 61

Hi


Can you please let me know how do I pass the value of one field(i.e the input value entered by user for a particular field ) as the value for a hidden field in jsp.


THanks in advance
Neeraj Dhiman
Ranch Hand

Joined: Dec 19, 2011
Posts: 61

I used a java script function for this. Correct me if i am doing this in wrong way.


Correct Me if i am wrong
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

JavaScript is not necessary. Simply use an EL expression (with <c:out> if encoding is needed) to emit the value as the value attribute of the hidden element.

E.g.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Neeraj Dhiman
Ranch Hand

Joined: Dec 19, 2011
Posts: 61

yes this is the better one. thanks Bibeault.
 
IntelliJ Java IDE
 
subject: Assigning values to hidden variables
 
Threads others viewed
Regarding to retain hidden variable on click of browser back button
to get value of disabled check box value in action class
textfield disabled---value not sent to form bean
Make email send optional for user
TextField Readonly issue
developer file tools