Use from value from backing bean in javascript

Posted by AlfonsSocken on Stack Overflow See other posts from Stack Overflow or by AlfonsSocken
Published on 2011-12-01T09:46:07Z Indexed on 2011/12/01 9:51 UTC
Read the original article Hit count: 180

Filed under:
|
|

What I want is to use a boolean value from applicationContext.xml (Jboss configuration file) in my javascript.

Currently I use Spring to inject a value configured in applicationContext.xml into my backingbean. Then I put an output text in my jsp like this

<h:outputText id="idValue" styleClass="foo" value="" rendered="#{bean.isRendered}"/>

In my JavaScript I try following

  jQuery(function(){
     bRedirect = jQuery("#foo").value != undefined;
     ...

All this looks so terrible to me, even though it works fine. There must be a smarter way than doing what I do.

Note that I am running JSF1.2 and therefore must use jQuery instead of $ and also select by unique class (foo) and not by id, which may be bad practice as well.

Thank you in advance. alfons

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about spring