Results 1 to 4 of 4
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default back to start (home)

    I did indeed go back to start (home) and built several simple Helloworld-like-Struts.
    Things start to work out and I am looking a lot into the configuration and other stuff!

    But suddenly I face another problem! I have two “identical” projects: one is running and the other is NOT!

    org.apache.struts2.dispatcher.Dispatcher error
    SEVERE: Could not find action or result
    /struts2tryout/
    There is no Action mapped for namespace [/] and action name [] associated with context path [/struts2tryout].
    - [unknown location]


    Here is the one that does not want to run:
    at src/com.whatevercomp.struts2tryout/HelloWorldAction

    Java Code:
    public class HelloWorldAction { //localhost:8080/HelloWorldStruts2
    	
    	private String name;
    	
    	public String execute() throws Exception {
    	      return "success";
    	}
    	   
        public String getName() {
    	      return name;
    	}
        
    	public void setName(String name) {
    	      this.name = name;
    	} 
    }

    two JSPs at WebContent/WEB-INF/index.jsp

    Java Code:
    <%@ 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>
    <title>Hello World</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>

    and at: WebContent/WEB-INF/HelloWorld.jsp

    Java Code:
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib prefix="s" uri="/struts-tags" %>
    <html>
    <head>
    <title>Hello World</title>
    </head>
    <body>
       Hello World, <s:property value="name"/>
    </body>
    </html>
    WebContent/WEB-INF/web.xml

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
      
      <display-name>struts2tryout</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.ng.filter.StrutsPrepareAndExecuteFilter
       </filter-class>
      </filter>
      <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
    </web-app>
    WebContent/WEB-INF/classes/struts.xml

    Java Code:
    <?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" />
       <package name="user" namespace="/" extends="struts-default">
          <action name="hello"
                class="com.whatevercomp.struts2tryout.HelloWorldAction"
                method="execute">
                <result name="success">/HelloWorld.jsp</result>
          </action>
       </package>
    </struts>

    I did not set Maven on this one so here are the plugs:

    commons-fileupload-1.3.1.jar
    freemarker-2.3.19.jar
    commons-io-2.2.jar
    javassist-3.11.0.GA.jar
    commons-lang3-3.1.jar
    ognl-3.0.6.jar
    commons-logging-1.1.3.jar
    struts2-core-2.3.16.3.jar
    commons-logging-api-1.1.jar
    xwork-core-2.3.16.3.jar
    Last edited by willemjav; 07-24-2014 at 06:24 PM.

  2. #2
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: back to start (home)

    http://localhost:8080/struts2tryout/

    Struts Problem Report

    Struts has detected an unhandled exception:

    Messages:
    There is no Action mapped for namespace [/] and action name [] associated with context path [/tempurastruts2].
    Stacktraces

    There is no Action mapped for namespace [/] and action name [] associated with context path [/tempurastruts2]. - [unknown location]
    com.opensymphony.xwork2.DefaultActionProxy.prepare (DefaultActionProxy.java:185)
    org.apache.struts2.impl.StrutsActionProxy.prepare( StrutsActionProxy.java:63)
    org.apache.struts2.impl.StrutsActionProxyFactory.c reateActionProxy(StrutsActionProxyFactory.java:37)
    com.opensymphony.xwork2.DefaultActionProxyFactory. createActionProxy(DefaultActionProxyFactory.java:5 8)
    org.apache.struts2.dispatcher.Dispatcher.serviceAc tion(Dispatcher.java:552)
    org.apache.struts2.dispatcher.ng.ExecuteOperations .executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrep areAndExecuteFilter.doFilter(StrutsPrepareAndExecu teFilter.java:99)
    org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:241)
    org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:208)
    org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:220)
    org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:122)
    org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:501)
    org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:171)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:950)
    org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:116)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:408)
    org.apache.coyote.http11.AbstractHttp11Processor.p rocess(AbstractHttp11Processor.java:1040)
    org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:607)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:314)
    java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1142)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
    org.apache.tomcat.util.threads.TaskThread$Wrapping Runnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:745)

    You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:

    struts.devMode=false
    in your WEB-INF/classes/struts.properties file.


    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <faceted-project>
      <runtime name="Apache Tomcat v7.0"/>
      <fixed facet="java"/>
      <fixed facet="jst.web"/>
      <fixed facet="wst.jsdt.web"/>
      <installed facet="java" version="1.8"/>
      <installed facet="jst.web" version="3.0"/>
      <installed facet="wst.jsdt.web" version="1.0"/>
    </faceted-project>
    
    
    <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
        <wb-module deploy-name="struts2tryout">
            <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
            <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
            <property name="java-output-path" value="/struts2tryout/build/classes"/>
            <property name="context-root" value="struts2tryout"/>
        </wb-module>
    </project-modules>
    Last edited by willemjav; 07-24-2014 at 06:50 PM.

  3. #3
    Join Date
    Apr 2014
    Posts
    49
    Rep Power
    0

    Default Re: back to start (home)

    you can also set in struts.xml <constant name="struts.devMode" value="false" />

  4. #4
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

Similar Threads

  1. Replies: 2
    Last Post: 11-06-2011, 08:32 AM
  2. Replies: 3
    Last Post: 01-07-2011, 12:23 AM
  3. Replies: 0
    Last Post: 02-01-2009, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •