This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

RequestDispatcher+ menu from database+ SiteMesh problem

Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm working with SiteMesh layout system.
I made a decorator which includes other files (check code below). I want to retrive menu items from database, and print them into the decorator file. I have servlet from which I retrive data from db and which should forward this data to the menu.jsp file, but it doesn't do that. When I will type address to my index.jsp file, there are no menu items in my menu bar. This works only when I will enter on my servlet directly (/webapp-dir/MenuServlet), and here everything displays great - I have a <h1> and the menu items under it (just like in the menu.jsp file below), but the address in the address bar is not webapp/template/menu.jsp, the address is /webapp/MenuServlet. I don't how to describe it exactly, but the final effect is that, that I don't get the menu items in my pages which use the decorator. I don't want to include the servlet, I want to include menu.jsp.

btw. I have second question. I want to build my website based on the MVC. Is this correct? Model = hibernate mapping classes, Controller (place where i connect to the database and forward the data to the jsp) = servlet, view = jsp page. Or should it be Model = Java class which connects to the db and saves the data to (for example) the List, Controller = servlet where I get the List variable from Model class and forward it to the JSP page, view = jsp page ?


Servlet in which I retrive menu items and their's addresses from database (I use Hibernate):

and the menu.jsp:
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!