Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can I make own ActionServlet? with example

Answers were Sorted based on User's Feedback



How can I make own ActionServlet? with example..

Answer / ashwin k j

You can make your own ActionServlet by extending
RequestProcessor class and overriding its methods. The
example is given below....

package com.visualbuilder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.RequestProcessor;

public class CustomRequestProcessor extends
RequestProcessor {

public boolean processPreprocess(HttpServletRequest
request, HttpServletResponse response) {

System.out.println("Called the preprocess method before
processing the request");
return super.processPreprocess(request,response);
}
}
The following is web.xml file u should change it accoringly

<?xml version="1.0" encoding="UTF-8"?><web-app
version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-
app_2_4.xsd"><servlet> <servlet-name>action</servlet-
name> <servlet-
class>com.visualbuilder.CustomActionServlet</servlet-
class> <init-param> <param-name>config</param-
name> <param-value>/WEB-INF/struts-config.xml</param-
value> </init-param> <load-on-startup>2</load-on-
startup></servlet><servlet-mapping> <servlet-
name>action</servlet-name> <url-pattern>*.do</url-
pattern></servlet-mapping><welcome-file-list> <welcome-
file>index.jsp</welcome-file></welcome-file-list></web-app>

Is This Answer Correct ?    22 Yes 7 No

How can I make own ActionServlet? with example..

Answer / srinivas

our servlet class extending ActionServlet class

Is This Answer Correct ?    23 Yes 16 No

How can I make own ActionServlet? with example..

Answer / dharshan gk

using requestProcessor by which we can customize
ActionServlet class

Is This Answer Correct ?    13 Yes 6 No

How can I make own ActionServlet? with example..

Answer / shaik baji

1)ActionServlet contains a set of methods which are invoked
by the container for processing the client request. If we
want to define our own ActionServlet then you
should "extends" our class
from "org.apache.struts.action.ActionServlet" class and
what ever the functionality we want to override of the
ActionServlet we should override that respective predefined
ActionServlet methods.

2)To invoke our own ActionServlet class instead of the
predefined ActionServlet class we should specify our own
ActionServlet class name in In "web.xml" file like as
follows:

<servlet-class>MyOwnActionServlet</servlet-class>

3)Then the container will invoke our own ActionServlet class

Is This Answer Correct ?    4 Yes 1 No

How can I make own ActionServlet? with example..

Answer / srinu

its simple.our servlet extends ActionServlet.
and also writes in web.xml file entry <servlet-class>name be
our servlet name.

Is This Answer Correct ?    1 Yes 0 No

How can I make own ActionServlet? with example..

Answer / sekhar babu

Yes we can write our own ActionServlet
by extending ActionServlet,
But in web.xml we have to specify the new class in
<class-name>tag

Is This Answer Correct ?    1 Yes 1 No

How can I make own ActionServlet? with example..

Answer / anjani kumar jha

Yes you can make your own ActionServlet.
But how you call the Request Processor. and before writing
the ActionServlet please see the code of actionservlet and
the RequestProcessor.

And once u go throgh the code of ActionServlet u will
understand why lacs of people involving to develop the struts.

Is This Answer Correct ?    2 Yes 4 No

How can I make own ActionServlet? with example..

Answer / shaibal

please give detail ans with example if possible.

Is This Answer Correct ?    6 Yes 9 No

Post New Answer

More Struts Interview Questions

List some bundled validators?

0 Answers  


How we can controlled duplicate form submission in struts?

0 Answers  


What kind of mvc is struts 2?

0 Answers  


What do you mean by the abstract package in struts2, and what is its utilization?

0 Answers  


Do you need an alignment after replacing struts?

0 Answers  


What is the purpose of form-beans tag in struct-config.xml?

0 Answers  


What is ognl?

0 Answers  


Does apache struts run on windows?

0 Answers  


What validate() and reset() method does ?

0 Answers  


What is xml based validation in struts2?

0 Answers  


How the exceptions are handled in struts?

0 Answers  


why servlet is used as controller not JSP?

9 Answers   MCS,


Categories