File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSP
Bookmark "request.getParamter  returning null" Watch "request.getParamter  returning null" New topic

request.getParamter returning null


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("\" 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();\" >");
return strBuffer.toString();

This page is calling result.jsp


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

</htm >>>

Any help is appreciated.
Ben Souther

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

Joined: Jan 10, 2002
Posts: 63867

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

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: request.getParamter returning null
It's not a secret anymore!