---
title: "Struts 笔记 之 比较乱"
author: "namezhou"
date: "2010-07-28T22:11:16Z"
tags: ["Hibernate", "Spring", "Struts", "Web", "领域模型"]
categories: ["企业架构"]
slug: "struts"
draft: false
lastmod: "2010-07-28T22:11:16Z"
id: 723798
url: "https://namezhou.iteye.com/blog/723798"
---

domain model 领域模型 --- 核心业务 --- 不应该掺杂其他的东西  
DDD 领域驱动设计  
pattern 模式  
framwork 框架

struts  表现层  
spring 业务逻辑层  
hibernate 持久化层

手动引入struts流程

1.拷贝struts 的jar包到web-inf的lib目录  
2.在web.xml中配置ActionServlet自动启动  
3.提供struts-config.xml到web-inf目录

创建jsp 添加表单  
创建FormBean 继承ActionForm  
 创建与表单元素对应的属性，添加getter、setter  
创建Actiobe 继承Action  
编辑action 处理请求

编辑struts-config.xml  
 添加form标签  
 &lt;form-beans&gt;  
  &lt;form-bean name="xxx" type="全类名" /&gt;  
 &lt;/form-beans&gt;  
 添加action  
 &lt;action-mappings&gt;  
  &lt;action path="/login"  
  type="全类名"  
  name="处理Action的Formbean的名字"  
  scope="默认session，生成的formBean对象的作用域"  
  /&gt;  
  &lt;forward name="success" path="" /&gt;  
  &lt;forward name="error" path="" /s&gt;  
 &lt;/action-mappings&gt;