Saturday 9 July 2011

Spring 3.0 -Sample Controller Example


The following is the very basic Example Which I  tried out on Spring 3.0.The following screen hits include

1.Jars used for my sample.
2.Web.xml
3.Dispatcher-servlet.xml
4.Sample Controller code.
5.jsp samples.
6.Build.xml
7.Build.properties.

Since this code is of very basic,there's no much explanation deserved ;-)

1.Jars:






















2.web.xml









4.Sample controller:



































5. index.htm and result.jsps



<html>
<head>
<title>Spring 3 Example index.dp</title>
</head>
<body>
<a href="demo.html">Login</a>
</body>
</html>





<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>result</title>
</head>
<body>
${message}
</body>
</html>




Build.xml
 Tasks  deploy and deploywar in the following build file would use the build.properties to copy the war or the application folder to the webapps folder of tomcat. The lib and home mentioned in the build properties file may vary with tomcat versions and should change as needed.






build.properties :








No comments:

Post a Comment