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-

Advertisements

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

– – –