1) What are the Features of Struts 2?
Features of Struts 2 are:
- Configurable MVC components
- POJO based actions
- AJAX support
- Integration support
- Various Result Types
- Various Tag support
- Theme and Template support
2) What are the default interceptors of Struts 2?
Default interceptors of Struts 2 are:
alias |
clearSession |
store |
annotationWorkflow |
staticParams |
autowiring |
externalRef |
i18n |
sessionAutowiring |
timer |
chain |
execAndWait |
debugging |
servletConfig |
token |
checkbox |
exception |
multiselect |
scope |
roles |
cookie |
fileUpload |
workflow |
modelDriven |
params |
conversionError |
jsonValidation |
validation |
scopedModelDriven |
prepare |
createSession |
logger |
tokenSession |
actionMappingParams |
profiling |
3) What are the methods of ValueStack interface in Struts 2?
Methods of ValueStack interface are:
- public String findString(String expr)
- public Object findValue(String expr)
- public Object findValue(String expr, Class c)
- public Object peek()
- public Object pop()
- public void push(Object o)
- public void set(String key, Object value)
- public int size()
4) What are the methods of ActionInvocation interface in Struts 2?
Methods of ActionInvocation interface are:
- public ActionContext getInvocationContext()
- public ActionProxy getProxy()
- public ValueStack getStack()
- public Action getAction()
- public void invoke()
- public Result getResult()
5) What are the Constants of Action Interface in Struts 2?
The Constants of Action Interface are:
- SUCCESS
- ERROR
- LOGIN
- INPUT
- NONE
6) What are the types of Bundled validators in Struts 2?
Types of bundled validators are:
- requiredstring validator
- stringlength validator
- email validator
- date validator
- int validator
- double validator
- url validator
- regex validator
7) What are different ways to create Action classes in Struts2?
There are Three ways to create Action class are:
- We can create Action class by implementing Action interface
- We can create Action class using Struts2 @Action annotation
- We can create Action class by extending ActionSupport class
8) Name some useful annotations introduced in Struts2?
Useful annotations introduced in Struts2 are:
- @Action
- @Actions
- @Namespace and @Namespaces
- @Result
- @ResultPath
9) What are the life cycle methods of interceptor?
Life cycle methods of interceptor are:
- public void init()
- public void destroy()
- public void intercept(ActionInvocation ai)
10) What are the Aware interfaces in Struts2?
There are four Aware interfaces in Struts2 are:
- SessionAware
- ServletContextAware
- ServletRequestAware
- ServletResponseAware
11) What is OGNL?
It is an Expression language, It provides the accessibility feature for data stored in the ActionContext and stands for Object Graph Navigation Language.
12) What is the use of jsonValidation?
It is an interceptor which is used to perform asynchronous validation and it works with workflow and validation interceptors.
13) What is ActionInvocation?
It is responsible to invoke action and it holds the action and interceptor objects.
14) How to create input page(index.jsp) in Struts2 application?
Example of input page:
<%@ taglib uri="/struts-tags" prefix="s" %>
<s:form action="book">
<s:textfield name="id" label=" Id"></s:textfield>
<s:textfield name="name" label="Book Name"></s:textfield>
<s:textfield name="price" label="Book Price"></s:textfield>
<s:submit value="save"></s:submit>
</s:form>
15) What are the parameters of stringlength validator?
Parameters of stringlength validator are:
- trim
- minLength
- maxLength
- fieldName