Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParamter returning null

 
Anju
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Anju" please check your private messages for an important message from me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic