[Webinar] Streamline your web hosting managementRegister Today

  • 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");

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/bandwidth_test/bandwidth_process.jsp?payLoadType="+<%=payLoadType %>>
4 Solutions
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.
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");
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 ...


and now in this bandwidth_process.jsp page do

<% String payLoadType= (String)request.getSession().getAttribute("payload");
      request.getSession().setAttribute("payload" ,null);
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.


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