This URL : http://localhost:8080/IteratorKFC/IteratorKFC/menu.action receives
the following error
Status report
message /IteratorKFC/IteratorKFC/pages/iteratorkfc.jsp
description The requested resource
(/IteratorKFC/IteratorKFC/pages/iteratorkfc.jsp) is not available.
I use Eclipse for development.
Per Eclipse, iteratorkfc.jsp resides inside Web Pages as listed below:
Project IteratorKFC
Web Pages
iteratorkfc.jsp
any advices ?
thanks
Tri Quan
-----Original Message-----
From: Lukasz Lenart [mailto:[email protected]]
Sent: Friday, June 20, 2014 8:14 AM
To: Struts Users Mailing List
Subject: Re: need help on struts.xml configuration using Struts 2.3, Tomcat 7,
Java JDK 1.6
Wrong url, it supposed to be:
http://localhost:8080/IteratorKFC/IteratorKFC/menu.action
/IteratorKFC <- name of the war file, ie. context /IteratorKFC <- namespace
defined in struts.xml
2014-06-20 13:33 GMT+02:00 Tri Quan <[email protected]>:
> All,
>
> I am green horn in Struts 2 and need help with struts.xml.
> I got the following error when try this URL :
>
> localhost:8080/IteratorKFC/menu or localhost:8080/IteratorKFC/menu.action .
>
>
>
>
>
>
> what is wrong ? Incorrect configuration or incorrect URL ?
>
>
>
> Struts has detected an unhandled exception:
>
> There is no Action mapped for namespace / and action name menu. -
> [unknown location]
>
> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.
> java:1
> 89)
>
>
> org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.ja
> va:61)
>
>
> org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(Str
> utsAct
> ionProxyFactory.java:39)
>
>
> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(De
> faultA
> ctionProxyFactory.java:58)
>
>
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java
> :488)
>
>
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatch
> er.jav
> a:434)
>
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> cation
> FilterChain.java:243)
>
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> lterCh
> ain.java:210)
>
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> lve.ja
> va:240)
>
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
> lve.ja
> va:164)
>
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat
> orBase
> .java:462)
>
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
> va:164
> )
>
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
> va:100
> )
>
>
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:5
> 63)
>
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
> e.java
> :118)
>
>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> :403)
>
>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
> 301)
>
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proces
> s(Http
> 11Protocol.java:162)
>
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proces
> s(Http
> 11Protocol.java:140)
>
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:
> 309)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>
> java.lang.Thread.run(Unknown Source)
>
>
>
> Strut.xml source ========================================
>
> <?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>
>
>
>
> <!-- Configuration for the default package. -->
>
> <!-- <constant name="struts.action.extension" value=""/> -->
>
>
>
> <constant name="struts.devMode" value="true" />
>
> <package name="IteratorKFC" namespace="/IteratorKFC"
> extends="struts-default">
>
> <action name="menu" class="iteratorkfc.IteratorKFCAction"
> method="execute">
>
> <result
> name="success">pages/iteratorkfc.jsp</result>
>
> </action>
>
> </package>
>
> </struts>
>
>
>
> ItertorKFCAction java ==========================================
>
> package iteratorkfc;
>
> import java.util.*;
>
>
>
> import com.opensymphony.xwork2.ActionSupport;
>
> public class IteratorKFCAction extends ActionSupport{
>
> private List<String> comboMeals;
>
>
>
> public List<String> getComboMeals() {
>
> return comboMeals;
>
> }
>
>
>
> public void setComboMeals(List<String> comboMeals) {
>
> this.comboMeals = comboMeals;
>
> }
>
>
>
> @Override
>
> public String execute() {
>
>
>
> comboMeals = new ArrayList<String>();
>
> comboMeals.add("Snack Plate");
>
> comboMeals.add("Dinner Plate");
>
> comboMeals.add("Colonel Chicken Rice
> Combo");
>
> comboMeals.add("Colonel Burger");
>
> comboMeals.add("O.R. Fillet Burger");
>
> comboMeals.add("Zinger Burger");
>
>
>
> return SUCCESS;
>
> }
>
>
>
> }
>
>
>
> Jsp ============================================
>
> <%@ page contentType="text/html; charset=UTF-8" %>
>
> <%@ taglib prefix="s" uri="/struts-tags" %>
>
>
>
> <html>
>
> <head>
>
> <title><s:text name="Struts2 Iterator "/></title>
>
> </head>
>
>
>
> <body>
>
> <h1>Struts 2 Iterator tag example</h1>
>
>
>
> <h3>Simple Iterator</h3>
>
> <ol>
>
> <s:iterator value="comboMeals">
>
> <li><s:property /></li>
>
> </s:iterator>
>
> </ol>
>
>
>
> <h3>Iterator with IteratorStatus</h3>
>
> <table>
>
> <s:iterator value="comboMeals" status="comboMealsStatus">
>
> <tr>
>
> <s:if test="#comboMealsStatus.even == true">
>
> <td style="background: #CCCCCC"><s:property/></td>
>
> </s:if>
>
> <s:elseif test="#comboMealsStatus.first == true">
>
> <td><s:property/> (This is first value) </td>
>
> </s:elseif>
>
> <s:else>
>
> <td><s:property/></td>
>
> </s:else>
>
> </tr>
>
> </s:iterator>
>
> </table>
>
>
>
> </body>
>
> </html>
>
>
>
>
>
>
>
>
> Thank you for your help and advices.
>
> Tri Quan
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]