Skip to content

Instantly share code, notes, and snippets.

@kdmukai
Created June 9, 2012 20:08
Show Gist options
  • Save kdmukai/2902391 to your computer and use it in GitHub Desktop.
Save kdmukai/2902391 to your computer and use it in GitHub Desktop.
Adding a page with Java, Tiles, and JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<div class="rounded">
<div class="page_title">Administrator Pilots</div>
This is the Administrator Pilot page.
</div>
package com.essaytagger.web.user.administrator;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.servlet.context.ServletUtil;
import com.essaytagger.web.user._BaseHttpServlet;
public class IndexServlet extends _BaseHttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(final HttpServletRequest request,
final HttpServletResponse response) throws ServletException,
IOException {
TilesContainer container = ServletUtil.getContainer(request.getSession().getServletContext());
container.render("visitor.administrator_pilot.index", request, response);
}
}
<definition name="visitor.administrator_pilot.index" extends="visitor.template">
<put-attribute name="title" value="Administrator Pilot" cascade="true" />
<put-attribute name="body" value="/WEB-INF/tiles/visitor/administrator_pilot/index.jsp" cascade="true" />
</definition>
<servlet>
<servlet-name>AdministratorIndexServlet</servlet-name>
<servlet-class>com.essaytagger.web.user.administrator.IndexServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AdministratorIndexServlet</servlet-name>
<url-pattern>/administrator_pilot</url-pattern>
</servlet-mapping>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment