• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP -- spaces in parameters not fully working from listbox  RSS feed

 
Mike Ev
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have a JSP page and I'm having trouble with some parameters... The page has a form containing a listbox, something like...


Files are browsed for with a <input type=file> object, when this is changed (onChange) the value is added to the listbox.

When the form is submitted with submit() -- all the selected options are then passed as parameters e.g. page.jsp?listnames=name+1&listnames=name+2

Here's the problem. Once submit I want to keep these values in the select box once its reloaded. So how I've done that is, for each 'listnames' paramater, an option is made when its reloaded

e.g.
for each filelist parameter...


Once the page is submit again, the spaces have now been removed. Where once there was 'name 1' which appears as 'listnames=name+1' on the parameters, it is now just 'name' when re-submitted. There seems to be a problem with the spaces being recognised the second time round!! Does any one have any ideas how to resolve this?

Thanks alot
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You omitted to include how you are obtaining parametername in the second pass.
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also left out would be quotes around the html attributes.
Without quotes, it will only take the value up to the first white space.


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good catch, Stefan!
 
Mike Ev
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lots, thats a big help
 
Manoj Paul
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are most welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!