ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

How action mapping is configured in Struts?

Action mappings are configured in the configuration file struts-config.xml under the tag <action-mapping> as follows:

[xml]

<pre><action-mappings>

<action path=”/login”

type=”login.loginAction”

name=”loginForm”

input=”/login.jsp”

scope=”request”

validate=”true”>

<forward name=”success” path=”/index.jsp”/>

<forward name=”failure” path=”/login_error.jsp”/>

</action>

</action-mappings>

[/xml]

When should be opt for Struts Framework?

Struts should be used when any or some of the following conditions are true:

A highly robust enterprise level application development is required.

A reusable, highly configurable application is required.

A loosely coupled, MVC based application is required with clear segregation of different layers.

Why ActionServlet is singleton in Struts?

In Struts framework, actionServlet acts as a controller and all the requests made by users are controlled by this controller. ActionServlet is based on singleton design patter as only one object needs to be created for this controller class. Multiple threads are created later for each user request.

What are the steps required for setting up validator framework in Struts?

Following Steps are required to setup validator framework in Struts: –

In WEB-INF directory place valdator-rules.xml and validation.xml files.

Enable validation plugin in struts-config.xml files by adding following:

[xml]

<plug-in className=”org.apache.struts.validator.ValidatorPlugIn”>

<set-property property=”pathnames” value=”/WEB-INF/validator-rules.xml,

/WEB-INF/validation.xml”/>

</plug-in>

[/xml]

Which technologies can be used at View Layer in Struts?

In Struts, we can use any of the following technologies in view layer:

JSP

HTML

XML/XSLT

WML Files

Velocity Templates

Servlets

Related Posts Plugin for WordPress, Blogger...
Flag Counter