01: package clime.messadmin.example;
02:
03: import java.io.IOException;
04:
05: import javax.servlet.ServletException;
06: import javax.servlet.http.HttpServletRequest;
07: import javax.servlet.http.HttpServletResponse;
08:
09: /**
10: * Sample Servlet which does nothing!
11: * @author Cédrik LIME
12: */
13: public class SampleJSP extends BaseSample {
14:
15: /**
16: * @see javax.servlet.http.HttpServlet#HttpServlet()
17: */
18: public SampleJSP() {
19: super ();
20: }
21:
22: /**
23: * {@inheritDoc}
24: */
25: protected void process(HttpServletRequest req,
26: HttpServletResponse resp) throws IOException,
27: ServletException {
28: doSomeWork(req, resp);
29: if (req.getRequestURI().indexOf("forward") != -1) { //$NON-NLS-1$
30: req.getRequestDispatcher("/test.jsp").forward(req, resp); //$NON-NLS-1$
31: } else if (req.getRequestURI().indexOf("include") != -1) { //$NON-NLS-1$
32: req.getRequestDispatcher("/test.jsp").include(req, resp); //$NON-NLS-1$
33: } else {
34: throw new IllegalArgumentException(req.getRequestURI());
35: }
36: }
37: }
|