This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MVC Architecture for Web

 
Uday Kiran
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Uday Kiran
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info guys...I am checking it out rite now...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic