Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redisplay same page

 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my JSF, at the bottom of the page i have included a JSF, which has 2 fields like "Name" and "Description"

when i submit the button, i want same page to be redisplayed. How can i do that.

<h:commandButton action="" > --- > when action returns null, then same page will be redisplayed. But i don't want the text fields. I want a message saying

" thanks for the response"

this is a simple issue, but i never worked on it
any ideas
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Naveen,

I am not clear about your question.
First time you want to show textbox, plus command button.
User will enter data in input box and then he/she will press the command button. Then you want to display a message on same page. Don't you want to display textbozes? If no text boxes then why not inclue a fresh page to your parrent page?

With current understaning of your question, I would like to say that on first clikck on command button store some value in session and depedning on that flag second time render or not the inputbox and display message.


Please explain your question.
 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You did understand my question correctly.

I want it to display on the same page, because i am working on the website where at the bottom of the page, we will be having a feedback form. On submitting this form we don't want a new page, since the response is only a simple message saying "thanks for feedback"

I got what you were saying about the session and i did try to do it that way and i am little bit lost, as i am new to JSF and not that good in JSP

OK, coming to implementation in JSF

i defined java bean ( or backing bean ) in faces-config.xml file

and if it was JSP, i will write it as

request.getParameter("xxxxx") in scriptlet
with if and else condition

since i am working on JSF, what i need to do ?
just follow the JSP syntax
 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i solved it

i used JSTL -- > c:if test

put a condition using the core tag library
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic