• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

how to display results in html dable

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear all

i'have jsp call view order.jsp when users click the view orders button in that jsp i want show all the details in the db in another jsp html table or i want display all the results in html table ... how can i do it

please help me .... its urgent
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Collect the requird data in rsultset & simply display that in jsp page using scriptlet

<table>

<%
while(rs.next())
{
%>
<tr>
<td><%=rs.getXXXX(1)%></td>
<td>............
</tr>
</table>

 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sheetanshu krishna wrote:Collect the requird data in rsultset & simply display that in jsp page using scriptlet


Bad advice. Very bad.

As a new-comer to JSP it's important to learn good practices and habits right away. The use of Java code and scriptlets in JSP pages has been discredited for over 8 years now. Do not put Java code or scriptlets in JSP pages. Rather, use modern techniques such as the JSTL and EL.
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a JSP newcomer, I suggest you read this article and this article.

Then you'll know that the data should be collected in the page controller for the JSP, and passed to the JSP as a scoped variable. There you will use JSTL and EL to construct the HTML table from the data.
 
amila lakmal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:As a JSP newcomer, I suggest you read this article and this article.

Then you'll know that the data should be collected in the page controller for the JSP, and passed to the JSP as a scoped variable. There you will use JSTL and EL to construct the HTML table from the data.




thank a you a lot Bear Bibeault for your helping hand for us
 
amila lakmal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please im beg your pardon ....., im still in confuse please help me...
 
Marshal
Posts: 27211
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right, the advice in this thread was mostly of the form "Come on, it isn't 2003 any more". So to be more specific:

  • You should have a servlet which reads through the ResultSet and converts each of the rows to some custom Java Bean which you have designed for this purpose. It should put those beans into some kind of a List, an ArrayList would do just fine.
  • The servlet should put that list into the request context and then forward to the JSP.
  • The JSP should contain some JSTL code which processes the list and, for each element in the list, produces a <tr> element containing the data from the custom bean.


  • So that's broken down your problem into several smaller problems. Work on them one at a time.
     
    Bear Bibeault
    Sheriff
    Posts: 67637
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Another hint: the <c:forEach> JSTL tag is what you would use to iterate over the List of beans.
     
    Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
    free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
    reply
      Bookmark Topic Watch Topic
    • New Topic