• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP to Bean to Servlet

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I don't know if I am having a brain freeze this morning or what.
I have a JSP Page with a Form. I have a Form Bean for the data. Then I have a Servlet which uses information from the Bean to put it in a database.
So my question is, when I hit submit, do I need ANOTHER "worker servlet" to put the info into a bean, then forward that on to the DB Servlet? Or should I screw the bean and just call the DB Servlet from the JSP page and use requeset.getParameter() to get all my form data?
 
Eelco den Heijer
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Current J2EE Fashion dictates that you use some implementation of the MVC pattern One of the consequences of this is that you'll have only one controller servlet, and delegate the actual work to helper classes. In your case, you'd have a database helper that stores the bean state in the database. There are many ways to do MVC these days; Struts is popular example. But before you dive into Struts, I would 'just' re-shuffle your servlets into 1 servlet and 2 helper (if I were you).
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic