这样:
<html:select property="customerType">
<html:option value="Robert">Robert</html:option>
<html:option value="Bob">Bob</html:option>
</html:select>
<html:select property="customerType">
<html:option value="Robert">Robert</html:option>
<html:option value="Bob">Bob</html:option>
</html:select>
解决方案 »
- 如何把SQLServer数据库改成MySQL的
- java如何根据后台添加信息生成前台html页面
- 房地产系统
- Informix 哪里下载啊?
- 无法打开jsp页面
- 我要放一个按钮,一点击就超链接到另一个页面,而不是新弹出来一个页面,紧急求购代码!!!!
- 如何用JavaBean实现文件上载?
- 写了个计数器bean,jsp中调用显示正确的数字,而直接打开储存数字的txt文件却看不到数字,这是为什么??
- tomcat sprngmvc druid 连接mysql 问题,求大神帮忙看看
- jsp页面调用ACTION进行初始化死循环怎么解
- 如何将String字符传转换成 int 数组
- 菜鸟紧急求助如何往数据库中写一个日期(急)(这个问题高手不会觉得难得)
即:<html:form action="select.do">
<html:select property="customerType">
<html:option value="Robert">Robert</html:option>
<html:option value="Bob">Bob</html:option>
</html:select>
</html:form>
然后再建一个该form的actionForm,在其中包含变量customerType的get,set方法对即可。
public class select extends ActionForm {
private String customerType = null;
public String getCustomerType() {
return customerType;
} public void setCustomerType(String c) {
this.customerType = c;
}
}
public String getCustomerType() {
return this.customerType;
}
public void setCustomerType(String aCustomerType) {
this.customerType = aCustomerType;
}
/ccs/error/error.jsp was not found on this server.
--------------------------------------------------------------------------------
Resin 2.1.12 (built Tue Dec 9 14:58:25 PST 2003)
language = "java"
import = "com.kline.util.*"
contentType = "text/html; charset = gb2312"
%><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><html><head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<title>CustomerEdit</title>
<link rel="stylesheet" href="include/style.css" type="text/css">
</head><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align=location> <a href="main.htm">CCS</a> >> <a href="CustomerMgt.htm">Customer
Management </a> >> <a href="CustomerList.htm">Customer</a> >> New/Edit
<hr><br>
</td>
</tr>
<tr>
<td>
<html:form method="post" action="customerAction.do">
<html:hidden property="action"/>
<table width="100%" border=1 cellpadding="0" cellspacing="0">
<tr>
<td width="20%" align=left class="fieldName">Code</td>
<td align=left width="30%">
<html:text property="customerCode"/>
</td>
<td align=left width="20%" class="fieldName">Type</td>
<td align=left width="30%">
<html:select property="customerType"/>
<html:option value="Robert">Robert</html:option>
<html:option value="Bob">Bob</html:option>
</html:select>
<!--<option value="DEPOT">DEPOT</option>
<option value="AGENT">AGENT</option>
</select>-->
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Name </td>
<td align=left height="32" colspan="3">
<html:text property="customerName"/>
</td>
</tr>
<tr bgcolor="#33CCCC">
<td align=left height="32" colspan="4"><font color="#FFFFFF"><b>Registration Info.</b></font></td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Address</td>
<td align=left height="32" colspan="3">
<html:text property="customerAddress"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">City</td>
<td align=left height="32">
<html:text property="customerCity"/>
</td>
<td align=left height="32" class="fieldName">Province</td>
<td align=left height="32">
<html:text property="customerProvince"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Country</td>
<td align=left height="32">
<html:text property="customerCountry"/>
</td>
<td align=left height="32" class="fieldName">Zip</td>
<td align=left height="32">
<html:text property="customerZip"/>
</td>
</tr>
<tr bgcolor="#33CCCC">
<td align=left height="32" colspan="4"><b><font color="#FFFFFF">Shipping
Info.</font></b></td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Address</td>
<td align=left height="32" colspan="3">
<html:text property="customerAddress1"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">City</td>
<td align=left height="32">
<html:text property="customerCity1"/>
</td>
<td align=left height="32" class="fieldName">Province</td>
<td align=left height="32">
<html:text property="customerProvince1"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Country</td>
<td align=left height="32">
<html:text property="customerCountry1"/>
</td>
<td align=left height="32" class="fieldName">Zip</td>
<td align=left height="32">
<html:text property="customerZip1"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Account No.(RMB)</td>
<td align=left height="32">
<html:text property="customerRMB"/>
</td>
<td align=left height="32" class="fieldName">Account No.(USD)</td>
<td align=left height="32">
<html:text property="customerUSD"/>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <br>
<html:submit property="Save" value="Save"/>
<html:cancel property="Cancel" value="Cancel"/>
</td>
</tr>
</table>
</html:form>
</td>
</tr>
</table>
</body>
</html>
<html:option value="Bob">Bob</html:option>
</html:select>
只要我把这个去掉,就一点问题都没有!这是怎么回事呀?大哥,一定要帮我呀!
改成
<html:select property="customerType">
<html:option value="Robert">Robert</html:option>
<html:option value="Bob">Bob</html:option>
</html:select>
中的第一行错了,最后多了一个斜杠,应该为<html:select property="customerType">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><html><head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<title>CustomerEdit</title>
<link rel="stylesheet" href="include/style.css" type="text/css">
</head><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align=location> <a href="main.htm">CCS</a> >> <a href="CustomerMgt.htm">Customer
Management </a> >> <a href="CustomerList.htm">Customer</a> >> New/Edit
<hr><br>
</td>
</tr>
<tr>
<td>
<html:form method="post" action="customerAction.do">
<html:hidden property="action"/>
<table width="100%" border=1 cellpadding="0" cellspacing="0">
<tr>
<td width="20%" align=left class="fieldName">Code</td>
<td align=left width="30%">
<html:text property="customerCode"/>
</td>
<td align=left width="20%" class="fieldName">Type</td>
<td align=left width="30%">
<html:select property="customerType"/>
<html:option value="Robert">Robert</html:option>
<html:option value="Bob">Bob</html:option>
</html:select>
<option value="DEPOT">DEPOT</option>
<option value="AGENT">AGENT</option>
</html:select>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Name </td>
<td align=left height="32" colspan="3">
<html:text property="customerName"/>
</td>
</tr>
<tr bgcolor="#33CCCC">
<td align=left height="32" colspan="4"><font color="#FFFFFF"><b>Registration Info.</b></font></td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Address</td>
<td align=left height="32" colspan="3">
<html:text property="customerAddress"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">City</td>
<td align=left height="32">
<html:text property="customerCity"/>
</td>
<td align=left height="32" class="fieldName">Province</td>
<td align=left height="32">
<html:text property="customerProvince"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Country</td>
<td align=left height="32">
<html:text property="customerCountry"/>
</td>
<td align=left height="32" class="fieldName">Zip</td>
<td align=left height="32">
<html:text property="customerZip"/>
</td>
</tr>
<tr bgcolor="#33CCCC">
<td align=left height="32" colspan="4"><b><font color="#FFFFFF">Shipping
Info.</font></b></td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Address</td>
<td align=left height="32" colspan="3">
<html:text property="customerAddress1"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">City</td>
<td align=left height="32">
<html:text property="customerCity1"/>
</td>
<td align=left height="32" class="fieldName">Province</td>
<td align=left height="32">
<html:text property="customerProvince1"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Country</td>
<td align=left height="32">
<html:text property="customerCountry1"/>
</td>
<td align=left height="32" class="fieldName">Zip</td>
<td align=left height="32">
<html:text property="customerZip1"/>
</td>
</tr>
<tr>
<td align=left height="32" class="fieldName" width="19%">Account No.(RMB)</td>
<td align=left height="32">
<html:text property="customerRMB"/>
</td>
<td align=left height="32" class="fieldName">Account No.(USD)</td>
<td align=left height="32">
<html:text property="customerUSD"/>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <br>
<html:submit property="Save" value="Save"/>
<html:cancel property="Cancel" value="Cancel"/>
</td>
</tr>
</table>
</html:form>
</td>
</tr>
</table>
</body>
</html>