• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

request.getParamter returning null

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Anju" please check your private messages for an important message from me.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic