-
Notifications
You must be signed in to change notification settings - Fork 0
Your first JSP Page
In the previous section we learnt how to create a controller. Now that geeMVC has found our controller and has executed our method handler, we want to send some content to the user. For this we returned the string forward: hello-world
.
Lets continue with a concrete example by creating a JSP page:
hello-world.jsp
<h1>Hello World</h1>
<p>It worked!</p>
In your Java-IDE it should look something like this:
"Hang on" you say, "how does geeMVC know which file to load when we have only specified 'forward: hello-world' and not 'forward: hello-world**.jsp**'?"
This is simply because we told geeMVC so when setting up our servlet in the web.xml, as shown in Setting up your Webapp:
<servlet>
<!-- The main entry point to geeMVC. -->
<servlet-name>geeMVC-Servlet</servlet-name>
<servlet-class>com.geemvc.DispatcherServlet</servlet-class>
<!-- Tell geeMVC in which folder JSPs or templates reside, relative to
the WEB-INF directory. -->
<init-param>
<param-name>view-prefix</param-name>
<param-value>/jsp/pages</param-value>
</init-param>
<!-- Specifies the ending of JSP or template files. -->
<init-param>
<param-name>view-suffix</param-name>
<param-value>.jsp</param-value>
</init-param>
<!-- [ ... ] -->
<servlet>
Now that we have created our first method handler and JSP page it is time to build the code and start our webserver.
Want to find out more about JSP pages? Then check this out.
- User's Guide
- Motivation
- Prerequisites
- Getting Started
- Mapping Requests to your Controller
- Binding Parameters to your Handler Method
- Binding a Bean to your Handler Method
- Validating Incoming Parameters
- Sending a Response to the Client
- Internationalization (i18n)
- Working with Forms
- Mapping a Form to a Request Handler
- Using Geemvc Taglibs
- Displaying Form Errors and Notices.
- Creating a Standard Reusable Layout for your Website
- Working with Interceptors
- The Around Interceptor
- The Lifecycle Interceptor
- Customizing geeMVC
- Overriding geeMVC Classes
- Implementing your own Reflections Object
- Providing a Custom Injector
- Providing your own Caching Implementation
- Providing your own Logging Implementation
- Adding a custom Handler Resolver
- Adding a custom Binding Converter
- Adding your own Parameter Annotation
- Adding your own Validation Annotation
- Providing a custom View Adapter
- Implementing your own Script Evaluator
- Working with Eclipse
- General