All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zdevra.guice.mvc.velocity.package-info Maven / Gradle / Ivy

There is a newer version: 0.4.2
Show newest version
/*****************************************************************************
 * Copyright 2011 Zdenko Vrabel
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 *****************************************************************************/

/**
 * The package implements into Lime MVC a Velocity as a 
 * template engine responsible for views rendering.   
 * 

* *

Usage

* Let's assume that we've got controller which selects view with name 'someview'. * For rendering of the HTML, we will use a Velocity template 'somehtml.velocity'. *

* *
controller:

*
 * {@literal @}Controller
 * {@literal @}View("someview")
 * public class MyController {
 *    ...
 *    {@literal @}Path("/helloworld") {@literal @}Model("msg")
 *    public String showHelloWorld() {
 *       return "Hello World";
 *    }
 * }
 * 
* *
the module and view setup will be:

*

 * public class MyModule extends MvcModule {
 *    protected void configureControllers(VelocityEngine velocity)
 *    {
 *       control("/*").withController(MyController.class);
 *       
 *       // setup views       
 *       install(new VelocityModule(getServletContext()));
 *       bindViewName("someview").toViewInstance(new VelocityViewPoint("somehtml.velocity"));
 *    }
 * }
 * 
* * There is also another way how to use Velocity view. Directly in the controller. *

* *
example:

*

 * {@literal @}Controller
 * {@literal @}VelocityView("somehtml.velocity")
 * public class MyController {
 *    ...
 * }
 * 
* */ package org.zdevra.guice.mvc.velocity;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy