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 %>>
jen2483Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.