• Post Reply Bookmark Topic Watch Topic
  • New Topic

Put the result in the same page  RSS feed

 
Luis Fernandes
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i have a jsp page very simple, that have a form with a text field and a submit button, above are the code :





As you can see i have a action named "dasaldo" that is the name of my servlet, above are the servlet code :



Everything works fone, and when a put the name of client and press submit,
the app print in System.out.println the resultset fine.

the problem is that i want to put the resultSet in the page and not in System.out.println
what can i do to put the result of query in the same JSP that have the text field and the submit button ?

best regards
 
Wayan Saryada
Ranch Hand
Posts: 105
IntelliJ IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

The option is that you can create a pojo that contains each row of data from the result set object. This pojo in turn need to be placed in some collection, for instance in an array list. Next put this collection in the request object attribute and redirect the response to the same jsp page.

In the jsp page you can check if the attribute is exists, get the list from there. Using a standard tag lib and an EL you can iterate it and display it on your jsp page.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!