虽然struts标签不咋的,但偶尔看看耶无妨,哈,无妨。
持续更新,看一点写一点
一.一些总体原则
1.要使用标签,外层必须使用标签,不能使用html的。
2.property必须和所要提交的action对应的formbean中的某个属性相匹配(必须有一
个formbean)。
二.<html:select>的使用
1.从数据库中获得数据,在Action里面取得数据后,将数据放到Request里面
2.数据取出来后放在一个List或Collection或Map里面
3.用<html:options>或<html:optionsCollection>从List或其它的容器中取数据
4.<html:options>和<html:optionsCollection>外层必须用<html:select
property="">,所以这个属性必须在FormBean里定义。
5.例子:
<html> <body> <% List list = (List)request.getAttribute("list"); %> <html:form action="提交的action"> <html:select property="actin的formbean对应的属性"> <html:options collection="list" labelProperty="下拉框中显示的内容" property="各选项对应的值"/> </html:select> </body> </html>