Reputation: 129
I have a requirment. I have placed a Hidden field in my HTML. I want to retrieve that hidden text value from Java. Is there any way to do it? I know we can do it in javascript but i need to extract the value from java. I have created a hidden text field like this:
<input type="HIDDEN" name="X" value="2356544">
I want to retrieve 2356544 through java. Please let me know how to do this.
Upvotes: 0
Views: 22761
Reputation: 1061
try like this
create id attribute in hidden field as id="X" then in javascript take value using id
var value=document.getElementById('X').value;
or
using name
var value=document.getElementsByName('X').value;
Upvotes: 0
Reputation: 1238
If you are using Servlets you can retrive the value of a parameter with
request.getParameter("X");
or if you have a JSP then use
Hello <c:out value="${param.X}" />
Upvotes: 3
Reputation: 327
This has to be a web application since it is using html. So in a web application you have request object, so you can use
request.getParameter("X") from your servlet or action.
Upvotes: 0