Hi all,

I didnt see anynthing in 0.92 and 1.0 spec about encoding strings :

If you get something in the page with (0.92):

<DISPLAY PROPERTY=myBean:myProperty>

The property will be displayed as is.
So if the property has special characters (like <, ", &, etc),
you may have some trouble in the resulting HTML page.

So we need something to encode the string, in different manners,
HTML, URL, XML...

The work arounds I see is :

1- use java code <%= encodeHTML (myBean.getMyProperty ()) %>
2- encode strings in beans (ouch!)
3- modify beans so that they only return a sub class of String with
methods
getURLEncode, getHTMLEncode and write :
<DISPLAY PROPERTY=myBean:myProperty:URLEncode>

But none of these solution satisfies me.

Which of these solutions do you use, or do you have another one ?

1.0 seems not to talk about this, but, as you can write your own tag,
I think this should be possible :

<jspext:getProperty name="myBean" property="myProperty" encode="html" />

Anyway, why isn't this a built-in in JSP engine ?

Thanks,

--
Samuel ROBERT               [EMAIL PROTECTED]

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to