CrazyEngineers
  • Struts in eclipse

    Nikumbh

    Nikumbh

    @nikumbh-lmTCgS
    Updated: Oct 22, 2024
    Views: 1.4K
    Hi Folks,
    Whenever i start creating a dynamic web application, I ended up with the following error
    type Status report
    message /StrutsHelloWorld
    description The requested resource (/StrutsHelloWorld) is not available.

    Could you please help me where i'm making mistake. Well Thanks in advance

    NOTE: I'm using Eclipse INDIGO f
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Anoop Kumar

    MemberJun 23, 2013

    Paste your directory structure and struts.xml here.
    Looks like action path given in struts.xml not correct. if possible upload you project.
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 23, 2013

    @ianoopI don't know how to upload the directory
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 23, 2013

    <!-- index. jsp -->
     
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
       
       
        <%@ taglib prefix="s" uri="/struts-tags"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <h1>Hello World From Struts2</h1>
      <form action="hello">
          <label for="name">Please enter your name</label><br/>
          <input type="text" name="name"/>
          <input type="submit" value="Say Hello"/>
      </form>
    </body>
    </html>

    <!-- HelloWorld.jsp -->
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
        <%@ taglib prefix="s" uri="/struts-tags" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    Hello World, <s:property value="name"/>
    </body>
    </html>
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 23, 2013

    //HelloWorldAction.java
     
    package com.tutorialspoint.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;
          }
     
    }
    
    // web.xml
     
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://java.sun.com/xml/ns/javaee" xmlns:web="https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="https://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
      display-name>Struts 2</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>
    //struts.xml
     
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
      "https://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
    <constant name="struts.devMode" value="true" />
      <package name="helloworld" extends="struts-default">
       
          <action name="hello"
                class="com.tutorialspoint.struts2.HelloWorldAction"
                method="execute">
                <result name="success">/HelloWorld.jsp</result>
          </action>
      </package>
    </struts>
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 23, 2013

    #-Link-Snipped-# Am I able to clear you?
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJun 23, 2013

    structure seems fine but problem with struts that what is working in Struts 2.X.2 may not work in struts 2.x.11. I have faced similar issue.
    Can you try this tutorial they have mentioned particular struts library also?
    #-Link-Snipped-#
    If not I have working project, I will upload from home.
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 23, 2013

    Could you please upload the code you're having at home, if it doesn't follow the maven plugin. Well #-Link-Snipped-# Thanks mate...😀
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJun 24, 2013

    Find attachment and add following to your lib path from struts 2.3 libraries
      struts2-core.jar
          freemarker.jar
          xwork-core.jar
          ognl.jar
          commons-fileupload.jar
          commons-lang.jar
          commons-io.jar
    This should work. I have tested it.
    Are you sure? This action cannot be undone.
    Cancel
  • Anand Tamariya

    MemberJun 24, 2013

    Where have you done the mapping for StrutsHelloWorld ?
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 24, 2013

    ianoop
    Find attachment and add following to your lib path from struts 2.3 libraries
      struts2-core.jar
          freemarker.jar
          xwork-core.jar
          ognl.jar
          commons-fileupload.jar
          commons-lang.jar
          commons-io.jar
    This should work. I have tested it.
    Thank You very much mate. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 24, 2013

    Anand Tamariya
    Where have you done the mapping for StrutsHelloWorld ?
    #-Link-Snipped-# : Thank you very much for your reponse.... But i've found the solution by the #-Link-Snipped-# 's reponse. Anyways thank you very much buddy.
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJun 24, 2013

    ianoop
    Find attachment and add following to your lib path from struts 2.3 libraries
      struts2-core.jar
          freemarker.jar
          xwork-core.jar
          ognl.jar
          commons-fileupload.jar
          commons-lang.jar
          commons-io.jar
    This should work. I have tested it.
    #-Link-Snipped-# FYI:
    Previously i didn't have the
    freemarker.jar, xwork-core.jar in my libraries list. But it works
    perfect now... Thanks again dude...
    👍
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register