CrazyEngineers
  • Struts in Eclipse Indigo

    Nikumbh

    Member

    Updated: Oct 21, 2024
    Views: 1.5K
    Hi FOLKS,
    I'm trying to run a simple struts appln. But at the very end i'm reaching the following error... Could anyone please help me.
    HTTP Status 404 - /ActionTest/birthday.jsp


    type Status report
    message /ActionTest/birthday.jsp
    description The requested resource (/ActionTest/birthday.jsp) is not available.

    I've also attached the files i've used...
    birthday.jsp
     
     
     
     
     
    <%@ page contentType="text/html; charset=UTF-8"  %>
     
    <%@ taglib  uri="WEB-INF/struts-tags.tld" prefix="s"%>
    <!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>Birthday | Wish</title>
    </head>
    <body>
    <h1> Enter the Birthday Boys name:</h1>
    <s:form action="happybirthday">
    <s:textfield name="personName" label="Birthday Boy Name:" />
    <s:submit/>
    </s:form>
     
    </body>
    </html>
     
     
     
    //birthdaySuccess.jsp
     
     
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib  uri="WEB-INF/struts-tags.tld" prefix="s"%>
    <!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>Success | Birthday</title>
    </head>
    <h1>Wish you a Very Happy Birthday to You :-) <s:property value="personName"/></h1>
    </body>
    </html>
     
     
     
    //noBirthday.jsp
     
     
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ taglib  uri="WEB-INF/struts-tags.tld" prefix="s"%>
    <!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>No | Birthday</title>
    </head>
    <body>
    <h1>No body</h1>
     
    </body>
    </html>
     
     
     
    //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>ActionTest</display-name>
      <welcome-file-list>
        <welcome-file>birthday.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>*.jsp</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>
    <package name="default" namespace="/greetings" extends="struts-default">
       
    <action name="birthday">
    <result>birthday.jsp</result>
    </action>
    <action name="happybirthday" class="greetings.HappyBirthday">
    <result name="Success">birthdaySuccess.jsp</result>
    <result name="Failure">noBirthday.jsp</result>
    </action>
     
    </package>
    </struts>
     
    
    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

    MemberJul 15, 2013

    Are you sure, your following code is right??
    <action name="birthday">
    <result>birthday.jsp</result>
    </action>
    You can map a action with is fully qualified action class. A JSP is not a action class.
    BTW, you can access jsp directly. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJul 15, 2013

    #-Link-Snipped-# : But i don't think that's the reason caused the above mentioned error... Anyway i've removed that action part(named "birthday"). Still i've ended up with the following error.

    type Status report
    message /ActionTest/birthday.jsp
    description The requested resource (/ActionTest/birthday.jsp) is not available.
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJul 15, 2013

    can you give directory structure and which struts version you are using?
    You have this: uri="WEB-INF/struts-tags.tld"

    is tld is there?? can you use this, see if help:
    uri="/struts-tags"
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJul 15, 2013

    The problem is solved now. Initially i haven't included the javassist-3.11.0.GA.jar in my lib folder. Now it's working. Anyways #-Link-Snipped-# Thank you very much for the response bro...
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJul 16, 2013

    Great!! you solved it by yourself 👍
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJul 17, 2013

    ianoop
    Are you sure, your following code is right??
    <action name="birthday">
    <result>birthday.jsp</result>
    </action>
    You can map a action with is fully qualified action class. A JSP is not a action class.
    BTW, you can access jsp directly. 😀


    I was wrong , you can define jsp as action URL by following code, by adding ForwardAction

      <action
                path="/myPage"
                type="org.apache.struts.actions.ForwardAction"
                parameter="/myPage.jsp"/>
    Are you sure? This action cannot be undone.
    Cancel
  • Nikumbh

    MemberJul 19, 2013

    #-Link-Snipped-# : Once again thank you very much bro.......👍
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register