jQuery in Action, 3rd edition
The moose likes JSP and the fly likes JSP database issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP database issue" Watch "JSP database issue" New topic

JSP database issue

Jai D Parmar

Joined: Jan 23, 2006
Posts: 3
Hello all,
I am trying to do a simple thing i think, but cant think of a way of doing it.

I have a popup that is a JSP page.
This jsp page contains input fields, these input fields are used to query a back end database.

I have created a bean that makes the databse query by setting the arguments.

The problem is that these results must be shown on the same page.
any ideas on how to go about doing this?

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Originally posted by Jai D Parmar:
The problem is that these results must be shown on the same page.
Well, no, that's a complicated thing. The simple thing would be that the popup window contains a page (HTML or JSP) with the input fields and a Submit button, and clicking the button causes a second page to appear complete with database information. Why can't you do that?

If the requirement is only that the second page must also appear in the popup window, that's the default behaviour anyway.
Sujith Kanaparthi
Ranch Hand

Joined: Sep 04, 2005
Posts: 45
One way is : when you submit the values, pass those to another jsp which uses the bean to query the the database to fetch the results.Store this result in a session and redirect it to the first jsp.

Another way :
A sample Test.jsp can be as coded below

<form name="frm" method="post" action="Test.jsp" >
<input type="text" name="qry" value="">
<input type="submit" name="Query">
<input type="hidden" name="initial" value="1">
//Code to query the DB and fetch the result
// display the result here

I agree. Here's the link: http://aspose.com/file-tools
subject: JSP database issue
jQuery in Action, 3rd edition