• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getParameter return null if query string contains %26

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I work with MVC model implementation recomended by IBM where I submit from a JSP to a controller servlet which redirect the request to whatever handler, I found the following behaviour, which occured on a single machine with IBM WepSphere AppServer 3.5.5 and doesn't occur on others:
I printed the following with the java APIs for getting the request string, servlet path, etc.....
Servlet Path = /controller.
Path info = /PublishingHandler.
Request URI = /vi_debug/controller/PublishingHandler.
Query String = Page=displayPublishing&relatedPublishingId=3&displayPublishingClosePageParameter=/vi_debug/controller/PublishingAdministrationHandler?Page=navigate_create_show_publishing_publishing%26CategoryToNavigate=1.
From the above values you can c that the query string contains key=value pairs but when I try to get the parameter values using the following code:
// Obtain the request parameters
Enumeration parameterEnum = p_Request.getParameterNames();
if ( parameterEnum.hasMoreElements() )
System.out.println( "Enumeration has elements" );
else
System.out.println( "Enumeration don't have elements" );

// Go through them one at a time and print them out
while ( parameterEnum.hasMoreElements() ) {
String name = (String) parameterEnum.nextElement();
System.out.println( "Parameter name: " + name );
System.out.println( "Parameter value: " + p_Request.getParameter( name ) );
}
I got the message that Enumeration don't have elements, I recognized that this happens when the querystring contains %26 I'm using this character so that I submit with a query string that have more than ? character & I wanted to keep the & that occured after the second ?
Also I used the upload utility from orielly, and the form is multi-part & I concatenat some values in the query string, but I didn't get them using getParameter, Is the getParameter method not used when the form is muli-part, and if so what with used in this case?
thankx for yr time.
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok... so the URL you were accessing looks like this:
/vi_debug/controller/PublishingHandler?Page=displayPublishing&relatedPublishingId=3&displayPublishingClosePageParameter=/vi_debug/controller/PublishingAdministrationHandler?Page=navigate_create_show_publishing_publishing%26CategoryToNavigate=1.
Notice you have your URI -- then a ? that defines the beginning of the query string. After that, each Name=Value pair is seperated by a & --- but then -- you have a nother ? -- I'm guessing your appserver is being confused by the 2nd ? (which normally specifies the beginning of a query string)
reply
    Bookmark Topic Watch Topic
  • New Topic