Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Reverse2Servlet - spaces and quotes

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I've reached my point of frustration so I thought I thought I should see if any of you other "drivers" could help out.
Here's what I have set up for this problem. I am using doGet only. I am utilizing the Str object that I saw reference in another post earlier. It seems that there has been a lot of talk about quotes earlier so I am aware that this may be an issue with the given testing string.
My problem is this, I am only getting the last "word" in the string to show up in the text box. For example if I typed in "show up" in the text box, I would only get up to show upon submission. The funny thing is that in the source I can see both words. This situation exists whether or not there are any quotes in the test string. Anyone have any hints or suggestions as to what the problem may be?
Thanks.
 
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get both/all words to show up, the phrase/string you want to work with must be enclosed within quote (either " or ') marks.
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ronald i had exactly the same problem as you and even putting it in quotation marks didn't work, so i forced it to work by taking in the string and replacing the spaces with something else (ill let you figure out what) so that it appeared as one long word to the browser. This seemed to work fine and i was let through with it.
Also from my experience i think you might want to reconsider using doGet() and look at using both instead as doGet() is generally considered unsafe from a security point of view in the wider world and is often discouraged.
Hope i didn't give too much away
Thanks
[ July 15, 2002: Message edited by: Sam Tilley ]
 
Ronald Schindler
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam - that did it. Thanks for the pointer. I was actually trying to address two problems at the same time. Thanks.
 
Marilyn de Queiroz
Sheriff
Posts: 9099
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, there is a better way, as Sam saw when he received the instructor's solution.
 
Sam Tilley
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(feeling meek) yes there was a better way which was obvious after seeing the solution, and probably would have been clearer if i hadn't damaged all those brain cells banging my head against the wall trying to find it.
I can't give too much away so i had better escape.. out of here
Cheers
[ July 17, 2002: Message edited by: Sam Tilley ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!