bpList是一个带泛型的list
List<bp> bpList;<s:iterator value="bpList" status="stuts">
<s:radio name = "sradio" list="price" value="50.0"></s:radio>
</s:iterator>jsp页面没有引入任何css ,执行输出后,自动带了tr,td
jsp页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<head>
<title></title>
</head>
<body>
<form action="/eo.action" id="myForm" name="myForm" method="post">
<s:iterator value="bpList" status="stuts">
<s:radio name = "sradio" list="price" value="50.0"></s:radio>
</s:iterator>
</form>
</body>
</html>页面上右键源代码
<body>
<form action="/eo.action" id="myForm" name="myForm" method="post">
<tr>
<td class="tdLabel"></td>
<td>
<input type="radio" name="sradio" id="sradio50.0" checked="checked" value="50.0"/><label for="sradio50.0">50.0</label>
</td>
</tr><tr>
<td class="tdLabel"></td>
<td>
<input type="radio" name="sradio" id="sradio60.0" value="60.0"/><label for="sradio60.0">60.0</label>
</td>
</tr>
List<bp> bpList;<s:iterator value="bpList" status="stuts">
<s:radio name = "sradio" list="price" value="50.0"></s:radio>
</s:iterator>jsp页面没有引入任何css ,执行输出后,自动带了tr,td
jsp页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<head>
<title></title>
</head>
<body>
<form action="/eo.action" id="myForm" name="myForm" method="post">
<s:iterator value="bpList" status="stuts">
<s:radio name = "sradio" list="price" value="50.0"></s:radio>
</s:iterator>
</form>
</body>
</html>页面上右键源代码
<body>
<form action="/eo.action" id="myForm" name="myForm" method="post">
<tr>
<td class="tdLabel"></td>
<td>
<input type="radio" name="sradio" id="sradio50.0" checked="checked" value="50.0"/><label for="sradio50.0">50.0</label>
</td>
</tr><tr>
<td class="tdLabel"></td>
<td>
<input type="radio" name="sradio" id="sradio60.0" value="60.0"/><label for="sradio60.0">60.0</label>
</td>
</tr>
theme:设置struts2标签的主题,默认为xhtml。
theme=xhtml时:会默认额外生成tr,td。
theme=simple时:就生成标签所对应的html标签形式。
</s:form>
这样这个form包含的标签就是普通的html就不会自动换行了