• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts html:text tag and c:out

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.
Here is my problem.
We have the text field (struts html:text) wich shoud show the variable from the form. Befor the form is populated this variable is formatted, based on if it is negative or positive. If it is negative it comes in as
<font color="#AF0B1C">(184,548.93)</font>. Of course in the text it is looks the same. I tried to set the page scoped variable and than use it in the html:text tag:


but it does not work. The page scoped variavle val still looks as <font color="#AF0B1C">(184,548.93)</font>. So, nested <c ut tag with the escapeXml does not work. (whit hte <bean:write ... filter="false"/> the same situation)
What can I do if I need the text field in which I have to show parsed variable.

Thanks.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The c:out "escapeXML" is equivalent to the bean:write "filter".
When printing a value it escapes any special "HTML" characters such as < & or >, making them &lt;, &gt; and &amp;

It seems you are trying to extract the value, without its markup text. The escapeXML tag will not help here.
Probably the best approach would be to have two methods on the form bean. One to get the value, one to get the formatted value (if you insist on doing the formatting in the bean)
[ April 20, 2006: Message edited by: Stefan Evans ]
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can modernize and stop using deprecated tags like <font> in favor of CSS.
 
That feels good. Thanks. Here's a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic