Win a copy of Microservices Testing (Live Project) this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JSP to Bean to Servlet

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic