What it showsThe demo will show a few features of jZonic. Here is a short description of what is supported.
ViewsThe views are all rendered using velocity as template engine
CommandsThe commands are used to execute some business logic.
User managementThe demo uses the XML usermanager. Since this is a short example it is sufficient to use this approach. There are two users included with different roles and permission. A user is allowed to add new addresses and to update existing ones. The admin is also allowed to delete addresses.
ACL managementSome pages are restricted. That means that only users with the appropriate permissions are allowed to access these pages. This demo will show to handle this without one line of coding.
InterceptorThe demo shows the usage of interceptors. These interceptors are like filters that are wrapped around every request. In this case the application will simply write to a logfile which user has requested which page.
ErrorHandlerIn order to generate proper error pages this demo will use its own error handler. Every exception is caught by the dispatcher it will send this exception to the ErrorHandler.
SQL handlingThe demo uses the sql package to simplify the JDBC code.
How to run itFirst you need to download the file and extract it to a directory of your choice. The distribution is available here:
adrman-demo.tar.gz
adrman-demo.zip
This distribution contains a build.xml and you can simply run ant with no target. This will build a demo.war file in the dist directory. Deploy this file to your servlet container or J2EE server. You can then see the application under:
http://localhost:8080/demo/index.jz.
In order to do something you can either login as user/user or admin/admin. The admin has the permission to delete an address.
Note: Deploy in JBossIMPORTANT: Due to a bug/feature in JBoss you need to unpack the war file into the deploy directory of JBoss.
Since JBoss already has a hypersonic database running you we do not need to start one.
First open the service.xml located in the etc directory and comment the following block:
<service name="database" code="org.jzonic.core.sp.services.HypersonicDB">
<attribute name="port" type="int" value="1476"/>
<attribute name="databaseName" type="java.lang.String" value="addressDB"/>
<attribute name="wait" type="long" value="4000"/>
<method name="startDatabase"/>
<load-on-startup/>
</service>
Then open the default.script file in your jboss hypersonic db directory and add the following lines:
CREATE TABLE ADDRESS(ID INTEGER NOT NULL IDENTITY PRIMARY KEY,
FIRSTNAME VARCHAR,
NAME VARCHAR,
STREET VARCHAR,
PLACE VARCHAR,
ZIPCODE VARCHAR,
PHONE VARCHAR,
HANDY VARCHAR,
FAX VARCHAR,
EMAIL VARCHAR,
WEBSITE VARCHAR)
and add a few addresses so we can see something:
Build thewar file using the jboss.war target
ant jboss.war
ScreenshotHere is a screenshot so you can see what you get:
|