Geeks Talk

Prepare for your Next Interview




servlet - struts

This is a discussion on servlet - struts within the Java forums, part of the Software Development category; Can anyone tell me how servet acts as a controller in struts? --------------------- suresh...


Go Back   Geeks Talk > Software Development > Java

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-30-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,007
Thanks: 0
Thanked 76 Times in 64 Posts
psuresh1982 will become famous soon enough
servlet - struts

Can anyone tell me how servet acts as a controller in struts?

---------------------
suresh
Reply With Quote
The Following User Says Thank You to psuresh1982 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 08-10-2007
Junior Member
 
Join Date: Jun 2007
Location: India
Posts: 20
Thanks: 0
Thanked 6 Times in 4 Posts
deeptiagrawal is on a distinguished road
Re: servlet - struts

We define the name & path of the Action Servlet in the Web.xml.Web.xml is the deployment descriptor of the application. Thus,whenever any request has been made by submitting the JSP page control goes to the action servlet.Action Servlet intercepts & process the request by forwarding it to Model. Thus, in this way it acts as a controller.
Reply With Quote
  #3 (permalink)  
Old 10-24-2007
Banned
 
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
sarithahere528 is on a distinguished road
Re: servlet - struts

In web.xml ur specifying the servlet name as

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

i.e wtever request comes from the brower , comes to web.xml and maps to org.apache.struts.action.ActionServlet(this is already implemented by apache).This ActionServlet will act as a controller . ActionServlet uses the initialization parameters /WEB-INF/struts-config.xml and send to particular Action
Reply With Quote
  #4 (permalink)  
Old 05-23-2008
Junior Member
 
Join Date: May 2008
Location: ahmedabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
rakesh_mehta is on a distinguished road
Re: servlet - struts

hi.. when request first comes it will handle by the controller(Action Servlet)...
In struts there is only one controller is called Action Servlet Controller...
Reply With Quote
  #5 (permalink)  
Old 08-22-2008
Junior Member
 
Join Date: Aug 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
sjava.438 is on a distinguished road
Re: servlet - struts

Hi,
controller part is developed by servlet components. whenever client make a request,
front controller used to identify the request and give to the specific request processor which is used to handle request by doing the following..
protocal handling, form validation, action mapping,....etc
and give the request to the action and take the response give the response to the view.

front controller is one servlet component provided by framework.
request processor (application controller) is one servlet provided by framework.
action is one servlet developed by us.

thanks
Reply With Quote
Reply

  Geeks Talk > Software Development > Java


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Can we have 2 Struts Config.xml file Geek_Guest JSP 10 3 Weeks Ago 09:25 AM
why we shift Servlet to JSP ? psuresh1982 JSP 5 06-30-2008 09:09 AM
About Servlet Filter... psuresh1982 Java 1 06-16-2007 05:41 PM
struts anupamad Java 2 05-04-2007 03:40 AM
Struts Tags functionality Geek_Guest JSP 0 03-26-2007 08:30 AM


All times are GMT -4. The time now is 01:21 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved