Escaping in onmouseover attribut

Hi guys,

I'm using the attribute onmouseover of a commandLink. The JS - function looks like this:

do_something('#{MyBean.dao.info1}')

The values from the Bean aren't escaped and it would be quite a big effort to change this. Is there any possiblity to do it in an other way?

[329 byte] By [CH.Sanixa] at [2007-11-27 1:25:35]
# 1
do_something('<h:outputText value="#{MyBean.dao.info1}" />')
BalusCa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I can't use another jsf component in a jsf component.<h:commandLink onmouseover="do_something('#{MyBean.dao.info1}')" />I'm iterating over an ArrayList, this is why I have to put the values as parameters.
CH.Sanixa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Well, you didn't mention you was using it straight in a JSF component, I expected that this was a snippet of a <script> code.

OK, the approach as you posted here above should just work. Maybe the value is out of the scope somehow.

Don't you see any errors in the log? What does h:outputText value="#{MyBean.dao.info1}" at the same line say?

BalusCa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Well yes it works, but I want to have my values escaped.because if I get a string like " ' / \ ' from the getter - Method, the javascript Code won't work in the end. So there's no error, but a javascript error for certain values.
CH.Sanixa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Then escape (URLEncode) it in the getter.
BalusCa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Seems to be the only solution. The problem is, I get the objects directly from an package using EJB.Now I have to create new objects and iterate two times. Once for adding an espace operator and once for showing the new object.
CH.Sanixa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Then wrap it by another class/getter where you have control over :) Suggestion: extend the DTO class, add a new getter and then use the extended DTO class in the list.
BalusCa at 2007-7-12 0:18:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...