html-radio.jsp

来自「Spring +Web 的完整 MyEclipse 项目源码,使用者可以作为入门」· JSP 代码 · 共 36 行

JSP
36
字号
<%@ page contentType="text/html;charset=GB2312" import="java.util.*"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<html:base/>
<title>&lt;html:radio&gt;</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body bgcolor="white">

<h1>&lt;html:radio&gt;</h1>

<p>&lt;html:radio&gt;标记生成一个单选框,示例代码如下:</p>
<font class="CodeStyle">
&lt;html:form action="/test.do"&gt;<br>
&lt;html:radio property="testRadio" value="testvalue1"/&gt;<br>
&lt;/html:form&gt;<br>
</font>

<p>它有一个value属性,用来指定当选中该单选框时ActionForm中对应的属性的值。下面是另一种单选框的用法:</p>
<font class="CodeStyle">
&lt;html:form action="/test.do"&gt;<br>
&lt;html:radio property="testRadio" value="value1"&gt;Choice1<br>
&lt;html:radio property="testRadio" value="value2"&gt;Choice2<br>
&lt;html:radio property="testRadio" value="value3"&gt;Choice3<br>
&lt;/html:form&gt;
</font>

<p>在上面的代码中,单选框一共有三个,这三个单选框组成一个单选框组,只能选取其中一个。无论选中哪一个,它的值在提交
表单后都将赋给ActionForm中相对应的属性,如果三个单选框一个都没有选中,那么该属性的值将为一个空串。</p>

<p>

<a href="index.jsp">返回主页面</a>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?