• 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

MVC without use of Struts

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am trying to develop a sample project which is based on MVC. I want to implement MVC without use of Struts.

Could you please help me regarding designing of application. I want to know how should i implement it

1) should i create a Controller Servlet and after submit on every jsp i should redirect to that Controller Servlet and based on request coming from JSP i should redirect to corresponding Servlet.

or 2) every servlet should work as controller and directly from JSP i should redirect to corresponding servlet.

or 3) any other approach i should follow.....

Thanks and regards
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can have One Servlet acting as Controller.
All your requests can point to this one servlet.
Based on something in the request, like a param value, url etc, you can invoke your business logic in a java class, and once done forward to a JSP page.

You can have a configuration file which stores information about what java class to invoke for a particular url/param-value, and which jsp to forward to. (which would be similar to struts-config file)
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Ward wrote:You can have One Servlet acting as Controller.
All your requests can point to this one servlet.
Based on something in the request, like a param value, url etc, you can invoke your business logic in a java class, and once done forward to a JSP page.

You can have a configuration file which stores information about what java class to invoke for a particular url/param-value, and which jsp to forward to. (which would be similar to struts-config file)



Yes, James told you make one servlet which is work as Controller. Or you can divide your Servlet controller according to your module wise. Make different servlet according to application module.
 
Vijay jai Singh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nishan Patel wrote:

Yes, James told you make one servlet which is work as Controller. Or you can divide your Servlet controller according to your module wise. Make different servlet according to application module.



Nishan as you are saying i can divide Servlet controller according to module wise. But generally it is preferred to have one controller in application. Correct me if i am wrong.

Thanks
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right, but what if your application is big and contains many module then it is hard to handle complexity with module. your module conflict with same controller servlet.
 
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
Perhaps this article which outlines the various patterns involved, will be helpful.
 
reply
    Bookmark Topic Watch Topic
  • New Topic