AJWIP Introduction

07/03/2015

I wanted a simpler version of what Wickets does so that it would be easier to learn and modifiable to the needs of my applicaiton. Apache Wickets is IMO good but hard to learn and complexed.

So to list the features I wanted in a Wickets like library.

  • Small code base.
  • Very simple to understand
  • Very easy to get started with.
  • Use comment blocks instead of tags.
  • Easy to use in an embedded device.
  • Jetty server
  • Apache Derby database
  • Easy to add new featuers.
  • Have an easy way to debug or monitor the application. (AJWIP Debug program)

The AJWIP library is used to process HTML webpages that will be partly populated by a Java class with the same name, like TestPanel.html and TestPanel.java. The Java class also handles any submit or POST type actions.

The template of the Java file looks like the following.

package com;

import java.io.InputStream;

public class TestPanel implements AjwipInterface {
	private Ajwip ajwip = null;
	
	public TestPanel() {
		
	}
	
	@Override
	public RetStatus submit(InputStream in) {
		RetStatus rs = null;
		ajwip.msgCon(this, "Submitting...");
		
		return rs;
	}

	@Override
	public String populate(String html) {
		return populate(html, null);
	}

	@Override
	public String populate(String html, String msg) {
		String txt = html;
		
		ajwip.msgCon(this, "Populating...");
		
		return txt;
	}

	@Override
	public void setAjwip(Ajwip ajwip) {
		this.ajwip = ajwip;
	}

}

First create your HTML webpage as you normally would but when you need a field or data to be dynamically created at runtime you would use an HTML comment like <!-- ajwip:web_link -->. When the HTML page is called the AJWIP library will call the 'populate' method and replace the <!-- ajwip:web_link --> with an HTML hyprelink for example. See example the code can also be found in the ajwipweb-1.?.?.zip file.

The methods are 'submit' and 'populate'. When the browser asks for the page, the 'populate' method is called to add HTML widgets or data to the webpage.

August 8, 2015 7:34