What is the difference between Struts and Spring?

STRUTS
SPRING
Struts is a web framework
Spring is not a web framework
Struts is not a layered architecture
Spring is layered architecture
Struts framework is heavy weight
Spring is light weight framework
Struts framework supports tag libraries
Spring does not support any tag libraries
Struts is tight coupled
Spring is loose coupled framework
We need to write code manually for integration in struts
Spring provides easy integration with ORM technologies
Struts can easily integrate with other client side technologies
It is not easy in case of spring like struts

What is the difference between Struts 1.x and Struts 2.x?

STRUTS1.X
STRUTS2.X
ActionServlet is the front controller in struts1
In struts 2 FilterDispatcher act as the front controller
We have Action classes and form beans separately in struts1
We have Action classes and Form beans combined as Action class only in struts2, we can maintain separately if occur
In struts1, configuration file name can be 'anyName.xml' and used to place in WEB-INF folder
configuration file name must be 'struts.xml' and used to place in CLASSES folder in struts2
Properties file must be configured in struts-config.xml in struts1
Need to configure our resource bundles in struts.properties file in struts2
We have Request processor class in struts1
In struts2, we have Interceptors in place of Request processor
In struts1, programmatic and declarative validations only we have
We have annotation support also along with programmatic and declarative validations
Struts1 have multiple tag libraries like HTML, LOGIC, BEAN etc.
Struts2 have single tag library which includes all tags in place of multiple tag libraries

How to Restrict User To Enter OnlyDecimals(single decimal point(.) and Numbers ) in Textbox Using JavaScript?

<script>
   function onlyDecimals(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode;
    if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    } else {
    // If the number field already has . then don't allow to enter . again.
    if (evt.target.value.search(/\./) > -1 && charCode == 46) {
        return false;
    }
    return true;
    }
}
 </script>


Bind the following code in jsp file
<td><s:textfield name="textfieldname" value="%{ftextfieldname}" id="textfieldnameId" dir="rtl" onkeypress="return onlyDecimal(event);"/></td>