aspose file tools
The moose likes Servlets and the fly likes How to create better controller Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to create better controller" Watch "How to create better controller" New topic
Author

How to create better controller

Timo Tamme
Greenhorn

Joined: Nov 10, 2011
Posts: 8
Hello!

I am new on J2EE and previously I have some experience with ASP.NET, so my question is about J2EE MVC. I know that servlet stands for controller and in view role is JSP page. So when I create view that contains many methods, so user can access to: delete item, update item, submit page, cancel etc. How is the best way to implement controller in J2EE? So far I have read from one basic J2EE book that servlet supports 'doGet' and 'doPost' methods (also it support some others, but its not relevant in my case). So far I have seen that servlet as controller is not for my needs, I want controller to be something where these view functions are in separate methods in controller. For example clicking delete in view calls from 'ItemController.class' method 'deleteItem'. How can I do that, or is it even possible? Which are the best practices?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Sounds like rather than pure Servlets you want a framework that automatically maps URLs to methods. I'd suggest looking into Spring MVC or Play.

The former will still require you have a good grasp on Servlet and JSP concepts, the latter is not based upon JEE.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create better controller
 
Similar Threads
More on MVC
Adding an action listener to an entire class
JAR the web-application or use WSDL/SOA ?!?!
MVC gui basic questions
Session question