wood burning stoves*
The moose likes JSP and the fly likes request.getParamter  returning null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "request.getParamter  returning null" Watch "request.getParamter  returning null" New topic
Author

request.getParamter returning null

Anju
Greenhorn

Joined: Nov 08, 2004
Posts: 10
I am getting null value when I use request.getParameter("fieldname");.
I checked for the value in Javascript on button and it reaching there.
below is my code
public String pageHTML()
{
strBuffer.append("<form method=\"POST\" enctype=\"multipart/form-data\" action=\"");
strBuffer.append(getFormAction(request));
strBuffer.append("\" name =\"solution\" id = \"solution\">");

strBuffer.append("<span><input id=\"txtUserId\" name=\"UserId\" size=\"5\" maxlength=\"4\" tabindex=\"6\" ></input></span>\n");
strBuffer.append("<span><input id=\"txtUserId\" type=\"text\" name=\"UserId\" size=\"5\" maxlength=\"4\" tabindex=\"6\" ></input></span>\n");
strBuffer.append("<input type=\"button\" name=\"btnSendFeedbacks\" value=\"Send Feedback\" inclick=\"fn_SendFeedback();\" >");
strBuffer.append("</form>");
return strBuffer.toString();

This page is calling result.jsp

<html>

<%
String strSS = request.getParameter("UserId");
out.println("the request parameter is : " + strSS);
%>

<body>
<br>
<%=strSS%>
</body>
</htm >>>

Any help is appreciated.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410




With multipart forms, getParameter doesn't work.
You need to read the documentation for the upload libraries you're using to see how to read form parameters.


Why on Earth are you building up HTML from within Java code?
The whole point of templating languages like JSP/ASP/PHP is to free developers from having to do this.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60738
    
  65

"Anju" please check your private messages for an important message from me.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request.getParamter returning null
 
Similar Threads
Ajax code getting null value
My bean doesn't quite work
Problem with TextArea in jsp
Identifying which button was clicked
How i will display error details in the same jsp page