用Eclipse开发Struts实例-GuestBook(1)

一、开发环境
1 MyEclipse6.0
2 Java EE 5.0
3 MS SQL2000
二、数据库表
 
三、建立数据库连接池
1 、修改 Context.xml 文件
<?xml version='1.0' encoding='gb2312'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.    See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.    You may obtain a copy of the License at
    
  [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
    
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context reloadable="true">
  <!-- Default set of monitored resources -->
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <!-- Uncomment this to disable session persistence across Tomcat restarts -->
  <!--
    <Manager pathname="" />
  -->
  <!-- Uncomment this to enable Comet connection tacking (provides events
    on session expiration as well as webapp lifecycle) -->
  <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
  -->
  <!--
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Resource name="jdbc/oracleds" auth="Container" type="javax.sql.DataSourece" maxActive="100" maxIdle="30" maxWait="10000" username="sa" password="password" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ora9">
    
  -->
  <!--     
    配置数据库连接池需要加入以下数据库对象
    name:数据源的名字
    auth="Container":验证方式为容器验证
    type="javax.sql.DataSource":数据库类型
    username:用户名
    password:密码
    driverClassName:驱动名称
    url:地址
  -->
  <Resource name="jdbc/mssqlds" auth="Container"
    type="javax.sql.DataSource" maxIdel="30" maxWait="10000"
    maxActive="10" username="meixin" password="123456"
    driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    url="jdbc:microsoft:sqlserver://localhost:1433" />
</Context>
2 、将数据库的驱动拷贝到容器的 lib 目录下
四、建立用于保存的 FormBean Action
以下选择 DynaValidatorForm 是为了用 struts Form 进行验证
 
以下设置让 IDE 帮我们生成 JSP 页面
建立 Action ,默认,不需要修改
 

你可能感兴趣的:(struts,职场,休闲)