社区
Java EE
帖子详情
标题: struts下使用多个配置文件出错的问题!
xloveronline
2005-08-23 10:58:07
我修改了web.xml配置,增加了<init-param>参数,如:
<param-value>/WEB-INF/struts-config-test.xml</param-value>
然后用wsad里的工具自动产生了名为struts-config-test.xml的新的配置文件。
可是当我在新的配置文件里配置新的action时,运行总是抛出无法找到该action的异常。
是不是我什么地方做的不对啊?
...全文
638
15
打赏
收藏
标题: struts下使用多个配置文件出错的问题!
我修改了web.xml配置,增加了参数,如: <param-value>/WEB-INF/struts-config-test.xml</param-value> 然后用wsad里的工具自动产生了名为struts-config-test.xml的新的配置文件。 可是当我在新的配置文件里配置新的action时,运行总是抛出无法找到该action的异常。 是不是我什么地方做的不对啊?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
15 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
bitou
2005-09-02
打赏
举报
回复
配置文件似乎没错,但你的访问地址应为
http://localhost:8080/上下方根/module/test/testtwo.do
HengHuan
2005-09-02
打赏
举报
回复
顶 ^_^
xloveronline
2005-08-31
打赏
举报
回复
晕!不可能的啊,别乱说啊。。。
super_zzw
2005-08-26
打赏
举报
回复
还有先把你的struts-config中的注释去掉试一下, 记得有一次我是注释出问题好像会引起找不到action
super_zzw
2005-08-26
打赏
举报
回复
看你的配置似乎没有什么问题
你去下个struts1.2版本的看看,我在用的是1.2版本的
xloveronline
2005-08-26
打赏
举报
回复
不行啊!下面是我的配置文件,大家看看有错吗:
web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp">
<display-name>testStruts</display-name>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/module</param-name>
<param-value>WEB-INF/struts-config-module.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/datetime-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-datetime.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/string-1.0.1</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-string.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/utility</taglib-uri>
<taglib-location>/WEB-INF/lib/utility.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/mailer-1.1</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-mailer.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/application-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-application.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/page-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-page.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/request-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-request.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/response-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-response.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/session-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/taglibs-session.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/i18n-1.0</taglib-uri>
<taglib-location>/WEB-INF/lib/i18n.jar</taglib-location>
</taglib>
<taglib>
<taglib-uri>jspsql</taglib-uri>
<taglib-location>/WEB-INF/lib/jspsql.jar</taglib-location>
</taglib>
<resource-ref id="ResourceRef_1122897238909">
<res-ref-name>jdbc/pagination</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
struts-config-module.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- 数据源 -->
<data-sources>
</data-sources>
<!-- 表单 Bean -->
<form-beans>
<form-bean name="testForm" type="com.maxs.test.forms.TestForm">
</form-bean>
</form-beans>
<!-- 全局异常 -->
<global-exceptions>
</global-exceptions>
<!-- 全局转发 -->
<global-forwards>
</global-forwards>
<!-- 操作映射 -->
<action-mappings>
<action path="/test/testtwo" type="com.maxs.test.actions.TestAction" name="testForm" scope="request">
<forward name="result" path="/testtwo/testResponsePage.jsp" redirect="true" contextRelative="true">
</forward>
</action>
</action-mappings>
</struts-config>
jsp如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<HEAD>
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<META http-equiv="Content-Type" content="text/html; charset=GB18030">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet"
type="text/css">
<TITLE></TITLE>
<SCRIPT language="javaScript">
function toSelect(){
with(document.forms[0])
{
submit();
}
}
</SCRIPT>
</HEAD>
<BODY>
<P>test</P>
<html:form action="/test/testtwo">
//此处提示出错:不能在下列模块的上下文中解析目标 /test/testtwo:/
test
</html:form>
<html:button property="submint" styleClass="button" onclick="toSelect()">
查询
</html:button>
</BODY>
</html:html>
dddeee
2005-08-24
打赏
举报
回复
可用分模块的方式,加一个
<init-param>
<param-name>config/test</param-name>
<param-value>/WEB-INF/struts-config-test.xml</param-value>
</init-param>
当然URL上也得加/test啊
这个可以
super_zzw
2005-08-24
打赏
举报
回复
我在用的都好好的, 你怎么就不行啦?
必须以"/"开头
在你的页面上面<html:form action="/two"...就可以了,子模块名struts会自动帮你加上去的。
forward中也一样,不过模块之间的跳转不能直接以/submoudle/function方式来跳转, 如何在模块之间跳转struts文档有说明
super_zzw
2005-08-23
打赏
举报
回复
你的访问URL对不对啊?
bob_thb
2005-08-23
打赏
举报
回复
那还能用什么方法啊,关注!
xloveronline
2005-08-23
打赏
举报
回复
对不起,这种方式我知道,我不想用这种方式!
myth822
2005-08-23
打赏
举报
回复
多个配置文件使用逗号隔开
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,/WEB-INF/struts-config-test.xml</param-value>
</init-param>
xloveronline
2005-08-23
打赏
举报
回复
是的,我也早试过了……
不行啊!
应该和url没关系啊,
对了,有个很奇怪的现象:
在struts-config-test.xml中配置action的path=“one/two”
在jsp中的写成<form action='one/two'>就提示错误,在上下文中找不到one/two……
而在struts-config-test.xml中配置forward时,输入的jsp也出现同样现象,我检查过路径是正确的……
ses127127
2005-08-23
打赏
举报
回复
楼上的方法好像不行,我试过的
lj82943421
2005-08-23
打赏
举报
回复
可用分模块的方式,加一个
<init-param>
<param-name>config/test</param-name>
<param-value>/WEB-INF/struts-config-test.xml</param-value>
</init-param>
当然URL上也得加/test啊
最近
使用
Struts
的两个小
问题
一、 今天调了很长时间的,在action里明明写了错误信息: message.add("userName", new ActionMessage("用户名密码不能为空"));在页面或 就是显示不出来,也不出异常,通过调试发现request里面也存在错误消息,一时不知如何是好. 后来四处搜索,很多人建议用: ,后来改为:页面出现异常,说属性
使用
Struts
2时出现There is no Action mapped for namespace [/] and action name [??] associated with conte
今天开始学习
Struts
2,看着视频学,在学到
Struts
2的action的配置时,遇到一个
问题
,即
标题
所示,找了一个多钟的错,才发现哪里
出错
了。 There is no Action mapped for namespace [/] and action name [****] associated with context path [/
Struts
02]. 上网搜了一下,很多新手
Struts
的数据校验
一、ActionForm的数据校验 ActionForm的代码校验是最基本的校验方式,这种校验方式是重写ActionForm的validate方法,在该方法内对所有的字段进行基本校验。如果出现不符合要求的输入则将
出错
提示封装在ActionError对象里,最后将
多个
ActionError组合成ActionErrors对象该对象里封装了全部的
出错
信息。 public c
文章
标题
之前的
warehouse.action
用为warehouse后面没有加后缀.action重定向总是
出错
说找不到action;加上后就好了,
Android客户端 与服务器端
Struts
2 通信 发生
问题
服务器端的配置是 Tomcat6+
Struts
2+Eclipse3.6 也是按照
标题
,在网上找方法,不过这个过程中,也是碰到不少
问题
的,主要就是环境的配置,痛苦... 基本上是盯着东子哥的这篇 http://www.cnblogs.com/zhangdongzi/archive/2011/04/18/2020179.html 在秋....... 讲一下大概的痛苦过程吧 首先通过Ecl...
Java EE
67,535
社区成员
225,852
社区内容
发帖
与我相关
我的任务
Java EE
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
复制链接
扫一扫
分享
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章