Q.In struts why we use jsp as presentation layer? can we use servlet as presentation layer?
Q. Explain about token feature in Struts?
There are methods built into the Struts action to generate one-use tokens. A token is placed in the session when a form is populated and also into the HTML form as a hidden property. When the form is returned, the token is validated. If validation fails, then the form has already been submitted, and the user can be apprised.
Q.What is the difference between ActionForm and DynaActionForm?
# The DynaActionForm bloats up the Struts config file with the xml based definition. This gets annoying as the Struts Config file grow larger.
# The DynaActionForm is not strongly typed as the ActionForm. This means there is no compile time checking for the form fields. Detecting them at runtime is painful and makes you go through redeployment.
# ActionForm can be cleanly organized in packages as against the flat organization in the Struts Config file.
# ActionForm were designed to act as a Firewall between HTTP and the Action classes, i.e. isolate and encapsulate the HTTP request parameters from direct use in Actions. With DynaActionForm, the property access is no different than using request.getParameter( .. ).
# DynaActionForm construction at runtime requires a lot of Java Reflection (Introspection) machinery that can be avoided.
# Time savings from DynaActionForm is insignificant. It doesn t take long for today s IDEs to generate getters and setters for the ActionForm attributes. (Let us say that you made a silly typo in accessing the DynaActionForm properties in the Action instance. It takes less time to generate the getters and setters in the IDE than fixing your Action code and redeploying your web application)
Q.Explain Struts navigation flow?
Struts Navigation flow.1) A request is made from previously displayed view.2) The request reaches the ActionServlet which acts as the controller .The ActionServlet Looksup the requested URI in an XML file (Struts-Config.xml) and determines the name of the Action class that has to perform the requested business logic.3)The Action Class performs its logic on the Model Components associated with the Application.4) Once The Action has been completed its processing it returns the control to the Action Servlet.As part of its return the Action Class provides a key to determine where the results should be forwarded for presentation.5)The request is complete when the Action Servlet responds by forwarding the request to the view, and this view represents the result of the action.
0 comments:
Post a Comment