• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request from jsp form gives null string value

 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I get" null" each time I type my name and send it to be processed. My first file is called form.jsp and the second is called processform.jsp.
Why do I get the null for login name?
I do not get this for location?
I have just read that getParameter() is deprecated? could this be the problem?
<html>
<head>
<title> Welcome</title>
</head>
<body>
<h1> Welocme to my Web site. </h1>
<form action="processform.jsp" method="get">
<br> Enter your name:
<input type="text" name"userName"><br>

Where do you live?
<input type="text" name="region"><br>

<input type="submit" name="submit" value= "Submit button">

<input type="reset" name="reset" value= "Reset button">
<br>
</form>
</body>
<html>
<html>
<head>
<title> Thank you </title>
</head>
<body>
Your information has been processed.
<hr>
Thank You <%= request.getParameter("userName") %>
<br>
Your live in <%= request.getParameter("region") %>
</body>
</html>

Your information has been processed.
--------------------------------------------------------------------------------
Thank You null
Your live in London
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested your code on Tomcat4 and it worked for me.
I just edited this line:
<input type="text" name"userName"><br>
to
<input type="text" name="userName"><br>
 
Sanjeev Kaushik
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I tested your program on Weblogic 6.1.
It worked properly afer few changes
1) Putting "location" rather than region in the following line fo form.jsp
<input type="text" name="location"><br>
2) name= "processFormBeanId" rather than "processFromBeanID"
3)In the bean code "public" modifier in place of "private"
public String getUserName()
{
return userName;
}

It worked properly.
Regards,

Sanjeev Kaushik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic