`

警告:No configuration found for the specified action: \'s

 
阅读更多

1.index.jsp页面form标签未指定namespace属性。

<!--index.jsp代码-->

<%@taglib prefix="s" uri="/struts-tags"%>
...
<s:form action="submit" method="post">
<s:textfield name="msg" label="叙述:"></s:textfield>
<s:submit value="保存" name="save" method="save"></s:submit>
<s:submit value="打印" name="print" method="print"></s:submit>
</s:form>

 

 

<!--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>
<include file="struts-default.xml" />
<package name="struts2" namespace="/my" extends="struts-default">
<action name="submit" class="pro.action.MoreSubmitAction">
<result name="success">/index.jsp</result>
</action>
</package>
</struts>

 

解决方法:在index.jsp的form标签加上namespace属性。跟struts.xml中namespace属性一致即可。

...

<s:form action="submit" method="post" namespace="/my">
<s:textfield name="msg" label="叙述:"></s:textfield>
<s:submit value="保存" name="save" method="save"></s:submit>
<s:submit value="打印" name="print" method="print"></s:submit>
</s:form>

 


2.struts.xml默认放在src目录下,如修改了配置目录。同样会出现警告:No configuration found for the specified action: 'submit' in namespace

解决方法:

a.把struts.xml文件放到src目录。

b.修改web.xml文件。在web.xml加上以下代码(例如struts.xml配置在WEWB-INF目录下):

<init-param>
<param-name>config</param-name>
<param-value>../struts.xml</param-value>
</init-param>

 

分享到:
评论

相关推荐

    struts2开发遇到的问题

    2. **警告:No configuration found for the specified action: 'sum.action' in namespace: ''** 这个警告通常是因为Struts2找不到指定的Action。如果在JSP中使用 `&lt;s:form action=”sum.action”&gt;`,对应的源文件...

    报错 代码 经验

    : No configuration found for the specified action: 'fileUpLoad.action' in namespace: '/manager'. Form action defaulting to 'action' attribute's literal value. ``` **知识点解释:** 1. **问题描述:** ...

    BURNINTEST--硬件检测工具

    - Minor changes to the No operation error watchdog timer for the CD and Hard disk tests. - Minor correction to the Butterfly seek test. - Video playback trace logging increased. Release 5.3 build ...

    Java邮件开发Fundamentals of the JavaMail API

    The API's main purpose is not for transporting, delivering, and forwarding messages; this is the purview of applications such as sendmail and other Mail Transfer Agent (MTA) type programs. MUA-type...

    OutlookAttachView v2.73

    o Added option to scan only emails with the specified 'From' and 'To' strings. * Version 1.82 o When adding a folder to scan (with the Add button), the folder path in now delimited with quotes, ...

    CE中文版-启点CE过NP中文.exe

    Here's a new version for the hollidays. Mainly minor improvements and some small bugfixes, but also a new 'ultimap like' feature called Code Filter for which you don't need any special hardware for. ...

    php.ini-development

    Please see the actual settings later in the document for more details as to why ; we recommend these changes in PHP's behavior. ; display_errors ; Default Value: On ; Development Value: On ; ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    is now available for writing (during the writing, the standard grid object TFlexGrid is released, and a user's one is set). - ADD: In the class TFlexGrid added the properties HOffset and VOffset - ...

    Turbo C 2.00[DISK]

    When /P is specified, the EGA palette will be restored each time the screen is swapped. In general, you don't need to use this switch unless your program modifies the EGA palette registers, or ...

    Turbo C 2.01[DISK]

    When /P is specified, the EGA palette will be restored each time the screen is swapped. In general, you don't need to use this switch unless your program modifies the EGA palette registers, or ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    For this reason, the functions that handle these actions offer the option of waiting until the action is complete before returning (so-called synchronous operation); although they can be called in an ...

Global site tag (gtag.js) - Google Analytics