This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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
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: 63208
    
  69

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Have you checked out Aspose?
 
subject: request.getParamter returning null
 
It's not a secret anymore!