• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
Marshal
Posts: 67256
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
Master Rancher
Posts: 4017
47
  • Likes 2
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal
Posts: 67256
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
☝️☝️☝️☝️☝️☝️

Follow Dave's advice above !
 
Dave Tolls
Master Rancher
Posts: 4017
47
  • Mark post as helpful
  • send pies
  • 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.
 
I am a man of mystery. Mostly because of this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!