Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get hidden variable name  RSS feed

 
Archana Annamaneni
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this strange problem
I have list of rooms with hyperlinks , i am calling the listtranscripts.jsp file when the user click on the link , but i want to know on which link user clicked.I mean the room name , for that i used the hideen , but somwhow it is returning null, i think i am doing something wrong.Any help greatly apprecitaed.
for(int i=0;i<=rooms.length-1; i++)
{ %>
<a href=listtranscripts.jsp><%= rooms[i]%><input type=hidden name=roomname value="<%= rooms[i]%>"></a>
<br>
<br>
<%
}
%>
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want the hidden variable to be transmitted, you will have to use a FORM - otherwise you just have a hyperlink.
Also - the best practice is to use quotes for all those tag attributes:
name="roomvalue" etc.
Bill
 
Gary Mann
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also add the room name as a parameter on the hyperlink. e.g. something like
<%
for(int i=0;i<=rooms.length-1; i++)
{ %>
<a href=listtranscripts.jsp?name=<%=rooms[i]%>><%=rooms[i]%></a>
<br>
<br>
<%
}
%>
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!