File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get managed bean properties in included js file.

 
roby george
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17641
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic