• 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

Reverse2Servlet

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, so I'm trying to get back on the trail and for the life of me I cannot figure out how to set the value using a servlet variable within the out.println statement. I tried escaping the ", that didn't work. I've tried ". No luck there either. It wouldn't be so bad if I didn't finish this one up before my hard drive crashed a while back.
Can anyone provide any other hints.
Thanks and good to be back.
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not 100% sure I understand your question, but here's a shot:
You are trying to set an HTML input parameter (value) from within the out.println() string. Suppose the string you want to set value to is contained in the String str. Your code would look like: out.println("< input .... value=\"" + str + "\"...>");
Here the value contained in str is concatinated to value=", then "...> is concatinated to that. This completes a correctly formed output string containing str. Hope that answers it.
[ September 16, 2002: Message edited by: Marilyn de Queiroz ]
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like my html got interpreted instead of printed. The argument of the out.println should be ("...value=\"" + str + "\"..."). Hope this prints better.
 
village idiot
Posts: 1208
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I simply used double quotes encased within single quotes, which in turn were encased within double quotes. I used the escape codes for replacing apostrophes and quotation marks if they appeared in the text itself.
out.print( "< input tag goes here value='" + variable + "'rest of tag goes here>" ) ;
Have fun getting back in the saddle!
[ September 16, 2002: Message edited by: Marilyn de Queiroz ]
 
Ronald Schindler
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved. I can't believe how long I spent on this. I would have fired me by now. the answer is to use + var +. For some reason this just escaped me. Thanks for the replies.
 
See where your hand is? Not there. It's next to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic