Struts Interview Questions and Answers
Question - 81 : - How duplicate form submission can be controlled in Struts?
Answer - 81 : -
In Struts, action class provides two important methods which can be used to avoid duplicate form submissions.
saveToken() method of action class generates a unique token and saves it in the user’s session. isTokenValid() method is used then used to check uniqueness of tokens.
Question - 82 : - In Struts, how can we access Java beans and their properties?
Answer - 82 : - Bean Tag Library is a Struts library which can be used for accessing Java beans.
Question - 83 : - Which configuration file is used for storing JSP configuration information in Struts?
Answer - 83 : - For JSP configuration details, Web.xml file is used.
Question - 84 : - What’s the difference between validation.xml and validator-rules.xml files in Struts Validation framework?
Answer - 84 : -
In Validation.xml, we define validation rules for any specific Java bean while in validator-rules.xml file, standard and generic validation rules are defined.
Question - 85 : - How can we display all validation errors to user on JSP page?
Answer - 85 : - To display all validation errors based on the validation rules defined in validation.xml file, we use tag in our JSP file.
Question - 86 : - What’s declarative exception handling in Struts?
Answer - 86 : -
When logic for exception handling is defined in struts-config.xml or within the action tag, it’s known as declarative exception handling in Struts.
In the following example, we have defined exception in struts-config.xml file for NullPointerException: