Struts---- <s:bean>标签

近几天学习的都是跟struts有关的、详细写<s:bean>标签

具体内容为:

一、准备工作

 1.新建Web工程

 2.添加struts:右键点击工程名选择My Eclipse-->点击add struts..-->添加struts2.1

二、编写程序

1.分别建Action,org.vo两个包(名字可自拟),并在其中编写student实体类和BeanAction。BeanAction中一定要重写方法

2.Struts中要写如下代码:

<package name="default" extends="struts-default">
<action name="login" class="Action.BeanAction">
<result name="success">index.jsp</result>
</action>
</package>

3.写出jsp代码

三、注意事项

1.在运行代码时不能直接运行C层

2.在浏览器输出http://localhost:8080/Struts/login.action

3.在jsp页面中必须有<%@ taglib uri="/struts-tags" prefix="s" %>这句话

  心得与得会:在写代码的过程中 不懂一定要问同学与老师,不要自己不会就闷着,不会也要去看别人怎么做,在学习完别个的之后 不要自己抄好就好了,还要重新写过代码,多写几次就渐渐掌握方法。

posted @ 2016-03-29 14:52  张学玲  阅读(291)  评论(0编辑  收藏  举报