• Post Reply Bookmark Topic Watch Topic
  • New Topic

Confused JSFNewbie: Sign In commandlink

 
Apa Dea
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
Guy deLyonesse
Ranch Hand
Posts: 200
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!