Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Liutauras Vilda
Paul Clapham
paul wheaton
Sheriffs:
Tim Cooke
Devaka Cooray
Rob Spoor
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Forum:
JSP
getParameter() method gives null
shawn peter
Ranch Hand
Posts: 1325
1
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
there are two
jsp
files in this example.one has form.it send to the other jsp.
i used getParameter() method to get the values.but only first one gives the valus.others give null.
i coudn't find the error?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <form action="abc.jsp" method="POST"> <table> <tr><td>Name<input type="text" name="name"></tr></tr> <tr><td>Age<input type="text" age="age"></tr></tr> <tr><td>Address<input type="text" address="address"></tr></tr> <tr><td><input type="submit" name="submit"></tr></tr> </table> </form> </body> </html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <% String name=request.getParameter("name"); String age=request.getParameter("age"); String address=request.getParameter("address"); out.println(name); out.println(age); out.println(address); %> </body> </html>
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is that really your HTML? Its invalid nature might prevent some browsers from processing it correctly.
Have you confirmed that the parameters are being sent (via Firebug, proxy, etc.)?
Amit Ghorpade
Bartender
Posts: 2856
10
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
And you are using scriptlets in your JSP, something not recommended at all. Try EL.
SCJP, SCWCD.
|
Asking Good Questions
|
Sri Gnana
Ranch Hand
Posts: 166
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Check with your html text field names.
See the highlighted part
tr><td>Name<input type="text" name="name"></tr></tr>
<tr><td>Age<input type="text"
name
="age"></tr></tr>
<tr><td>Address<input type="text"
name
="address"></tr></tr>
<tr><td><input type="submit" name="submit"></tr></tr>
Actually you have to use "name" only, thats the tag to refer the name of the text field.
Thanks & Regards
Sri Gnana
Everythings Programmed!...
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Heh, I didn't even see that--I just saw the bad table cell/row nesting!
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
request.getAttribute Not Displaying Anything In JSP
NULL
Not able to set attribute in JSP
request time expression
include directive doesn't work
More...