Cannot find bean: "personList" in any scope我的配置文件哪錯了呢

logoyw 发布于 2012/10/18 12:00
阅读 2K+
收藏 0
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%><%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%><%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>
ID 帳號 姓名 生日 愛好 是否隱藏姓名
***


添加人員

這是我的配置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 type="org.apache.commons.dbcp.BasicDataSource">
   <set-property property="driverClassName"
    value="com.mysql.jdbc.Driver" />
   <set-property property="url"
    value="jdbc:mysql://localhost:3306/struts?characterEncoding=UTF-8" />
   <set-property property="username" value="root" />
   <set-property property="password" value="891224" />
  </data-source>
 </data-sources>

 <!-- formBean配置 -->
 <form-beans>
  <form-bean name="helloForm"
   type="com.fsm.strtus.form.HelloForm">
  </form-bean>
  <form-bean name="personForm"
   type="com.fsm.struts.form.PersonForm">
  </form-bean>
 </form-beans>

 <global-exceptions />
 <global-forwards />

 <action-mappings>
  <action attribute="personForm" input="/form/addPerson.jsp"
   name="personForm" path="/person" scope="request"
   type="com.fsm.struts.action.PersonAction">
   <forward name="success" path="/form/addPersonSuccess.jsp"></forward>
   <forward name="list" path="/form/listPerson.jsp"></forward>
  </action>
 </action-mappings>

 <message-resources
  parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>

 錯誤提示﹕

javax.servlet.jsp.JspException: Cannot find bean: "personList" in any scope

 

加载中
0
小小石子

你jsp里面有用到personList?struts-config.xml配置文件里,根本就体现不出来你有没有personList这个东西。frombean贴出来,还是有你action贴出来,才能看出来,你到底有没有把personList这个东西放到 any scope。

返回顶部
顶部