Quick Webservices

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


How to test them?




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

HTML Editor: http://www.coffeecup.com/free-editor use to build basic three page layout.

Add these dependencies to pom.xml file



<!-- standard.jar -->

Add following code with real data to index.jsp page

<b>Heading of query information</b>
<sql:query var="results_abcd" dataSource="${dataSource}">
select col1, col2,col3 from table1 where condition1='asdf'
<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" />

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

– – –