• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A Design Problem

 
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Im relatively new to the field of programming and have been assigned to develop a web application purely through the use of jsp's , I have done some reading on the MVC architecture. But now I'm struck by a rather grave doubt regarding my project, whether my coding and line of thought have been on the wrong lines.
What im designing is basically a CRUD application .As of now , I have written separate bean classes to store the entities that are involved in the operation . A java class to perform the database operations that acts as a DAO layer . Now , I need to design the presentation layer , which would consist of a form that submits data back to a method in the DAO layer , that performs the required CRUD operation based on a control value.

Do you think I'm proceeding on the right track with respect to my requirements ?
Thank you all for your inputs.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vic Hood wrote: develop a web application purely through the use of jsp's


Just JSPs? No servlets?
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying,Bear!
Hmm,
What I have thought to implement is to use just a single JSP to act as the view layer , that calls the required function from the model section(the DAO and beans ). I do hear the ring of the missing 'control' layer at this point which i guess would be done by the servlet
Question.
1. Would it be possible for me to incorporate a servlet into my existing design?
2.If yes, how do I go about it?
Pardon me , if my queries are too primitive ,but I guess they reflect the fact im totally new to the field.

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you have already read this article?

What are you submitting the form to? A DAO? How? Or are you submitting to a JSP?

JSPs should be for view generation only. Not data or forms processing.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:I believe you have already read this article?

What are you submitting the form to? A DAO? How? Or are you submitting to a JSP?

JSPs should be for view generation only. Not data or forms processing.



To answer your question first. Im submitting the form to a function the DAO and not the jsp.

And yes, I was going through the article that you pointed out .And I think i should , (in your words) follow
"Control, Control, You Must Learn Control"?
Also can i include the 'control' into my existing design or do i have redesign from scratch?
Thank you
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vic Hood wrote:To answer your question first. Im submitting the form to a function the DAO and not the jsp.


How? Is your DAO also a servlet?

My suggestion is to write your model without any knowledge of the presentation layer at all. If your model layer cannot also be used as the back-end of a Swing application, for example, it's not correct. The model should not be aware of what the front end is doing at all.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes!
After reading the article that you had pointed out . I realized that I was missing the 'C' from MVC and so I made the DAO act as a servlet.Is that the right approach?
Thanks for replying.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. Definitely not! As I already said, your model layer should have no knowledge of rhe UI layers. Making your DAO a servlet is the wrong approach. Your servlets should just be controllers.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay! Point taken. Thanks!
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So going ahead with a separate controller servlet +model(bean and dao)+ view(jsp), would be the way to go?
 
reply
    Bookmark Topic Watch Topic
  • New Topic