Struts 2 Questions And Answers Here you can find Struts 2 Questions and Answers. Why Struts 2 Questions and Answers Required?
Multiple Choice Questions – Answers 1. Identify the term that describes rod-shaped bacteria: A C o cc us B Bacillus [Tue] r C Spilli ir D L ongus. The correct answer is D. Viruses act by invading the animal cell and replicating its own genetic material over that of the animal cell.
In this Struts 2 Questions and Answers section you can learn and practice Struts 2 Questions and Answers to improve your skills in order to face technical interview conducted by organizations. By Practicing these interview questions, you can easily crack any Exams interview. Where can I get Struts 2 Questions and Answers? AllIndiaExams provides you lots Struts 2 Questions and Answers with proper explanation.
Fully solved examples with detailed answer description. All students, freshers can download Struts 2 Questions and Answers as PDF files and eBooks. How to solve these Struts 2 Questions and Answers? You no need to worry, we have given lots of Struts 2 Questions and Answers and also we have provided lots of FAQ's to quickly answer the questions in the Competitive Exams interview.
Struts 2 Questions and Answers. Android Questions & Answers. Angular JS Questions & Answers. CICS Questions and Answers. Struts 2 Questions and Answers.
GWT Questions and Answers. SAP SCM Questions and Answers. HTML 5 Questions & Answers. Struts 2 Questions & Answers. SAP CCM Questions & Answers.
VB Script Questions & Answers. VB.Net Questions & Answers and Many More.
Struts2 is one of the famous framework for developing web application in java. Recently I have wrote a lot of and in this post, I am listing down some of the important Struts2 interview questions with answers to help you in interview.
Struts2 Interview Questions. Struts2 Interview Questions and Answers. What is Struts2?
Apache Struts2 is an open source framework to build web applications in Java. Struts2 is based on OpenSymphony WebWork framework. It’s highly improved from Struts1 and that makes it more flexible, easy to use and extend. The core components of Struts2 are Action, Interceptors and Result pages. Struts2 provides many ways to create Action classes and configure them via struts.xml or through annotations.
We can create our own interceptors for common tasks. Struts2 comes with a lot of tags and uses OGNL expression language. We can create our own type converters to render result pages. Result pages can be JSPs and FreeMarker templates.
What are the differences between Struts1 and Struts2 or how Struts2 is better than Struts1? Struts2 is designed to overcome the shortcomings of Struts1 and to make it more flexible, extendable.
Some of the noticeable differences are. Copy. What is the use of namespace in action mapping in Struts2? Struts2 namespace configuration allows us to create modules easily. We can use namespace to separate our action classes based on their functionality, for example admin, user, customer etc. Which interceptor is responsible for mapping request parameters to action class Java Bean properties? Com.opensymphony.xwork2.interceptor.ParametersInterceptor interceptor is responsible for mapping request parameters to the Action class java bean properties.
This interceptor is configured in struts-default package with name “params”. This interceptor is part of basicStack and defaultStack interceptors stack. Which interceptor is responsible for i18n support?
Com.opensymphony.xwork2.interceptor.I18nInterceptor interceptor is responsible for i18n support in Struts2 applications. This interceptor is configured in struts-default package with name “i18n” and it’s part of i18nStack and defaultStack. What is the difference in using Action interface and ActionSupport class for our action classes, which one you would prefer? We can implement Action interface to create our action classes.
This interface has a single method execute that we need to implement. The only benefit of using this interface is that it contains some constants that we can use for result pages, these constants are SUCCESS, ERROR, NONE, INPUT and LOGIN. ActionSupport class is the default implementation of Action interface and it also implements interfaces related to Validation and i18n support. ActionSupport class implements Action, Validateable, ValidationAware, TextProvider and LocaleProvider interfaces. We can override validate method of ActionSupport class to include field level validation login in our action classes. Depending on the requirements, we can use any of the approaches to create struts 2 action classes, my favorite is ActionSupport class because it helps in writing validation and i18n logic easily in action classes. How can we get Servlet API Request, Response, HttpSession etc Objects in action classes?
Struts2 action classes doesn’t provide direct access to Servlet API components such as Request, Response and Session. However sometimes we need these access in action classes such as checking HTTP method or setting cookies in response. Thats why Struts2 API provides a bunch of.Aware interfaces that we can implement to access these objects. Struts2 API uses dependency injection to inject Servlet API components in action classes. Some of the important Aware interfaces are SessionAware, ApplicationAware, ServletRequestAware and ServletResponseAware. You can read more about them in How to get tutorial. What is the use of execAndWait interceptor?
Struts2 provides execAndWait interceptor for long running action classes. We can use this interceptor to return an intermediate response page to the client and once the processing is finished, final response is returned to the client. This interceptor is defined in the struts-default package and implementation is present in ExecuteAndWaitInterceptor class.
Check out to learn more about this interceptor and how to use it. What is the use of token interceptor in Struts2? One of the major problems with web applications is the double form submission. If not taken care, double form submission could result in charging double amount to customer or updating database values twice. We can use token interceptor to solve the double form submission problem. This interceptor is defined in struts-default package but it’s not part of any interceptor stack, so we need to include it manually in our action classes.
Read more at example. How can we integrate log4j in Struts2 application? Struts2 provides easy integration of log4j API for logging purpose, all we need to have is log4j configuration file in the WEB-INF/classes directory. You can check out the sample project at. What are different Struts2 tags? How can we use them?
Struts2 provides a lot of custom tags that we can use in result pages to create views for client request. These tags are broadly divided into three categories- Data tags, Control tags and UI tags. We can use these tags by adding these in JSP pages using taglib directive. Copy /exception.jsp /runtimeexception.jsp /error.jsp /error.jsp Read more at. Thats all for the Struts2 interview question and answers, if you come across any important question that I have missed, please let me know through comments.