aspose file tools*
The moose likes Servlets and the fly likes MVC Architecture for Web Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "MVC Architecture for Web" Watch "MVC Architecture for Web" New topic
Author

MVC Architecture for Web

Uday Kiran
Greenhorn

Joined: Jan 22, 2002
Posts: 12
I am planning on using MVC architecture following the Java BluePrints spec. We would be using JSP/Servlets (NO EJB's). I was wondering if anyone had used this architecture before for non-ejb sites. Any simple prototypes would be of great help
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Check out STRUTs. There should be some useful info in the Jakarta projects forum, and of course at http://jakarta.apache.org
Dave
mustang india
Ranch Hand

Joined: Feb 05, 2002
Posts: 60
what exactly are you looking for ? I have used MVC arch using JSP and Servlet. The only change we made is, instead of having a single servlet which the Model II arch specifies ,we had one servlet for each module we developed.
Uday Kiran
Greenhorn

Joined: Jan 22, 2002
Posts: 12
I looked at Struts framework where I beleive the front controller is pretty much given to you. But we dont have much time on this project to understand it's framework.
I am planning on having just 1 central front controller. Here is a scenario for which I need help:
User requests: "http://someurl.com/login.jsp"
I am planning on channeling this request to go to my frontcontroller.java which extracts the requested page from URL and checks in a pre-loaded hashmap and sends the user to login.jsp.
Question: What should the user call: frontcontroller.java or some form handler servlet. I was interested in sending the request to front controller...if yes, how do we route it. We can probably have this in the action attribiute:
action = "/servlet/handleLogin" method="post"

but with a mapping in deployment descriptor like the following:
<servlet-mapping>
<servlet-name>frontcontroller</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
would probably send it to frontcontroller.java...
I dont know if this is how we do in a MVC model2 app.
But bottomline I dont want more than 1 main controller. (which can cleanup my security and logging logic)
Thanks in advance...
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
Originally posted by Uday Kiran:
I looked at Struts framework where I beleive the front controller is pretty much given to you. But we dont have much time on this project to understand it's framework.

The struts framework is not that difficult. If you knew the struts framework, you would realise that you do not have to reinvent the wheel now.

Question: What should the user call: frontcontroller.java or some form handler servlet. I was interested in sending the request to front controller...if yes, how do we route it. We can probably have this in the action attribiute:
action = "/servlet/handleLogin" method="post"

With struts, which is what I use, the form action="/evote/questionSet.do" where evote is application on the server and questionSet is the servlet, but this goes through the struts Action servlet first because

maps all .do's to it.
The struts action servlet then sorts out all sorts of useful things first, like validation, form beans, locales etc. That's a shameless plug. The more people round here who use struts, the better. Their email list is quite good but often you just get no replies.
hth

Adam


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
I agree. There is NO WAY that you will save time by re-inventing the things in Struts vs. spending the time to learn Struts. There are dozens of introductory articles referenced on the apache website that will give you more than enough help to write a project using Struts.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Uday Kiran
Greenhorn

Joined: Jan 22, 2002
Posts: 12
Thanks for the info guys...I am checking it out rite now...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MVC Architecture for Web