• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts html:text tag and c:out

 
Serghei Jelauc
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.
 
Stefan Evans
Bartender
Posts: 1807
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The cut "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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic