aspose file tools*
The moose likes JSP and the fly likes How to get results into same jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to get results into same jsp" Watch "How to get results into same jsp" New topic
Author

How to get results into same jsp

ramesh poorella
Ranch Hand

Joined: Jul 19, 2011
Posts: 60
hi...

am entering some values and submitting form . then after that how to get result in same page.... i mean request must go servlet and proceed some criteria and after that the processed results came to same jsp with out forward another page. if using redirect to same page the page will printing same as before but not getting results..

how it will be done? help me
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

Hi,

In order to get results in same page from server, you need to make an AJAX call to the servlet, get the results and render it using java script.


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
Also you can use JSTL tag import.
For example:
1) make you jsp form for search criteria. (page1)
2) build a jsp page for result (page2) and import the page1 inside page2 with jstl tag import.
TIP: In the form action of you page1 form call to page2.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

The Ajax approach is far superior. In fact, I don't even see how using the JSTL import approach as described can possibly work.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
Bear Bibeault wrote:The Ajax approach is far superior. In fact, I don't even see how using the JSTL import approach as described can possibly work.


I did that!!
I will try to explain my case:

I did a search.jsp, this had one field input for criteria search.
Then i did create a jsp for result. This result.jsp ask for parameters, is to say, i must to pass parameters from search.jsp o result.jsp.
Therefore:
search.jsp submit a value (parameter) . In the form action property call to result.jsp page and pass the parameter. In my result.jsp page i pass the parameter to a method than make a query. Then the result in showed in a html table in my result.jsp page.

In other words;
(in result.jsp)
1)in the first block request the value (parameter) if the parameter is null then not display data, if the parameter is diferent to null build the query and disply the data below
2) in the second block include the page <c:import url="search.jsp"/>
3) in the third block of my result.jsp page show the data in a html table.


I hope you understand my explanation, sorry for my english grammar.

And Yes, you are right about Ajax, I am using AJAX and Jquery lately and it is so nice and pretty for do similar things.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get results into same jsp