日期:2014-05-19  浏览次数:20697 次

struts2的标签,<s:radio 输出为什么自动带tr
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页面
HTML code
<!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>


页面上右键源代码
HTML code
<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>


------解决方案--------------------
包装过的,就是这样的。
------解决方案--------------------
你使用的是s标签,s标签他进行了处理,字段tr,td,应为s标签汇总有一个theme属性,theme属性包括xhtml,html,simple,ajax 。默认是xhtml 
theme:设置struts2标签的主题,默认为xhtml。 
theme=xhtml时:会默认额外生成tr,td。 
theme=simple时:就生成标签所对应的html标签形式。
------解决方案--------------------
试试在radio 标签中加上theme="simple" 属性行不行啊
------解决方案--------------------
<s:form action="/eo.action" id="myForm" name="myForm" method="post" theme="simple">
</s:form>
这样这个form包含的标签就是普通的html就不会自动换行了