• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get managed bean properties in included js file.

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
we are using JSF1.1, JSTL, webui, SUN-RI

I have a jsp page which is using JSTL , In which we include external JS files like bellow
<webuijsf:script url="resources/reports.js" />

I want to access managed bean propeties in this external js file.
Suppose i have a managed bean named Reports in this i have a properties like noOfReports. I want to access this in my reports.js file.

Although we are able to access the same properties in js code(under <script> </script> tag) of same jsp page like bellow.
var numberOfCoverage1= '${Reports.noOfReports}'

But we have a requirement to access the managed bean properties in included js file.

Thanks in advance.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Managed beans live on the server. JavaScript runs on the client. For JavaScript to access managed beans you'll have to use AJAX to request sending/receiving data from the managed beans.

It's your call as to what kind of AJAX you want to use: brute force, jQuery, Dojo, or ???.

As a side note, it's also time to consider upgrading from JSF 1.1 to something newer. Especially since JSF2 has built-in AJAX support.

And lose the JSTL.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic