This is a great question that hasn't really been addressed. The framework
we have decided on is #2, where we actually encode the HTML (if appropriate)
in the beans themselves. This is because we tend to use the Model 2
approach (or whatever we want to call it in JSP 1.0), and the beans we
instantiate in our JSP pages are, well, JSP Beans -- that is, they are
"view-only" in our MVC framework that adapts to the appropriate underlying
model beans.
But this certainly isn't appropriate in all cases, and it would be nice
if the DISPLAY (or jsp:getProperty) tag would expose a boolean attribute
to optionally HTML (or URL) encode the output. I really like your idea
of the custom tag for JSP 1.1.
On Tue, 4 May 1999 11:05:31 +0200, Samuel ROBERT <[EMAIL PROTECTED]> wrote:
>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".
--
Eric Lunt
mailto:[EMAIL PROTECTED] Ph: 312-642-9050 Fax: 312-642-9051
Burning Door, LLC (http://www.burningdoor.com)
"Helping our clients build effective web applications"
===========================================================================
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".