Java

595 palavras 3 páginas
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 CRUD operations 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-understand functionalities.
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 your project 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, you can 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 its public methods will
* be ready to deal with web requests.
*/
@Resource public class ClientsController { private ClientDao dao;
/*
* You can get your class dependencies through constructor, and VRaptor 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 your controller 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() {
// code

Relacionados

  • java
    294 palavras | 2 páginas
  • java
    868 palavras | 4 páginas
  • java
    6870 palavras | 28 páginas
  • Java
    1657 palavras | 7 páginas
  • java
    1176 palavras | 5 páginas
  • Java
    6757 palavras | 28 páginas
  • Java
    1044 palavras | 5 páginas
  • Java
    1411 palavras | 6 páginas
  • JAVA
    1268 palavras | 6 páginas
  • java
    2412 palavras | 10 páginas