Sl. No
Struts
Spring
1
Struts is a web framework
Spring is an application
framework
2
Using MVC pattern
spring MVC is one of the
modules
3
Hard code to use applications
like hibernate, JDBC
Inbuilt hibernate, JDBC etc
4
Struts allows only JSP
Support JSPs, Velocity,
Free maker etc.,
5
Struts is heavy weight
Spring is light weight
6
Struts is tightly coupled
Spring is loosely coupled.
7
Excellent support for
Tag Library
Not that Much
8
Easy to integrate with other
client side technologies
Not [...]
Read Full Post »
Spring is standard in lightweight enterprise application framework. Layered architecture, which allows you to be selective about which of its components you use there are seven modules in Spring Frame work
I> Spring Core:
Uses IOC pattern to separate the application configuration with dependency specification from the actual application code.
IOC (Inversion of control)
No creation of object but [...]
Read Full Post »
1> Controller Contains
public class testController extends MultiActionController {
public ModelAndView action_name1(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) {
System.out.println(“In Action1″);
return new ModelAndView(“view1″, “date”,”date”);
}
public ModelAndView action_name2(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) {
System.out.println(“In Action 2″);
return new ModelAndView(“view2″, “date”,”date”);
}
}
2> View contains
<a href=”test.htm?action=action_name1″ >Go to Action1 </a> |
<a href=”test.htm?action=action_name2″ >Go to Action2 </a>
3> Change in Application-servlet.xml
<bean name=”/test.htm” class=”testController”>
<property name=”methodNameResolver”>
<ref bean=”paramResolver”/>
</property>
</bean>
<bean id=”paramResolver” class=”org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver”>
<property name=”paramName”><value>action</value></property>
</bean>
Simple Way:
1> Controller Contains
same as above
2> [...]
Read Full Post »