15.01.2013 Views

Programs 1 Develop static pages (using Only HTML) of an online ...

Programs 1 Develop static pages (using Only HTML) of an online ...

Programs 1 Develop static pages (using Only HTML) of an online ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8. Implement the "Hello World!" program <strong>using</strong> JSP Struts Framework<br />

PROCEDURE:<br />

Step 1:<br />

in tomcat install directory<br />

Open tomcat/webapps<br />

Create a subdirectory(ts)<br />

Copy the struts‐bl<strong>an</strong>k.war file<br />

At that directory path in cmd give the comm<strong>an</strong>d as<br />

Jar xvf struts‐bl<strong>an</strong>k.war<br />

Step 2:<br />

create a directory (work in e:\) <strong>an</strong>d copy struts.jar,servelet‐appi.jar into work d directory.Then set the classpath as<br />

set classpath=struts.jar;servlet‐api.jar;<br />

then copy the ActionOne.class file to webapps/ts/WEB‐INF/classes<br />

ActionOne.java:<br />

import java.io.*;<br />

import javax.servlet.*;<br />

import javax.servlet.http.*;<br />

import org.apache.struts.action.*;<br />

public class ActionOne extends Action<br />

{<br />

publicActionForwardexecute(ActionMappingmapping,ActionFormform,HttpServletRequest<br />

request,HttpServletResponse response)throws Exception<br />

{<br />

System.out.println("‐‐‐Action executed‐‐‐‐");<br />

PrintWriter pw=response.getWriter();<br />

pw.println("HELLO WORLD!");<br />

return null;<br />

}<br />

}<br />

Step 3:<br />

Struts‐Config.xml file<br />

<br />

<br />

<br />

<br />

<br />

<br />

Step 4:<br />

49<br />

49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!