Final tasks

We're now ready to deploy and run our sample login application. There's only very little left to do...

Creating the default index page

When users access the application for the first time, they usually point their browser to the context, not to a particular page or action. In our deployment descriptor, we had the following lines:

<!-- Welcome File -->
<welcome-file-list>
  <welcome-file>index.jspx</welcome-file>
</welcome-file-list>

We want to create a page that simply passes control over to our /index action, which acts as our application entry point. Here's the JSP page to be saved as /index.jspx:

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
  <!-- forward to our start action -->
  <jsp:forward page="/index.do"/>
</jsp:root>
Note
Since the welcome page is directly invoked by the servlet container, there's no current module, yet. This is the one and only place you need to use a full path with module extension (or prefix).

Copying classes and libraries

Now, we need to copy our application class tree to /WEB-INF/classes.

Finally, we have to copy the required libraries into /WEB-INF/lib. These are

  • CALYXO_HOME/lib/commons-*.jar
  • CALYXO_HOME/lib/web/log4j-*.jar
  • CALYXO_HOME/lib/web/jstl-1.1/*.jar
  • CALYXO_HOME/calyxo-base/calyxo-base-*.jar
  • CALYXO_HOME/calyxo-control/calyxo-control-*.jar

We also need a configuration file for log4j. Save the following to /WEB-INF/classes/log4j.properties:

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %-18c{1} - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=warn, stdout
log4j.logger.de.odysseus.calyxo=info

Your web application directory tree should now look like shown below (version numbers may differ):

login-sample/
  WEB-INF/
    classes/
      de/odysseus/calyxo/sample/login/
        LoginAction.class
        LogoutAction.class
      messages.properties
      log4j.properties
    jsp/
      goodbye.jspx
      login.jspx
      welcome.jspx
    lib/
      calyxo-base-0.9.0.jar
      calyxo-control-0.9.0.jar
      commons-beanutils-1.7.0.jar
      commons-digester-1.7.jar
      commons-el-1.0.jar
      commons-logging-1.0.4.jar
      log4j-1.2.8.jar
      jstl.jar
      standard.jar
    calyxo-control-config.xml
    web.xml
  index.jspx