0% found this document useful (0 votes)
83 views5 pages

Aim: 6.implement The "Hello World!" Program Using JSP Struts Framework Procedure: Step 1

The document outlines steps to implement a "Hello World!" program using the JSP Struts framework. The steps are: 1. Create a directory structure for the Struts application and extract necessary files. 2. Create an Action class that prints "Hello World!" and configure struts-config.xml. 3. Configure web.xml to map the Struts servlet and welcome files. 4. Access the application URL to run the program.

Uploaded by

sunnynnus
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views5 pages

Aim: 6.implement The "Hello World!" Program Using JSP Struts Framework Procedure: Step 1

The document outlines steps to implement a "Hello World!" program using the JSP Struts framework. The steps are: 1. Create a directory structure for the Struts application and extract necessary files. 2. Create an Action class that prints "Hello World!" and configure struts-config.xml. 3. Configure web.xml to map the Struts servlet and welcome files. 4. Access the application URL to run the program.

Uploaded by

sunnynnus
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

AIM:

6.Implement the "Hello World!" program using JSP Struts Framework

PROCEDURE:

Step 1:

in tomcat install directory


Open tomcat/webapps
Create a subdirectory(ts)
Copy the struts-blank.war file
At that directory path in cmd give the command as
Jar xvf struts-blank.war
Step 2:

create a directory (work in e:\) and copy struts.jar,servelet-appi.jar into work d directory.Then set
the classpath as
set classpath=struts.jar;servlet-api.jar;
then copy the ActionOne.class file to webapps/ts/WEB-INF/classes

ActionOne.java:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class ActionOne extends Action
{
publicActionForwardexecute(ActionMappingmapping,ActionFormform,HttpServletRequest
request,HttpServletResponse response)throws Exception
{
System.out.println("---Action executed----");
PrintWriter pw=response.getWriter();
pw.println("HELLO WORLD!");
return null;
}
}
Step 3:

Struts-Config.xml file

<?xml version="1.0" encoding="UTF-8"?>


<struts-config>
<action-mappings>
<action path="/xxx" type="ActionOne"/>
</action-mappings>
</struts-config>
Step 4:

Web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>


<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>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!--Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</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>
Step 5:
then in I.E give the url as http:localhost:8080/ts/xxx.do

You might also like