Archive

Archive for the ‘Spring’ Category

Taglibs in JSP

November 8th, 2008 admin No comments

Different Taglibs and its Usuage in JSP:

1.Core:http://java.sun.com/jsp/jstl/core
This Taglibs is used for Looping,Variable Support,Flow control,URL Management and miscellaneous

<%@taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>

2.XML:http://java.sun.com/jsp/jstl/xml
This Taglibs is Used for Core,Flow Control and Transformation

<%@taglib uri=”http://java.sun.com/jsp/jstl/xml” prefix=”xl”%>

3.Internationalization:http://java.sun.com/jsp/jstl/fmt
This Taglibs is Used For Locale, Message formatting and Number & date formatting

<%@taglib uri=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt”%>

4.SQL:http://java.sun.com/jsp/jstl/sql
This Taglibs is Used For Sql Query Purpose

<%@ taglib uri=”http://java.sun.com/jsp/jstl/sql” prefix=”sql”%>

5.Functions:http://java.sun.com/jsp/jstl/functions
This Taglibs is Used For Collection length and String manipulation

<%@ taglib uri=”http://java.sun.com/jsp/jstl/functions” prefix=”fn”%>

Popularity: 2% [?]

Categories: JSP, Spring Tags:

what is Spring Framework?

October 30th, 2008 admin No comments

What is Spring Framework?

Spring is grate framework for development of Enterprise grade application. Spring is a light-weight framework for the development of enterprise-ready applications. Spring can be used to configure declarative transaction management, remote access to your logic using RMI or web services, mailing facilities and various options in persisting your data to a database.Spring framework can be used in modular fashion, it allows to use in parts and leave the other components which is not required by the application.

Feature of Spring Framework

Popularity: 1% [?]

Categories: Spring, What-is Tags:

Spring Framework

October 30th, 2008 admin No comments
  • Transaction Management: Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Spring’s transaction support is not tied to J2EE environments and it can be also used in container less environments.
  • JDBC Exception Handling: The JDBC abstraction layer of the Spring offers a meaningful exception hierarchy, which simplifies the error handling strategy.
  • Integration with Hibernate, JDO, and iBATIS: Spring provides best Integration services with Hibernate, JDO and iBATIS.
  • AOP Framework: Spring is best AOP framework
  • MVC Framework: Spring comes with MVC web application framework, built on core Spring functionality. This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText, and POI. But other frameworks can be easily used instead of Spring MVC Framework.

what is Spring Framework?

Popularity: 1% [?]

Categories: Spring Tags:

JSP Custom tags Example

October 26th, 2008 admin No comments


Custom tags are usually distributed in the form of a tag library, which defines a set of related custom tags and contains the objects that implement the tags.

A Simple Custom tags Example:

1.Create a Java Program

2.import javax.servlet.jsp.*,javax.servlet.jsp.tagext.* packages

3.Extends the TagSupport Class

4.Java Program Contain two Default Methods.
a)doStartTag
b)doEndTag

doStartTag:
1.The doStartTag method is invoked when the start tag is encountered
2.This method returns SKIP_BODY because a simple tag has no body

doEndTag:
1.The doEndTag method is invoked when the end tag is encountered
2.This method returns SKIP_BODY because a simple tag has no body

TagClass.java

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class TagClass extends TagSupport{

private String data=null;

public void setData(String value){
data= value;
}

public String getData(){
return(data);
}

public int doStartTag()throws JspException{
try{
JspWriter out=pageContext.getOut();
out.println(name);

}catch(Exception e){}
return SKIP_BODY;
}

public int doEndTag(){
return SKIP_BODY;
}

}

5.The Java Program Contain one Variable data(which has Getter and Setter Methods)

6.Create tld File.

7.We have to Create attribute For the Variable data

8.Syntax For Creating attribute:

<taglib>

<tag>

<attribute>
<name>data</name>//Name Can be Same as we can given within the tags
<required>true</required>//Requried Field Show Whether it is Mandatory or Not
</attribute>

<attribute>
<name>id</name>
<required>false</required>
</attribute>

</tag>

</taglib>

taglib.tld

<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<!DOCTYPE taglib PUBLIC “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN” “http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd”>

<taglib>

<tlib-version>1.0</tlib-version>

<jsp-version>1.2</jsp-version>

<short-name>form</short-name>

<tag>

<name>Show</name>
<tag-class>com.TagClass</tag-class>
<body-content>JSP</body-content>
<description>Simple Customs tags Example</description>

<attribute>
<name>data</name>
<required>true</required>
</attribute>

</tag>

</taglib>

9.Create a JSP Page.

10.Include this tag at the begining of the JSP Page

<%@ taglib uri=”/WEB-INF/tld/taglib.tld” prefix=”custom” %>

11.Create this Tag at the JSP Page

<custom:Show data=”Custom Tag Example”></custom:Show>

12.Output:

Custom Tag Example

Popularity: 6% [?]

Categories: JSP, Spring Tags: