wood burning stoves 2.0*
The moose likes Servlets and the fly likes multi word values in HTML form text box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "multi word values in HTML form text box" Watch "multi word values in HTML form text box" New topic
Author

multi word values in HTML form text box

Gary Ross
Greenhorn

Joined: Aug 12, 2001
Posts: 1
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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

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!

Customer surveys are for companies who didn't pay proper attention to begin with.
DAYANAND BURAMSHETTY
Ranch Hand

Joined: Aug 06, 2001
Posts: 34

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)%>" >


Dil se....,<BR>Dayanand<BR>0065-8839071(off)<BR>0065-7547034(Res0
 
 
subject: multi word values in HTML form text box
 
Similar Threads
Null value in ActionForm after javascript submit()
collection getting appended on refresh of page
Problem with the ajax app
JSP and class paths in Websphere
Wanting to Displaying Empty Data on Initial Search Page