Retrieving variables/String from JSF Page into Javascript code

princedudley used Ask the Experts™
How do I read hidden variables/ hidden fields/ string from JSF page into  javascript ?
Can I know an example or explaination for doing this?
I need this as I am using a javascript tree in JSF page and need to dynamically populate the tree based on certain criteria. I am open to any suggestions that you may have.
*** email removed by page editor ***
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Systems architect
Top Expert 2006
Please do not post your email in questions. You get buried with spam and it is agains EE memeber rules.
As I see you got part of the answer in your question. The same is true not only for session vars but for anything located on server side: you have to pass it to browser side as page text or as cookie. Even AJAX gets only page text as response (page headers are also page text). So to get your navigator parts from JSF to JavaScript you have to print that parts to page source text so JavaScript can use it when page is rendered on browser. Browser cannot access anything on web server side when it is not sent to browser.

Michel PlungjanIT Expert
Top Expert 2009
Sound like you might want to look at JSON

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup Zone:
 Split: Zvonko {19185657} & mplungjan {19185914}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Experts Exchange Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial