File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes setting value for hidden tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

setting value for hidden tag

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......
[ February 15, 2006: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61457
    
  67

kanth varad, this is the fifth topic you've posted with the title "Jsp & Javascript". This makes it impossible to tell them apart. Please read this for more information.

I've changed the title of this topic to something more approriate, please do so on your own in future posts.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
<%
String someVariable = "SomeValue";
%>

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

<script langauge="javascript">
//here i want to asign the value for the hidden input tag....
//Write whatever javascript you wish to write keeping in mind that is
//is going to execute at the client and not the server.
</script>

<%

//here i want to retreive the value into a variable....
//Not possible as you assign it in JSP which goes to client. Next the
//client will send back the value to some JSP again.
%>


Life called,so here I am.<br />Cheers<br />Niki.:-)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61457
    
  67

As Niki pointed out, what you are asking to do is impossible. Please read this article for details on why.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I've already tried to tell him twice yesterday but...


[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61457
    
  67

Yes, you're right Satou. This isn't really much different a question than the one posted here, so I'm closing this topic.
 
Consider Paul's rocket mass heater.
 
subject: setting value for hidden tag