• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in getting the value from request.getParameter  RSS feed

Ankit Gandhi
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please look at the code snipet below�..

<wps:urlGeneration contentNode="message_display" portletWindowState="Maximized" pacCheck="NoCheck" portletParameterType="action">
<wps:urlParam name="messageID" value="<%= messageID %>/>
<a href="<% wpsURL.write(out); %>"> <%= messageTitle %> </a>

In this jsp file we are creating the URL setting �messageID� as the parameter to be passed to next page. Means when we click on the link the message Id goes to the next jsp file, where we are fetching the value using

String message_id = request.getParameter("messageID");

But the value of message_id is assigning as Null. Because of that we are not able to pass this value to database.

And it�s strange that the same code is running in one environment and in other two environments, its giving null value in the next jsp file.
Is the problem in creating the URL or fetching the value using request.getParameter or the problem with any settings in the server ?

Please any one can help !!
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a theme based page or skin you are coding? I'd be curious to know why you're using wps tags?

I'm wondering if url encoding might solve your problem, but I'm not sure.

But lets do some troubleshooting.

You ARE putting something into the request scope with the name messageid, right? Like you're positive? Absolutely sure? Would bet the JavaRanch on it?

Okay then, in the next page, print out every parameter in the request scope to the log files/console file, or even in an out.print() to see what it is. Do somethign like this:

String[] parameterNames = request.getParameterName();
for (int i = 0; i< parameterNames.length; i++) {

You know what i mean. I bet you might see a parameter named: messageid2f20-9a0s8df0-98q-2903485-098sd-0f98a-098-0928145
or somethign like that. SOmething is being appended to the parameter, so you can't pull it out with the same name you pulled it in with.

Does this troubleshooting step make sense? Give it a try.

By the way, any chance a redirect happens between the page you set, and the page that retrieves? A redirect will create a new request, purging all the data that was placed in. For a test, see what happens if you put the data in the session. Can you get it out if you put it in the session? If so, maybe a redirect/new request is being generated between pages.

Annoying problem. Hope I've given you some ideas.

-Cameron McKenzie
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!