惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
T
The Blog of Author Tim Ferriss
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
爱范儿
爱范儿
GbyAI
GbyAI
H
Help Net Security
I
InfoQ
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
P
Privacy & Cybersecurity Law Blog
A
Arctic Wolf
Know Your Adversary
Know Your Adversary
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tor Project blog
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
WordPress大学
WordPress大学
V
Visual Studio Blog
博客园_首页
G
GRAHAM CLULEY
K
Kaspersky official blog
T
Tailwind CSS Blog
T
Threat Research - Cisco Blogs
博客园 - Franky
D
Docker
Security Latest
Security Latest
I
Intezer
有赞技术团队
有赞技术团队
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 【当耐特】
B
Blog RSS Feed
T
The Exploit Database - CXSecurity.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 逍遥游

验证数字的正则表达式集 .NET实现RSS格式文件 - 逍遥游 - 博客园 SQL SERVER 2005 通过链接服务器 访问 ORACLE 9i 的快速设定方法 [转]asp.net页面缓存技术 - 逍遥游 - 博客园 Oracle常用Script [整理]如何在 JavaScript 中实现拖放 [转]鼠标拖动层的javascript脚本 [转]Spring笔记 [转]web项目经理手册-项目经理需要铭记在心的话 [转]Request.UrlReferrer详解 [转]hibernate产生自动增长的主键 JSP学习相关链接 C#中如何动态运行代码 .net 资源网站收集 一个很COOL的图片验证码程序[含源码] 转 关于XMLHTTP无刷新数据获取和发送 (转) .NET中获取客户端HTML代码 使用Hibernate、Struts的一些错误总结 [转]简单好用的ajax进度条(xmlhttp),实现的是真正的进度
[原]学习Struts+Spring+hibernate笔记
逍遥游 · 2007-06-29 · via 博客园 - 逍遥游

步骤:
一、创建WEB工程。
二、导入Struts。
三、加载Filters,SetCharacterEncodingFilter.java,在Tomcat 6.0\webapps\examples\WEB-INF\classes\filters目录下有,
Web.xml中配置
<filter>
    <filter-name>Set Character Encoding</filter-name>
    <filter-class>com.ssh.filters.SetCharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>GBK</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>Set Character Encoding</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
四、加载Spring

五、加载hibernate
关联相关的数据源,
//applicationContext.xml
 <bean id="dataSource"
  class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName">
   <value>oracle.jdbc.driver.OracleDriver</value>
  </property>
  <property name="url">
   <value>jdbc:oracle:thin:@101.14.12.201:1521:orcl</value>
  </property>
  <property name="username">
   <value></value>
  </property>
  <property name="password">
   <value></value>
  </property>
 </bean>

<bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.Oracle9Dialect
    </prop>
   </props>
  </property>
  <property name="mappingResources">
   <list>
    <value>com/ssh/Person.hbm.xml</value></list>
  </property></bean>

六、创建DAO
//applicationContext.xml
<bean id="PersonDAO" class="com.ssh.PersonDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
七、配置Action
//applicationContext.xml
 <bean name="/person" class="com.ssh.struts.action.PersonAction"
  abstract="false" singleton="false" lazy-init="default"
  autowire="default" dependency-check="default">
  <property name="persondao">
   <ref bean="PersonDAO"/>
  </property>
 </bean>
//struts-config.xml
<action
      attribute="personForm"
      input="/personInsert.jsp"
      name="personForm"
      path="/person"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy">
      <forward name="failure" path="/personInsert.jsp" />
      <forward name="ok" path="/index.do" />
    </action>