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

推荐订阅源

T
Threatpost
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
P
Proofpoint News Feed
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
C
Cisco Blogs
L
LangChain Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
量子位
AWS News Blog
AWS News Blog
爱范儿
爱范儿
Know Your Adversary
Know Your Adversary
F
Full Disclosure
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
S
Schneier on Security
Spread Privacy
Spread Privacy
P
Privacy International News Feed
人人都是产品经理
人人都是产品经理
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
Latest news
Latest news
D
Docker
Scott Helme
Scott Helme
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
The Register - Security
The Register - Security
T
Tailwind CSS Blog
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security Affairs
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Martin Fowler
Martin Fowler
I
InfoQ
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Tenable Blog

博客园 - 逍遥游

验证数字的正则表达式集 .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>