---
title: "利用struts,spring,hibernate编写的一个案例分析—说明"
author: "haose"
date: "2008-07-24T13:27:36Z"
tags: []
slug: "struts-spring-hibernate"
draft: false
lastmod: "2008-07-24T13:27:36Z"
id: 219027
url: "https://haose.iteye.com/blog/219027"
---

**环境说明：**  
为了方便你的开发，开发工具最好也选用eclipse-jee 3.3版本，运行环境为Tomcat5.5版本，jdk的版本是1.5，数据库为mysql5.0 **中文乱码问题说明：**  
项目编码为utf-8，pageEncoding在jsp中已经全部设置为utf-8（所以不需要你关心），数据库编码是要采用utf-8（过会说明），另外tomcat下的conf下server.xml中需要修改如下：  
&lt;Connector port=”8080″ maxHttpHeaderSize=”8192″  
maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″  
enableLookups=”false” redirectPort=”8443″ acceptCount=”100″  
connectionTimeout=”20000″ disableUploadTimeout=”true” URIEncoding=”UTF-8″/&gt;     ——–》追加了这个 URIEncoding=”UTF-8″ **数据库说明：**  
在src\\resources\\hibernate.properties 是数据库的相关定义，现说明如下：  
hibernate.connection.url=jdbc:mysql://localhost:3306/haose?useUnicode=true&characterEncoding=utf8  
说明：数据库的url，这里定义数据库名为**haose**，你在mysql下建立对应的数据库haose就可以了，数据库的编码需要为utf-8  
hibernate.connection.username=haose ———–用户名  
hibernate.connection.password=haose  ———–密码  
用户名、密码，自己在数据库中设置，也可以使用默认用户和密码修正hibernate.properties即可

hibernate.hbm2ddl.auto = update      ————设置为 update，则系统运行时自动在你建立的数据库jzy中创建表  
所以你只要建立数据库，表不需要参与建立

**Email说明：**  
在src\\resources\\mail.properties 是email的相关定义，现说明如下：  
mail.host=smtp.sina.com.cn    ———–邮件服务器，这边使用的是sina的smtp  
mail.port=25                           ———–默认  
mail.username=邮件用户名 ———–邮件的帐户  
mail.password=邮件密码 ———–邮件的密码

你可以申请一个免费的sina邮件，来设置上面的帐号和密码  
同时在om.iplan.portal.util.Constants  
&lt;script type="text/javascript"&gt;&lt;!-- D(\["mb","\\u003c/u\\&gt;\\u003c/font\\&gt;类中，\\u003cfont color\\u003d\\&#8221;#3333ff\\&#8221;\\&gt;\\u003cu\\&gt;SYSTEM\_MAILBOX\\u003c/u\\&gt;\\u003c/font\\&gt;也需要修改成你申请的邮件帐号，看下代码\\u003cbr\\&gt; \\u003cbr\\&gt;\\u003cbr\\&gt;\\u003cstrong\\&gt;\\u003cfont color\\u003d\\&#8221;#3333ff\\&#8221;\\&gt;\\n附件中的 模拟系统.xls 是系统中有个批处理所需要用到的，这里只有一条数据\\u003cWBR\\&gt;，可以多加几条。sjbs044\_s.jpg是数据的一部分\\u003c/font\\&gt;\\u003c/strong\\&gt;\\u003cbr\\&gt;\\u003cbr\\&gt;\\n&#8221;,0] ); //&#8211;&gt; // &#8211;&gt; // &#8211;&gt; // &#8211;&gt;&lt;/script&gt;  
类中，SYSTEM\_MAILBOX也需要修改成你申请的邮件帐号，看下代码，自己修正一下

另外，在系统的功能“批处理”中，上载Excel数据的Excel模板没有提供，可以先录入部分商品数据后，使用下载DB数据的功能，就可以得到一份Excel数据了。

更多详情请参见：[我的博客 我的生活](http://www.hao-se.cn)