File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Redisplay same page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Redisplay same page" Watch "Redisplay same page" New topic

Redisplay same page

naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
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

Joined: Jan 27, 2003
Posts: 130
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.

Just like you, struggeling to get the right solutions!<br /> <br />Sun Certified Java Programmer 1.5<br /> <br />Target - SCWCD
naveen gupta
Ranch Hand

Joined: Apr 12, 2006
Posts: 129
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

Joined: Apr 12, 2006
Posts: 129
i solved it

i used JSTL -- > c:if test

put a condition using the core tag library
I agree. Here's the link:
subject: Redisplay same page
It's not a secret anymore!