• 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
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Problem with using a <sql:query> JSTL Tag when retrieving using JOIN  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day, everyone!

I need help with a Web Application I'm working on, it's a Mini-Administrator Panel (CRUD some stuff).
Made with: JSP & Servlets (MVC), and MySQL Database

I'm having a problem with the JSTL Tag <sql:query> (by the way I only use this tag when retrieving stuff).

When I make a simple retrieval, i.e.

Database Table: User [id, name, address etc.]



And I print the results out in a table, the users are properly retrieved and displayed.

PROBLEM: But when I use the same tag with retrieving from a table with foreign key constraints, i.e. INNER JOIN, LEFT JOIN, etc., with the code:

Database Tables:
   Manager (id, name)
   Employee (that holds an id for his/her manager: managerId column)

(What I wanted was to retrieve a list of employees, along with their respective managers)



All the User details are printed out fine, except for the managerName field, with the code:



Any idea on how I would properly access the column? I would like to avoid using MVC and DAO for retrieving, and have only 1 JSP page handle the retrieving and printing.

Thanks to everyone in advance!
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!