Struts Interview Questions and Answers
Most Frequently Asked Struts Interview Questions
Q21. How we can configured action mapping in Struts?
Answer
To configure the Struts2 action mapping we have to add an action node inside the configuration file struts.xml
.
Here is an example for this:
<action name="*welcome" class="example.action.mapping.LinkAction" method="execute">
<result name="success">/welcome.jsp</result>
<result name="error">/error.jsp</result>
</action>
Q22. Which technologies can be used at View Layer in Struts?
Answer
You can use the following technologies in the view layer in Struts:
- JSP
- HTML
- XML/XSLT
- WML Files
- Velocity Templates
- Servlets
Q23. Lists the bundled validators in Struts?
Answer
Struts framework offers a number of built-in validators which are called as bundled validators. These validators are for input validations such as email, phone number, user id.
Struts offer the following bundled validators.
- requiredstring validator
- stringlength validator
- email validator
- date validator
- int validator
- double validator
- url validator
- regex validator
Q24. What is the use of jsonValidation in struts?
Answer
jsonValidation interceptor is utilized to perform AJAX validation.
Q25. Explain the difference between plain-validator and field-validator in Struts?
Answer
Field validators
- Act on single fields that are accessible through action
- More generic
- Offer validations in full content
Non-field validators
- Only add action level messages
- Mostly domain specific
- Offer custom implementations
- Allows to declare both types of validators