Showing posts with label Apache wicket. Show all posts
Showing posts with label Apache wicket. Show all posts

Friday, March 21, 2008

Using Ofbiz and Wicket - Part I

This article is the first article and probably more to follow on how to use Wicket with Ofbiz.

Both Wicket and Ofbiz are from ASF (Apache Software Foundation) but unfortunately not many ppl seem to have used them together.

Primary reason for me to use them together was complexity and amount of configuration required to use existing Ofbiz frontend frameworks such as screen widget and learning additional technologies such as freemarker, beanshell etc. That lead me to look for a framework which would replace that and provide more - hence Apache Wicket.

Apache Wicket falls into already crowded MVC UI Frameworks consisting of struts, seam amongst others. You can get an entire list from Wicket website :). Yes, it has AJAX support builtin in the framework and yes it has rich set of components both AJAX and otherwise as Wicket extensions and at WicketStuff.org with integration with popular Javascript AJAX libraries DOJO, YUI and JQuery and few others.

Now that we have some background, lets see what you need to get started and use Wicket "inside" Apache Ofbiz.

  • Ofbiz comes with embedded Tomcat at the time of writing Ofbiz 4.0 came with Tomcat 5.5.23 and fortunately Wicket can be deployed in any standard web container
  • Download wicket binaries from Apache Wicket site, copy them over to your Ofbiz application lib directory where you have your application and other 3rd party jars. I chose to put it under hot-deploy/myapp/webapp/myapp/WEB-INF/lib
  • Add WicketFilter entry to your web.xml file (Note: Both WicketFilter and Ofbiz ContextFilter will be listening on /* requests - so initially there will be chaining of those filters, but for this first article I will ignore that) - Make sure to put WicketFilter entry before ContextFilter so WicketFilter gets called first
  • Write your first Hello World in Wicket by creating your WebApplication and WebPage classes - access the URL (http://localhost:8080/yourappcontext) and see it in action, where yourappcontext is whatever you configured it to be in your ofbiz-component.xml file
In the following articles I will try to cover things like using Ofbiz Entity Engine, Service Engine from wicket and may be how to translate Ofbiz ecommerce application using entirely Wicket. On the way will try to quickly cover some cool UI components both SEO friendly and otherwise.

Thursday, March 20, 2008

How to package Wicket jars quickly

Wicket is buildable only using maven. Using maven install is not bad if you have to just build Wicket once, but when you have to build it multiple times, its takes its toll :) - on my 2.4GHz, 4Gb RAM dell laptop it takes atleast 8-12 mins - thats painful.

If you are not Maven guru and would like to get this done quickly - here is what I tried and it worked. I could not find any documentation that shows exactly these steps so...

Depending on the wicket jar that you want to build - cd to that subdirectory under wicket and use

mvn -Dmaven.test.skip=true compile jar:jar install:install

or any combination of the options above which are self explanatory, but I will explain them anyway, just in case-
compile - compile phase of maven which will compile all
jar:jar - is the jar goal of package phase if you specify the package instead of jar:jar it will also try to generate javadocs which will take forever
install:install - deploy phase goal

Hope that helped - would save atleast 30-45 mins if you didnt know maven