struts 1.x的配置步骤:
1.加载lib目录下的所有的包,最好把源文件绑定到jar包上
2.在web.xml中配置ActionServlet
3.写一个struts-config.xml文件,用它自带的例子,拷贝到WEB-INF目录下
4.写Action,并继承MappingDispatchAction 在其中覆写execute方法:
public ActionForward xxxx(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServetResponse response) throws Exception{}
5.写一个 ActionForm 在里面添加与表单相同name属性相同名字的属性。 一定要有get 和set方法
6.在struts-config.xml配置ActionForm
<form-bean name="loginForm" //自己起的名字
type="包名.类名"/> //也就是类的全名
7.在struts-config.xml中配置Action
<action
path=" 路径" //要与表单的action或者连接的路径相同
name=" " //上面定义的用于封装表单的form的名字
type=" " //acion 类的全名
parameter=" " //指定执行的方法
>
<forward name="success" path="/index.jsp"/>
</action>
8.完成Action类中相应方法的内部逻辑