• 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

Confused JSFNewbie: Sign In commandlink

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Forum...

Firstly, apologies for the dumb question, I'm just starting out with JSF (installed mojarra 2.1.1-FCS).
Would anyone kindly suggest how I go about:

1) Making a link that doesn't refresh the page (commandLink & ajax?)
2) After clicking the link, if a response string is received, then hide the link and print the string.

I'm thinking of a login link that, (e.g. if a cookie already exists) transforms into a welcome message.

I'd very much appreciate your assistance, as I'm finding it very difficult to understand how to do this with JSF so far.

Many thanks
 
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Apa Dea wrote:Hello Forum...

Firstly, apologies for the dumb question,



The only dumb question is one that isn't asked.

Apa Dea wrote:
I'm just starting out with JSF (installed mojarra 2.1.1-FCS).



Welcome!

Apa Dea wrote:
Would anyone kindly suggest how I go about:

1) Making a link that doesn't refresh the page (commandLink & ajax?)



AJAX is right. A commandLink basically works like a button and it does a form submit. I do this by using the ICEfaces extension with JSF.

Apa Dea wrote:
2) After clicking the link, if a response string is received, then hide the link and print the string.

I'm thinking of a login link that, (e.g. if a cookie already exists) transforms into a welcome message.



You can set the "rendered" attribute equal to a boolean value from your backing bean such that it's set to "false" after having been clicked. You could then have a previously hidden outputText box with your welcome message become visible.

So it might look a little like this: (I'm using ICEfaces tags)







Apa Dea wrote:
I'd very much appreciate your assistance, as I'm finding it very difficult to understand how to do this with JSF so far.

Many thanks



Cheers
 
Apa Dea
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks Guy...

Your help is much appreciated, and your example goes a long way in clearing the fog for me.

Kind regards
 
We're being followed by intergalactic spies! Quick! Take 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