• Post Reply Bookmark Topic Watch Topic
  • New Topic

retirving a value from query string

 
Saurabh Jhunjhunwala
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i am writing a jsp page, which has a anchor tag, when this tag works the url of the target is appended my a variable along with a value associated to it, i want to trap this value from the query string in the target page,

i mean

<%
if(x==1)
{
%>
<a>xyz.jsp?nam=val </a>
<%
}
else
{
%>
<a>xyz.jsp?nam=val1 </a>
<%
}
%>
this is written in the first jsp, in the target jsp i want the value which has been assigned

can anyone please help me out

saurabh
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use request.getParameter("nam") in the target jsp.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per forum instructions you should have included what version of JSP you are using.

If using JSP 2:


P.S. Please be sure to always post working code. Your <a> tags are malformed.
[ April 29, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit M Tank:
use request.getParameter("nam") in the target jsp.
Only if using JSP 1. In JSP 2, the use of scriplets should be deprecated.
[ April 29, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!