aspose file tools*
The moose likes Struts and the fly likes less than changes to < automatically? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "less than changes to &lt; automatically?" Watch "less than changes to &lt; automatically?" New topic
Author

less than changes to &lt; automatically?

Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
I apologize, this may not be the place for this question, but I am in the process of doing a struts tutorial and thought it might fit here. Basically, I am formatting a string to be used in a bean that my jsp page will <bean:write../> with. In my action page, i have the code below. The page loads and runs fine, I thought the <br> would cause a new line in the html.



However I get the following in the html:

Hello Mr. YOUR LAST NAME at:
1234 Near Ave<br>New Town, US<br>12345

Looking at the html source I get:
Hello Mr. YOUR LAST NAME at: <br>
1234 Near Ave&_lt;br&_gt;New Town, US&_lt;br&_gt;12345

I know that browsers won't interpret the white space and I tried using \n and \r\n to see if I would get lucky, but I can't seem to find out the trick. I also tried xml's <![CDATA[<br>]]> to see how the browser would handle it.

Is there something going on internally that is changing the < to &_lt; and > to &_gt;?

I am using NetBeansIDE 5.5.1 with jdk 1.5.0_11.

EDIT: The underscores in the &_gt; are not really there, just there to show that I am not getting < in the code.

Thank you for the help,
Joe

[ June 22, 2007: Message edited by: Joe Shy ]
[ June 22, 2007: Message edited by: Joe Shy ]

SCJP, SCJD(In Progress)<br /> <br />"They whom make no mistakes usually make nothing at all."
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This problem can be solved by specifying filter="false" in your <bean:write> tag.


Merrill
Consultant, Sima Solutions
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Wow, thank you so much. I looked all over thinking it was something that simple. However, I didn't really think it was on the bean side. Works great.

Thanks again,
Cheers
Joe
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: less than changes to &lt; automatically?