Halloween Freak with Spring Acegi.

Long time since I came back. But got some motivation to work on some ACEGI framework in the recent past. So here we start with our trademark base application. First let us build our usual suspects

Task 1) Setup your env
Task 2) Setup your struts framework skeleton
Task 3) Freak with why struts is always a learning exp with log4j logging.
Task 4) complete the logon process.

Setup your env: Thanks to the folks at IntelliJ. Simply the best IDE ever for developing applications. For this app, we are still going to be good citizens of struts 1.3. We will use use Spring framework 3.1.0 and the log4j api. All the required jars will be in google code base. How about I give the link after finishing all the tasks!!

The initial workflow for the document is to setup a logon page- ask for customer's login-id and password, authenticate and pass the customer to a success page.

First the log 4j setup:

We will define the log4j.properties; all logging information will be sent to the console:

log4j.rootLogger=ALL, stdout
log4j.appender.stdout.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n

As log4j does not have a life of its own, here is the commons-logging.properties.

org.apache.commons.logging.Log = org.apache.commons.logging.impl.Log4JLogger

Here is the copy of the struts-config file:

Figure 1.0

Figure 2.0

As we see to start with; we will have a simple dyna form with loginid and password. See line 7-9 in figure 1.0.

Secondly we have a simple action information: see line 16-21 in figure 1.o. We have an indexaction Action class defined. Remember the input param should be a jsp file path or tiles defn path. We get the famous 404 error if this is not configured correctly.

Finally the struts-config file has the plugin for tiles and validator and spring integration <line no- 33-35>.

Here is the tiles-def.xml file.

Figure 3.0

To start with we are going to use the commons validator to ensure loginid and password are not empty.

Figure 4.0

And the Indexaction file source code is a simple one:

Figure 5.0

Let us get the Acegi moving morrow.