Quick Webservices

If you want to expose existing API as web services …try this…

http://ws.apache.org/axis/
http://enunciate.codehaus.org/

How to test them?

http://www.soapui.org
http://jakarta.apache.org/jmeter/
http://code.google.com/p/rest-client/

-o-

#apache-axis, #enunciate, #web-services

How to build single JSP page based sites in 4 hours?

Problem Statement: How to build quick web report?

Requirement: The report cotains same story lines with different data from database.

With the help of JSTL, JSP and Display Tag completed coding with out single java file or configuration.

Create basic structure to build the code

>mvn archetype:create -DgroupId=com.abcd.xyz -DartifactId=project_war_name -DarchetypeArtifactId=maven-archetype-webapp

Technologies Used:
Display Tag, JSTL, JSP

Links:
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jstlsql.html
http://displaytag.sourceforge.net/1.2/tut_sources.html
http://www.java2s.com/Code/Java/JSTL/JSTLSQLQuery.htm
http://demo.raibledesigns.com/appfuse/demos/users.jsp
HTML Editor: http://www.coffeecup.com/free-editor use to build basic three page layout.

Add these dependencies to pom.xml file


<dependency>
 <groupId>displaytag</groupId>
 <artifactId>displaytag</artifactId>
 <version>1.1</version>
</dependency>

<dependency>
 <groupId>com.oracle</groupId>
 <artifactId>ojdbc</artifactId>
 <version>11.1.0.7.0</version>
</dependency>

<dependency>
 <groupId>javax.servlet</groupId>
 <artifactId>jstl</artifactId>
 <version>1.1.2</version>
</dependency>
<!-- standard.jar -->
<dependency>
 <groupId>taglibs</groupId>
 <artifactId>standard</artifactId>
 <version>1.1.2</version>
</dependency>

Add following code with real data to index.jsp page

<b>Heading of query information</b>
</br>
<sql:query var="results_abcd" dataSource="${dataSource}">
select col1, col2,col3 from table1 where condition1='asdf'
</sql:query>
<display:table name="pageScope.results_abcd.rows" id="table5" >
 <display:column property="col1" sortable="true" />
 <display:column property="col2" sortable="true" />
 <display:column property="col3" sortable="true" />
</display:table>
</br></br>

more jstl examples: http://academic2.strose.edu/Math_And_Science/avitabij/cis455fall07/jstljdbc/notes.htm
Note: in JSTL we need to use escape charecters when required during copy paste query from SQL editor to JSTL code.
Example: where userid like '%%'
in JSTL: where userid like '%\%'

Java – Performance Monitoring

Problem: One method is taking 30 seconds. How can we bring it down to the minimal?

First we need to identify all the code (methods) executed.
Get the time took by each method. So that we can troubleshoot one at a time.

How to do this?

1. Simple solution: Using difference of start time and end time.
We can’t use this always. This is not production quality code and we can’t litter the code with all these methods and calculations.

2. Using API level code
JMON API http://jamonapi.sourceforge.net/

3. Using Monitors. This is best way to test distributed installations.
InfraRED http://infrared.sourceforge.net

  • – –

#java-performance-monitoring

Java Reports, Charts, Barcode

Free Open Source Reports to use with Java

Jasper Reports – http://jasperforge.org/projects/jasperreports
JFree Charts – http://www.jfree.org/jfreechart/samples.html
Print Barcode – http://barbecue.sourceforge.net/

-o-

#java-barcode, #java-charts, #java-graphs

Web based development

Recently looked at it. And it looks great.
http://www.makumba.org/

This is easy to build application based on CRUD operations for existing database.
http://examples.codecharge.com

This provides nice tabular view of the data with lots of features. Used in many projects.
http://displaytag.homeip.net/displaytag-examples-1.2/index.jsp

SUN JavaOne Conference Content

SUN JavaOne Conference Content

http://developers.sun.com/learning/javaoneonline/j1online.jsp?track=embedded&yr=2009

#javaone-conference

Log4j.xml Configuration through Java

URL url = AbstractTestCase.class.getResource( “/xyz/dev/asdf_log4j.xml” );

PropertyConfigurator.configure( url );

This wont give any error. It wont work. Because it works only with propertes file.

DOMConfigurator.configure(url);

This is correct one to load .xml files.

This is not going to work with SLF4J.

http://www.slf4j.org/migrator.html