[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Parameter passing error

Hi all,

What wrong with the code below? I  get payLoadType=null in my bandwidth_process.jsp.

<% String payLoadType=request.getParameter("payload");
   System.out.println("payLoadType===="+payLoadType);
%>

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/bandwidth_test/bandwidth_process.jsp?payLoadType="+<%=payLoadType %>>
0
jen2483
Asked:
jen2483
4 Solutions
 
kiranhkCommented:
initially when this page is accessed payload will be null and that is what is being set in the URL for your Meta refresh and so in your bandwidth_process.jsp you are getting null.
0
 
GuntCommented:
URL=/bandwidth_test/bandwidth_process.jsp?payLoadType="+<%=payLoadType %>

You should pass the parameter in the URL with the name payload.
request.getParameter("payload") will get the parameter named "payload", you are sending it with the name "payLoadType"

Should be: URL=/bandwidth_test/bandwidth_process.jsp?payload="+<%=payLoadType %>

Or: <% String payLoadType=request.getParameter("payLoadType");
0
 
CodingExpertsCommented:
Hi jen

How are you getting the 'payload' parameter onto this page ??....

In the previous page from where you are getting the payload parameter try doing ...

request.getSession().setAttribute("payload","payload123");

and now in this bandwidth_process.jsp page do

<% String payLoadType= (String)request.getSession().getAttribute("payload");
      request.getSession().setAttribute("payload" ,null);
%>
0
 
KarcOriginCommented:
Hi,
There are few possibilities of getting payload request variable as null.
1. If you are coming from other page to this (current) page your previous page seems that it does not have payload object whose value you are trying to get.

2. If this is your base page that means you are not posted to this page from any other page then initially the payload object will have null, which is quite obvious too because till unload this page at the client machine the payload object is not been defined.

Please check if the payload object is defined property before you actully accessing it value.

NOTE: In my comment the object is refer to any valid HTML objects as textbox, button, hidden...

I hope it helps you.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now