The following tip is an example of running the Spring Client in a Servlet.

First copy g:\spring12\spring.jar to g:\tomcat5\common\lib and start tomcat server.

Then set class path as shown below and edit the servletclient.java.

Java Code:
f:\springdemo>set classpath=f:\springdemo; 
f:\springdemo\spring.jar; 
f:\springdemo\commons-logging.jar; 
g:\tomcat5\common\lib\servlet-api.jar 
f:\springdemo\servletclient.java
Java Code:
import java.io.*; 
import org.springframework.beans.factory.*; 
import org.springframework.beans.factory.xml.*; 
import org.springframework.core.io.*; 
import javax.servlet.*; 
import javax.servlet.http.*; 
public class servletclient extends HttpServlet 
{ 
     public void doPost(HttpServletRequest req,HttpServletResponse resp) 
     throws ServletException,IOException 
     { 
           resp.setContentType("text/html"); 
           PrintWriter out =resp.getWriter(); 
           String a = req.getParameter("text1"); 

           try 
           { 
                     System.out.println("Please wait."); 
                     Resource res = new ClassPathResource("hello.xml"); 
                     System.out.println("Resource ok"); 

                     BeanFactory factory = new XmlBeanFactory(res); 
                     System.out.println("BeanFactory ok"); 

                     hello bean1 = (hello)factory.getBean("hello"); 
                     String s = bean1.sayhello(a); 
                     out.println(s); 
           } 
           catch(Exception e1) 
           {
                 System.out.println(""+e1);} 
           } 
}
Java Code:
<html> 
<body> 
<form method=post 
action="
http://localhost:8080/ 
servlet/servletclient"> 
<input type=text name="text1"> 
<input type=submit>  
</form> 
</body> 
</html>
Then compile the servlet and copy all the class files ie., hello.class , helloimpl.class, servletclient.class and the xml file hello.xml to g:\tomcat5\webapps\root\web-inf\classes. Copy html file servletclient.htm to g:\tomcat5\webapps\root. Add entry to web.xml file.
Restart Tomcat server and open browser and type url as http://localhost:8080/servletclient.htm . We will get a text box and a button. Type a name and click the 'submit' button.