• 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

Setting "rendered" attribute via javascript?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to enable a user to click a link and as a result show couple of JSF components on the same page without reloading. Is this possible using javascript and altering rendered attribute and what would be the syntax?

Thanks!
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

take a look at Ajax http://www.getahead.ltd.uk/dwr/ it may help you.

regards.
 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know of DWR and it's great - this solution has crossed my mind, but is an overkill since I just need to show some hidden components that are allready on the page, and I think this must be possible via client-side scripting, but am to new to JSF to know exactly how
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Leo Budima:
I know of DWR and it's great - this solution has crossed my mind, but is an overkill since I just need to show some hidden components that are allready on the page, and I think this must be possible via client-side scripting, but am to new to JSF to know exactly how



Only one way of I know to just use Javascript to do this. You'd need to put your components in a div and set the div's visible style to hidden. Then use javascript to change that divs style attribute when you want them to show.

Other than that you'll need a trip to the server.
 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I wonder why I haven't thought of that But, generally, is it possible to reference JSF component in javascript?

Since JSF renders regular HTML with id attributes, is it possible to access component attributes with something like:


?
 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. Assuming of course that I have fixed set of components on a page and I know what will be the id of a component I need when it's rendered
 
reply
    Bookmark Topic Watch Topic
  • New Topic