Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Struts

Struts

Ratings: (0)|Views: 38 |Likes:

More info:

Published by: Sudheer Reddy Pothurai on Oct 29, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/29/2012

pdf

text

original

 
POTHURAI
Struts
A frame work simplifies the development of the complex applications. The framework software’s are designed based on very good architecture.Ex: - Struts, Spring MVC, web works are designed based on MVC architecture.A frame work contains the code that is commonly required as part of almost everyproject. A frame work provides a standard procedure for doing every task. This makesthe development of the application: easier than development of an app with without usinga frame work.
package org.students;import javax.servlet.*;import javax.servlet.http.*;import java.io.*;public class OurActionServlet extends HttpServlet{public void init( )throws ServletException{System.out.println("----reading xxx.xml----");}public void service(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException{System.out.println("----OurActionServlet----"+request.getRequestURI( ));}}D:\Pskr\Struts>javac -d . OurActionServlet.java
<web-app><servlet><servlet-name>action</servlet-name><servlet-class>org.students.OurActionServlet</servlet-class><load-on-startup>2</load-on-startup></servlet><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping></web-app>Start weblogic server----reading xxx.xml----http://localhost:8000/str/one.do----OurActionServlet----/str/one.dohttp://localhost:8000/str/xxx/yyy.do----OurActionServlet----/str/xxx/yyy.do
SUDHEER REDDY1
 
POTHURAI
web.xmlBrowserxxx.xmlweb containerThe following steps will be carried out while starting the above web application: -1)Web container reads web.xml.
2)
As we have used load-on-startup, web container creates OurActionServlet obj.3)Web container calls the init( ).4)The init( ) method reads the information available in xxx.xml.Note: - Web container executes OurActionServlet code when it receives the request sentusing the URL that ends with .do We get the following things as part of Struts frame work: -
1)
A set of tag libraries like struts-html, struts-logic, struts-bean, struts-tiles etc…
2)
A servlet class with the name org.apache.struts.action.ActionServlet.3)A set of classes like Action, ActionForm, ActonError, ActionErrors etctheseclasses are used as part of our code.Procedure for setting up a struts based web applications: -1) Create a Root directory for the web applicationEx: - d:\str2) Copy struts-blank.war to d:\pskr3) Using cd command move to the directory str & use the jar command to extract thecontent of the war filed:\str>jsr cf struts-blank.war .4) Copy str directory & place this directory in weblogicD:\bea\user_projects\domains\sunil\applications\ directoryIn tomcat D:\Tomcat5.0\webapps\ directory
<web-app><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>2</load-on-startup></servlet>
SUDHEER REDDY2
 
action(*.do)org.students.OurActionServlet/one.do/xxx/yyy.doinit( ) {-----------}
 
POTHURAI
<servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><taglib><taglib-uri>/tags/struts-bean</taglib-uri><taglib-location>/WEB-INF/struts-bean.tld</taglib-location></taglib><taglib><taglib-uri>/tags/struts-html</taglib-uri><taglib-location>/WEB-INF/struts-html.tld</taglib-location></taglib><taglib><taglib-uri>/tags/struts-logic</taglib-uri><taglib-location>/WEB-INF/struts-logic.tld</taglib-location></taglib><taglib><taglib-uri>/tags/struts-nested</taglib-uri><taglib-location>/WEB-INF/struts-nested.tld</taglib-location></taglib><taglib><taglib-uri>/tags/struts-tiles</taglib-uri><taglib-location>/WEB-INF/struts-tiles.tld</taglib-location></taglib></web-app>The following steps will carry out when a struts base application will start: -1)Web container reads web.xml
2)
Web container creates a servlet object based on ActionServlet class
3)
Web container calls the init( ) method on ActionServlet.
4)
Struts code that is part of the init( ) method reads the information available instruts-config.xmlNote: -Web container executes the code of the ActionServlet, when it receive a requestthat ends with .doweb.xmlBrowserstruts-config.xml web container
SUDHEER REDDY3
 
action(*.do)org.apache.struts.action.ActionServletinit( ) {struts code}
 
/aone.do/axxx.do

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->