Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP database issue

 
Jai D Parmar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks
Jai
 
Paul Clapham
Sheriff
Posts: 21126
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

<%if(request.getParameter("initial")==null){%>
<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">
</form>
<%}else{%>
//Code to query the DB and fetch the result
// display the result here
<%}%>

Regards,
Sujith
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic