• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to fetch data from database to a grid format like this in JSP

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
im a beginner.  im making a web application for a uni project. i need help in making a grid page in jsp and fetch data to that page from the data base like shown in the picture.
please teach me how to do this
Thank you  
Screenshot-(57).png
[Thumbnail for Screenshot-(57).png]
this is the grid view im telling
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, read this article to make sure you understand what JSP is.
Then read this article to understand how to properly structure Java web applications.

You will not fetch the data from the DB in the JSP. You will, in fact, put very little in the JSP. Just enough to generate the HTML view from the data fetched by the model.

The layout is pure CSS and has nothing to do with the JSP-ness of the page.
 
Rancher
Posts: 4801
50
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And taking that last point by Bear, before doing the JSP produce the layout as a dummy HTML page, complete with all the data you want to show (images included), and CSS etc.
That's what you will use to build your JSP page.
You can then tinker with that HTML and tweak it til you're happy with the layout without having to deal with the JSP elements.

After that it should be a fairly simple task to replace the table rows with JSP tags.
 
isuru Liyanage
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ik about basic of jsp and servlets but thanks for the useful articles you shared. I did display data on a table , but instead of table I want to put them under div tag but it mess up the format not in order
 
Bear Bibeault
Sheriff
Posts: 67746
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
☝️☝️☝️☝️☝️☝️

Follow Dave's advice above !
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

isuru Liyanage wrote:Ik about basic of jsp and servlets but thanks for the useful articles you shared. I did display data on a table , but instead of table I want to put them under div tag but it mess up the format not in order



And that's the sort of issue that's best handled with straight HTML, before you sort out populating the page with data from a DB.

Get the page open in your browser, open up the tools (F12) and tinker with the tags directly (I assume that works with all the browser tools, but it definitely does with Chrome).
Move things around, add/remove CSS bits/formatting.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic