Hi there,

I am new to JSP and I have some confusion about accessing request
parameters.  I have two small jsp below.  getParam.jsp uses setAttribute to
set a value to the request object.  displayParam.jsp tries to access the
value of the key (the key is "city").  The value displayed is null.

What am I doing wrong ?

getParam.jsp is as follows:

<html>
<head>
<title>
 Test
</title>
</head>
<body>
<form action="http://localhost:8080/displayParam.jsp" Method=Get >
 <% request.setAttribute("city", "New Delhi"); %>
 <Input Type = "submit" Name = "submit" Value="Submit">
</form>
</body>
</html>

setParam.jsp is as follows:

<html>
<head>
<title>
 Displayed Parameter
</title>
</head>
<body>
    <%=request.getAttribute("city") %>
 </body>
</html>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to