aspose file tools*
The moose likes JSP and the fly likes Refresh the same page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Refresh the same page" Watch "Refresh the same page" New topic
Author

Refresh the same page

Trupti Mehta
Ranch Hand

Joined: Oct 08, 2000
Posts: 79


Hello,

I have a JSP page where user selects date and a button "View". On click of View button I have to retrieve data of the specified date and show. I want to display the contents in same page.
How can I do somehting that on click to the btn, might be a function runs and displays the result in table or a message ?

Can this be possible or I should call other page only on click of a button.

Please help me accordingly


Regards,
Trupti (SCJP)
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 365
On click of button call servlet in that you can get date & set it in to prepare scope(request or session) after that forward to same jsp.
while displaying date get that variable we set in servlet from session or request and display it.


Thanks,
Shailesh
Trupti Mehta
Ranch Hand

Joined: Oct 08, 2000
Posts: 79

Shailesh Narkhede wrote:On click of button call servlet in that you can get date & set it in to prepare scope(request or session) after that forward to same jsp.
while displaying date get that variable we set in servlet from session or request and display it.


Thanks Shailesh. But am wondering 1 point :
The flow is such, I check login type, if loginType = A, then print his name; else retrieve all names and ask user to select a name. Then user selects a date (for all login types). Then clicks on View button.
Now, I go to the Servlet, retrieve data, save it in session which I have to show and redirect to this page.

Can I have 2 forms like on start when I retrieve the data from servlet, if it is null, then form1 i.e. inputting data from user will be shown, else form2 which actually shows the retrieved data from session. As I have the data I don't need the inputting fields or don't want to set them as they are dynamic. Can this be possible ???

Also I have to give the privilege to select another date. I think it will be better to use other page only, instead of making 1 page so much complicated. What do you say ?
I hope I have made myself clear. Please help me know.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You can use JSTL core taglib to control the page flow.
Trupti Mehta
Ranch Hand

Joined: Oct 08, 2000
Posts: 79


Thanks to all of you for helping and guiding me. I highly appreciate your time and guidance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refresh the same page
 
Similar Threads
Show Document in Applet
contolling default view of dateField and buttons
question on a4j:commandButton
storing dynamic row value to database
linking between applet pages