This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Jsp & JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

Jsp & JavaScript

kanth varada
Greenhorn

Joined: Feb 14, 2006
Posts: 14
hi

I want to set the value for the html hidden tag through Java Script and i want to use that hidden tag value in a jsp page.

i.e

<input type=hidden value=" " name="hid">

<script langauge="javascript">
//here i want to asign the value for the hidden input tag....

</script>

<%

//here i want to retreive the value into a variable....

%>


Pls send me the Stuff how can i do that.....
Pls send me a small example......
Shilpa Asuthkar
Greenhorn

Joined: Dec 22, 2005
Posts: 10
hope this will help u.....

<html>
<head>
<script language="javascript">
function meth()
{
document.getElementById("t1").value="SHILPA";
}
</script>
</head>
<body>

<form name="myform" action="temp1.jsp" onSubmit="return meth()">
<input type="hidden" name="t1" value='<%=request.getParameter("t1") %>' >
<input type="submit" value="submit" >

</form>
<% String str=null;
if(request.getParameter("t1")!=null)
str=request.getParameter("t1");
%>
<%= str%>
</body>
</html>


cheerss,
Shilpa
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60737
    
  65

Please continue any discussion on your previous post on this same topic.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: Jsp & JavaScript
 
Similar Threads
Self Submit Form
one submit button two action
Checking if browser supports JAVASCRIPT and COOKIES...
Setting a hidden feild
setting value for hidden tag