最近在做一个练习,基本情况如下:
1,在做一个页面时应用struts的标签库(页面已经
<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html"%>,
<%@ taglib uri="WEB-INF/struts-bean.tld" prefix="bean"%>)2,struts配置文件名称 struts-config.xml,其中都已经配置各个ActionMappings 和 ActionForm Beans,还有资源文件;3,WEB应用程序的配置文件 web.xml 其中已经配置了 struts 配置文件;(项目使用MyEclipse系统自带功能进行加入struts系统)4,是Struts 1.2版本问题,(Struts 1.1版本的一个例子倒是可以工作)
出现问题:
一个jsp页面使用struts的标签库,在 Tomcat 5.5版本中运行出错,出现提示:Can not find ActionMappings and ActionForm Beans collection我猜想是 系统没有读取到struts-config.xml 配置文件的原因吧?不知道是什么原因,但前面都已经配置了,是啥原因?(静态HTML页是能够访问的)
请高手帮看看是什么问题。,还有 struts1.1 和 struts1.2两个版本主要差别是哪里啊?哪些关键需要注意的?
1,在做一个页面时应用struts的标签库(页面已经
<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html"%>,
<%@ taglib uri="WEB-INF/struts-bean.tld" prefix="bean"%>)2,struts配置文件名称 struts-config.xml,其中都已经配置各个ActionMappings 和 ActionForm Beans,还有资源文件;3,WEB应用程序的配置文件 web.xml 其中已经配置了 struts 配置文件;(项目使用MyEclipse系统自带功能进行加入struts系统)4,是Struts 1.2版本问题,(Struts 1.1版本的一个例子倒是可以工作)
出现问题:
一个jsp页面使用struts的标签库,在 Tomcat 5.5版本中运行出错,出现提示:Can not find ActionMappings and ActionForm Beans collection我猜想是 系统没有读取到struts-config.xml 配置文件的原因吧?不知道是什么原因,但前面都已经配置了,是啥原因?(静态HTML页是能够访问的)
请高手帮看看是什么问题。,还有 struts1.1 和 struts1.2两个版本主要差别是哪里啊?哪些关键需要注意的?
解决方案 »
- 大神们求救呀,整合SSH不顺利有谁帮忙看看,神马问题。strust是1.3
- 关于html转pdf所遇到的一系列问题,求解答
- J2EE 结构问题。框架问题。
- 关于struts2中getSession()为空的问题,求助。。
- 紧急求救:tomcat不支持JS方法导出EXCEL( 毕业设计用的,急呀!)
- JSF提供的数据提供器在保存表单的时候,如何自动保存ORALCE的序列啊
- 高手们快帮我看看啊,急~~~~~~~~~~~~~~~~~在线等。。。
- 请问高手,sitemesh可以修饰ZK中.zul吗,怎么能实现呢
- Tomcat虚拟主机配置问题?请高手解答
- 请教IIS+resin,配置成功后jsp可以解析,但servlet找不到路径!
- Tomcat服务器证书配置
- 求实现swing中线程等待用户输入, 用户输入后唤醒线程
今天有点忙,明天仔细检查看下,按我把web.xml 和 struts-config.xml 看是不是对啊?我看好象没什么问题,是不是看多都乱了。:)如下看看各个文件结构:
看看下面的配置文件内容
web.xml
-------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri>http://www.mysite.com/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.mysite.com/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.mysite.com/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib></jsp-config>
</web-app>========================================================
struts-config.xml
--------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources >
<data-source key="org.apache.struts.action.DATA_SOURCE" type="org.apache.struts.util.GenericDataSource">
<set-property property="password" value="12345" />
<set-property property="minCount" value="1" />
<set-property property="maxCount" value="100" />
<set-property property="user" value="sa" />
<set-property property="driverClass" value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />
<set-property property="description" value="Connection to MS SQL 2000 DB" />
<set-property property="url" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TESTDBEmployee" />
<set-property property="readOnly" value="false" />
<set-property property="autoCommit" value="true" />
<set-property property="loginTimeout" value="10000" />
</data-source>
</data-sources>
<form-beans >
<form-bean name="loginForm" type="com.employee.struts.form.LoginForm" />
</form-beans>
<global-exceptions />
<global-forwards >
<forward name="login" path="/login.jsp" />
</global-forwards>
<action-mappings >
<action
input="/login.jsp"
name="loginForm"
path="/Login"
scope="request"
type="com.employee.struts.action.LoginAction" />
<action
input="/pages/Nodata.jsp"
path="/EmployeeList"
scope="request"
type="com.employee.struts.action.EmployeeListAction">
<set-property property="loginRequired" value="true" />
<forward name="success" path="/pages/employeeList.jsp" />
</action>
</action-mappings>
<message-resources parameter="com.employee.struts.ApplicationResources" />
</struts-config>
src
|-----com
| |-----employee
| |-----beans
| | |-----bean类
| |-----struts
| |-----ApplicationResources.properties
| |-----action
| | |-----各个Action类
| |-----forms
| | |-----各个ActionForm Bean类
|
|-----...other-------------------------------------------------------------------login.jsp大致内容
<%@ page language="java" charset="UTF-8"%>
<%@ taglib uri="http://www.mysite.com/tags/struts-html" prefix="html"%>
<%@ taglib uri="http://www.mysite.com/tags/struts-bean" prefix="bean"%>
<%
//....
%><html>
<head></head>
<body><html:form action="/login" focus="username">
<bean:message key="app.username"/><html:text property="username"></html:text>
<br>
<bean:message key="app.password"/><html:password redisplay="true" property="password"></html:password>
<br>
<html:submit property="submit" value="submit"></html:submit>
</html:form>
....
</body>
</html>帮看看上面的结构哪里出问题....真郁闷,怎么好象仅仅不认识 struts的培植文件 struts-config.xml 呢?