Java

Disponível somente no TrabalhosFeitos
  • Páginas : 3 (595 palavras )
  • Download(s) : 0
  • Publicado : 23 de abril de 2011
Ler documento completo
Amostra do texto
VRaptor3 - One minute guide
VRaptor 3 focuses in simplicity and, therefore, all of its functionalities have as main goal solve the developer’s
problem in the less intrusive way.
Either CRUDoperations or more complex functionalities such as download, upload, results in different formats
(xml, json, xhtml etc), everything is done through VRaptor3’s simple and easy-to-understandfunctionalities.
You don’t have to deal directly with HttpServletRequest, Responses or any javax.servlet API, although you still
have the control of all Web operations.
1.1- Starting up
You can start yourproject based on vraptor-blank-project, available on http://vraptor.caelum.com.br/
download.jsp . It contains all required jar dependencies, and the minimal web.xml configuration for working
with VRaptor.If you want to use Maven, you can add VRaptor’s Maven artifact on your pom.xml:

br.com.caelum
vraptor
3.2.0

1.2- A simple controller
Having VRaptor properly configured on your web.xml, youcan create your controllers for dealing with web
requests and start building your system.
A simple controller would be:
/*
* You should annotate your controller with @Resource, so all of itspublic methods will
* be ready to deal with web requests.
*/
@Resource
public class ClientsController {
private ClientDao dao;
/*
* You can get your class dependencies through constructor, andVRaptor will be in charge
* of creating or locating these dependencies and manage them to create your controller.
* If you want that VRaptor3 manages creation of ClientDao, you should annotate it with
*@Component
*/
public ClientsController(ClientDao dao) {
1
Caelum – VRaptor 3 – Java web MVC framework for fast and maintenable development
this.dao = dao;
}
/*
* All public methods from yourcontroller will be reachable through web.
* For example, form method can be accessed by URI /clients/form,
* and will render the view /WEB-INF/jsp/clients/form.jsp
*/
public void form() {
//...
tracking img