--- title: One minute guide --- # A simple controller We will call a `Controller` classes that contain de business model of your application. Those are classes commonly called actions or even services by other frameworks, although they don't mean exactly the same. With VRaptor's jar in your project, create our controllers in order to receive requests and start building your project. A simple controller looks like this: ~~~ #!java /** * Use the @Controller annotation and your public methods will be available for web requests.*/ @Controller public class ClientsController { /** * You can inject your class' dependencies using the @Inject annotation. * Then CDI and VRaptor will create or locate such instances for you. As * an alternative, annotate the contructor with @Inject, but you would * also need to have a default constructor for that approach to work. */ @Inject private ClientDao dao; /* * All public methods at your controller are accessible from the web. * For instance, the form method can be accessed through the URI * /clients/form and will redirect to the jsp /WEB-INF/jsp/clients/form.jsp */ public void form() { // code that loads data for checkboxes, selects, etc } /* * Method parameters will be populated accordingly to the request fields * received, as long as they follow a simple convention: * * custom.name=Paulo Silveira * custom.address=Vergueiro St * * That will cause Client fields name and address to be filled, respectively, * with Paulo Silveira and Vergueiro St, via getters e setters. * * URI: /clients/add * view: /WEB-INF/jsp/clients/add.jsp */ public void add(Client custom) { dao.save(custom); } /* * Your method return is automatically exported to the view and can be * accessed at the JSP using the expression language ${clientList}. * * URI: /clients/list * view: /WEB-INF/jsp/clients/list.jsp */ public List list() { return dao.listAll(): } /* * In case you return a simple type, the exported variable's name will start * lower case. In this example, at the return type is Client, the EL accessible * variable will be ${client}. * * VRaptor is in charge of needed conversions so that form fields are filled * with their expected types. * * URI: /clients/view * view: /WEB-INF/jsp/clients/view.jsp */ public Client view(Long id) { return dao.load(id); } } ~~~ Please note how API independent this class is. Code is also extremely simple and testable, even with unit tests. VRaptor makes a lot of associations by default, such as: ~~~ /client/form invokes form() /client/add invokes add(client) populating the client object client with request parameters /clients/list invokes list() and return ${clientList} to the JSP /clients/view?id=3 invokes view(3l) e devolve ${client} to the JSP ~~~ Later, you will learn how simple it is to change the URI from `/clients/view?id=3` to `/clients/view/3`, making it more friendly and elegant. VRaptor will also be able to inject the `ClientDao` on the controller. You are good to go! Learn more about at the [10 minute guide](/en/docs/ten-minute-guide). ##Questions While studying VRaptor, should you have any doubts please refer to GUJ for Portuguese answers, or visit our discussion list at discussion list.