Struts

What is IncludeAction?

The IncludeAction class is useful when you want to integrate Struts into an application that uses Servlets. Use the IncludeAction class to include another resource in the response to the request being processed.

STRUTS CONFIG

What are the important tags of struts-config.xml ?

The five important sections are

STRUTS APP

What is the directory structure of Struts application?

The directory structure of Struts application :

How can we make message resources definitions file available to the Struts framework environment?

We can make message resources definitions file (properties file) available to Struts framework environment by adding this file to struts-config.xml.

<message-resources parameter=”com.login.struts.ApplicationResources”/>

How can we make message resources definitions file available to the Struts framework environment?

We can make message resources definitions file (properties file) available to Struts framework environment by adding this file to struts-config.xml.

<message-resources parameter=”com.login.struts.ApplicationResources”/>

How can we make message resources definitions file available to the Struts framework environment?

We can make message resources definitions file (properties file) available to Struts framework environment by adding this file to struts-config.xml.

<message-resources parameter=”com.login.struts.ApplicationResources”/>

What is the Servlet?

A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request- response programming model.

How the exceptions are handled in struts?

Exceptions in Struts are handled in two ways:

  • Programmatic exception handling :

Explicit try/catch blocks in any code that can throw exception. It works well when custom value (i.e., of variable) needed when error occurs.

  • Declarative exception handling :You can either define <global-exceptions> handling tags in your struts-config.xml or define the exception handling tags within <action></action> tag. It works well when custom page needed when error occurs. This approach applies only to exceptions thrown by Actions.

<global-exceptions> <exception key=”some.key” type=”java.lang.NullPointerException” path=”/WEB-INF/errors/null.jsp”/> </global-exceptions>

or

<exception key=”some.key” type=”package.SomeException” path=”/WEB-INF/somepage.jsp”/>

What is the life cycle of ActionForm?

The lifecycle of ActionForm invoked by the RequestProcessor is as follows: • Retrieve or Create Form Bean associated with Action • “Store” FormBean in appropriate scope (request or session) • Reset the properties of the FormBean • Populate the properties of the FormBean • Validate the properties of the FormBean • Pass FormBean to Action

What are the various Struts tag libraries?

The various Struts tag libraries are: • HTML Tags • Bean Tags • Logic Tags • Template Tags • Nested Tags • Tiles Tags