Dear Dev ,
I have also specified the HelloWorldAction.java in package whose code is as
follows .
package Struts2;
public class HelloWorldAction
{
private String name;
public String execute()throws Exception
{
return "success";
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name=name;
}
}
Thanks
Praveen Jain
--- On Mon, 11/14/11, Dave Newton <[email protected]> wrote:
From: Dave Newton <[email protected]>
Subject: Re: provide Helloworld application in Struts2.0
To: "Struts Users Mailing List" <[email protected]>
Date: Monday, November 14, 2011, 8:57 AM
Did you not make an action class?
There's one specified in your config file.
Dave
On Mon, Nov 14, 2011 at 11:53 AM, Praveen Jain <
[email protected]> wrote:
> Yes I made a Simple hello application in Servlet and it is running fine.
> But my hello world application in struts is not running please find the
> four files which compose the application i have made 4 files index.jsp ,
> Helloworld.jsp , web.xml , struts.xml
>
> Please go through the code and help me out to run the application.
> code for index.jsp
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <%@taglib prefix="s" uri="/struts-tags" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Hello World</title>
> </head>
> <body>
> <h1>Hello World fron struts 2 </h1>
> <form action="HelloWorldAction">
> <label for="name"> Please enter ur name</label><br>
> <input type="text" name="name"/>
> <input type="submit" value="Say Hello">
> </form>
> </body>
> </html> Code for Helloworld.jsp
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <%@taglib prefix="s" uri="/struts-tags" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Hello World JSP</title>
> </head>
>
> <body>
> Hello world,<s:property value="name"/>
>
> </body>
> </html>
>
>
>
> Code for Web.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" 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">
>
> <display-name>HelloWorldStruts2</display-name>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> <filter>
> <filter-name>Struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
> </filter>
>
> <filter-mapping>
> <filter-name>Struts2</filter-name>
> <url-pattern>/*</url-pattern>
>
> </filter-mapping>
>
> </web-app>
>
> Code for Struts.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
> <constant name="struts.devMode" value="true"></constant>
> <package name="Struts2" namespace= "/" "struts-default">
> <action name="HelloWorldAction"
> class="Struts2.HelloWorldAction" method="execute">
> <result name="success">Helloworld.jsp</result>
> </action>
> </package>
> </struts>
>
>
>
>
>
>
>
>
>
>
>
> --- On Sun, 11/13/11, Ilya Kazakevich <[email protected]>
> wrote:
>
> From: Ilya Kazakevich <[email protected]>
> Subject: RE: provide Helloworld application in Struts2.0
> To: "'Struts Users Mailing List'" <[email protected]>
> Date: Sunday, November 13, 2011, 10:07 AM
>
> You probably need to familiarize yourself with concepts of servlet and
> context.
>
> Please read servlet specification (at least "Overview" chapter) and tomcat
> context manual http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>
> Try to write and deploy simple servlet then that does nothing but writes
> "hello" to the output. After success you may get back to struts.
>
>
>
> Ilya Kazakevich,
> Developer
> JetBrains Inc
> http://www.jetbrains.com
> "Develop with pleasure!"
>
> -----Original Message-----
> From: Praveen Jain [mailto:[email protected]]
> Sent: Sunday, November 13, 2011 9:51 PM
> To: Struts Users Mailing List
> Subject: RE: provide Helloworld application in Struts2.0
>
>
> HelloWorldStruts2
> is the name of the project made in Eclipse and its web.xml is as under
> mentioned
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" 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">
>
> <display-name>HelloWorldStruts2</display-name>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> <filter>
> <filter-name>Struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
> </filter>
>
> <filter-mapping>
> <filter-name>Struts2</filter-name>
> <url-pattern>/*</url-pattern>
>
> </filter-mapping>
>
> </web-app>
>
>
> ThanksPraveen Jain
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>