Java Reference
In-Depth Information
Figure 2.2: A greeting from Stripes
2.2
Hello, Stripes!
As a “Hello, World!” example, we'll use the page shown in Figure 2.2 .
When you start the application, the page displays the current date and
time. The two links at the bottom update the display: the first link
refreshes the current date and time, and the second link displays a
random date and time instead.
Although this example does not do much, it will help you get started
with Stripes. By displaying the current date and time, you'll learn how
to obtain data from an action bean and display it in a JSP. Having two
links shows you how to trigger different event handlers on the action
bean. You'll gain a clear understanding of how the view (JSP) and the
controller (action bean) work together. Of course, let's not forget the
benefit of getting a Stripes application up and running in the first place!
You've already set up a web application skeleton. All you need to get
this example working is one action bean ( HelloActionBean ) and one JSP
( hello.jsp ). The file structure of the complete example will look like this:
WEB-INF/lib/stripes.jar
WEB-INF/lib/commons-logging.jar
WEB-INF/lib/jstl.jar
WEB-INF/lib/standard.jar
WEB-INF/web.xml
WEB-INF/classes/StripesResources.properties
WEB-INF/classes/stripesbook/action/HelloActionBean.class
WEB-INF/jsp/hello.jsp
index.jsp
Let's write the HelloActionBean class.
 
 
 
 
Search WWH ::




Custom Search