Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Struts FAQs

Struts FAQs

Ratings: (0)|Views: 98|Likes:
Published by Ravi Kishore

More info:

Published by: Ravi Kishore on Aug 07, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Struts is a open source implementation of MVC design pattern to develop largescale web applications. Struts framework makes it easier to design realible, scalableweb applications in java. Struts is not only thread safe but also thread dependent. Itinstantiates each action once and allows others to be threaded through the originalobject. Struts reduces the for redundant jsp's. ActionForm stratagy reduces theneed of subclasshierarchy.
Struts is a light weight package. It consists of 5 core packages and 5 taglig directories.
1. Purpose of tiles-def.xml file is used to in the design face of the webpage. Forexample in the webpage "top or bottom or left isfixed" center might be dynamically chaged.It is used for the easy design of the web sites. Reusability2. resourcebundle.properties file is used for lot of purpose. One of its purpose isinternationalization. We can make our page to view on any language. It isindependent of it. Just based on the browser setting it selects the language and itdisplayed as you mentioned in the resourcebundle.properties file.3. Validation rule.xml is used to put all the validation of the front-end in thevalidationrule.xml. So it verifies. If the same rule is applied in more than one page.No need to write the code once again in each page. Use validation to chek theerrors in forms.
Normal Servlet and Action servlet are same but Action servlet consists of logic forforwarding the request to corresponding action class
 The new features added to Struts 1.1 are1. RequestProcessor class2. Method perform() replaced by execute() in Struts base Action Class3. Changes to web.xml and struts-config.xml4.Declarative exception handling5.Dynamic ActionForms6.Plug-ins7.Multiple Application Modules8.Nested Tags9.The Struts Validator10.Change to the ORO package
11.Change to Commons logging12.Removal of Admin actions13. Deprecation of the GenericDataSource
In struts , their is no facility of backward flow.Suppose we are in page 1 and when we submit it calls action mapping page2.Theirmay be lot of variable stored in session , which is available to page2.Now we wish togo page1 from page 2, for this we have to call the action mapping of page1. Butstruts flow is always in forward direction. So when we call page 1, values stored insession never get reversed. So it reduces the performance. To resolve this problem of struts, Their is a framework called Web Flow NevigationManager(WFNM) of Sourgeforge.net. This framework can be integrated with struts.
What is Dispatch Action?
DispatchAction is specialized child of StrutsAction class. It combines or group the methods that can further access the bussiness logic at a single place. The methodcan be anyone from CRUD [Create,Retrieve,Update or Delete] or it can be securitycheck one like autheniticate user etc. This class apart from having thread-safe execute method also can have user-defined methods.In struts-config.xml files following changes are required forDispatchaction to work:<action-mappings><action path="/login"type ="com.....LoginAction"name ="loginForm"parameter ="task"scope = "request"validate = "false"input= "/index. jsp"> <forward name="success" path="/jsp/common/index.jsp"/><forward name="loginagain" path="/index.jsp"/></action></action-mappings>
If above is your struts-config.xml file structure and LoginAction extendsDispatchAction instead of normal Action class. And assuming [keep assuming] yourLoginAction class havemethod named authenticateUser, then in your login.jsp addany hidden parameter called task with value as your method name and on submit of that page following will be the url:http://localhost:8080/yourproject/jsp/login.jsp?login.do&task=authenticateUser Thus if we try to combine the last part of thispuzzlewe get the climax at struts-config.xml file's action-mappingtagdescribed above. The parameter property of <action> tag have the task as it's value pointing to taskvariable in the request having it's value as authenticateUserhence the framework search in the LoginAction a method called authenticateUserthrough reflection and forwards the execution flow to it. This is all folks, the briallancy of Struts framework.Note DispatchAction class is included in 1.1 version.
1) A request is made from previously displayed view.2) The request reaches the ActionServlet which acts as the controller .TheActionServlet Looksup the requested URI in an XML file (Struts-Config.xml) anddetermines the name of theAction classthat has to perform the requested business logic.3) The Action Class performs its logic on the Model Components associated with theApplication.4) Once the Action has been completed its processing it returns the control to theAction Servlet. As part of its return the Action Class provides a key to determinewhere the results should be forwarded for presentation.5) The request iscompletewhen the Action Servlet responds by forwarding therequest to the view, and this view represents the result of the action.
How to call EJB from Struts?
We can call EJB from Struts by using service locater design pattern or by using initialcontext with create home object and getting return remote reference object.
What is the difference between bean:write and bean:message?
 These two are custom tags HTML tag library. Both these two are used to call the java bean.bean:message - is to access a java bean that will display a message such as " Formore details on the product displayed in this web site please contact a phonenumber 12345.."

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
finder08 liked this
eswark43 liked this
dvnrkishore2722 liked this
DABZ/ROHIT liked this
hak2310 liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->