• 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

multi word values in HTML form text box

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem
I am using the following JSP code to insert text from a String in a simple Java bean (using appropriate accessor method) into a text box in a form on a web page:
<input type="text" name="newAnswerText" size="75" value=<%=BeanName.getTextAnswer(qIndex,i)%> >
If the returned string value is "Have a nice day" for example, then only the first word "Have" appears in the text box. As a check, I copied the value to the server window using a "System.println(..)" command and the full string is stored in the bean. It seems that at the last moment of transfer from the bean to the web page text box, it loses all the other words.
I'm using Tomcat3.2.2.
Any solutions?
regards
Gary R.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup - don't blame tomcat, look at the HTML source you just generated:

Does that look like legitimate HTML to you? You quoted every attribute EXCEPT the one attribute you needed to quote the most!
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,
I got same problem solved this way
write value in double(")quotes.

<input type="text" name="newAnswerText" size="75"
value="<%=BeanName.getTextAnswer(qIndex,i)%>" >
 
reply
    Bookmark Topic Watch Topic
  • New Topic