In a normal web application, client is called to a server, the information submitted is handed to Java Servlet that interacts with database to produce HTML response. The information can also be submitted to Java Server Pages that combines Java code with HTML.
Both approaches do not work when it comes to large projects and hence we require Struts.
Java Servlets is used to create dynamic websites with Java.
Before the servlet return the data to the browser, parameters are adjusted to the requirement of Browser.
Java Server Pages (JSP):
Java Beans attributes (variables) are private. The access to these attributes is managed by getter and setter methods.
Struts framework has a Request handler, a Response handler and a tag library.
There are two versions of Struts: Struts 1.x framework that are used widely and Struts 2.x framework that provide elegant solutions to difficult problems.
View is the screen that is seen by user and is used to give or read information. Information are filled in HTML pages generated by JSP files and in the same way when showing results an HTML page will be generated by same JSP files.
The information by the user is first submitted in the HTML page and is then sent to the Controller i.e. Java Beans.
Controller takes the information submitted to the Model. The functions set in Model are only called by Controller and there is no link between Model and View hence this framework works faster and better. Controller then takes the result back to display it to the user through HTML pages.
Attributes used in Struts:
Id : tag uses this as the temporary name of the bean
Name : the name of a pre-existing bean
Property : of the bean of the name attribute
Scope : to search for the bean of the name attribute
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: September 6, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles