Sunday 20 April 2008

ANT build.xml sample

Please use ant sample , just change some value

Click Here

Wednesday 16 April 2008

[Spring] Simple MVC Web application Example 2

[Spring] Simple MVC Web application Example 2

- Display Current Time with parameter under MVC model
(* Developing and Configuring the Views and the Controller)

From http://www.springframework.org/docs/Spring-MVC-step-by-step/index.html

Click Here

[Spring] Basic Example 1

[Spring] Simple MVC Web application Example

Modify from Spring reference
http://www.springframework.org/docs/Spring-MVC-step-by-step/index.html

- Create Control and just display hello world
click here

Monday 14 April 2008

Spring Eclipse IDE sample

- install Eclipse IDE for spring and simple demo

* http://www.javabeat.net/articles/2007/09/introduction-to-spring-ide-2-0/


- Sample source
click Here

Thursday 10 April 2008

JBoss Error : Port already in use: 1098

when you run jboss from "run.bat" file, you might have the error "Port already in use: 1098"

In this case, please open /server/default/conf/jboss-service.xml
and change from "from 1098 to 1122(a port hasn't been taken)".

Then restarted the JBOSS, everything looks ok now.

Monday 7 April 2008

Exception Example

class NewExceptionTest {
public static void main(String args[]) {
try {
startInstall();
copyFiles();
} catch (SpaceException e) {
System.out.println("error : " + e.getMessage());
e.printStackTrace();
System.out.println("not enough space.");
} catch (MemoryException me) {
System.out.println("error : " + me.getMessage());
me.printStackTrace();
System.gc(); //expand memory from Garbage Collection
System.out.println("install again.");
} finally {
deleteTempFiles(); // delete temp files
} // end of try
} // end of main

static void startInstall() throws SpaceException, MemoryException {
if(!enoughSpace()) // if not enought space...
throw new SpaceException("not enought space.");
if (!enoughMemory()) // if not memory space..
throw new MemoryException("not enought memory space.");
} // end of startInstall

static void copyFiles() { /* copy code. */ }
static void deleteTempFiles() { /* delete temp files code .*/}

static boolean enoughSpace() {
// code for checking enough space.
return false;
}
static boolean enoughMemory() {
// code for checking memory space.
return true;
}
} // end of ExceptionTest

class SpaceException extends Exception {
SpaceException(String msg) {
super(msg);
}
}

class MemoryException extends Exception {
MemoryException(String msg) {
super(msg);
}
}