- 爱易网页
-
Java教程
- JSP小疑点,本页JSP处理form表单出错
日期:2014-05-18 浏览次数:20837 次
JSP小问题,本页JSP处理form表单出错求助
一个JSP页面里有个form表单,其响应可以用本jsp来响应吧,当然里面有相应的Scriptlet
如下代码:
<%@ page language= "java " import= "java.util.* "%>
<%@ page contentType= "text/html; charset=GBK "%>
<%!ArrayList list = null;%>
<%!public ArrayList addUser(String userName, String userIdcard) {
ArrayList ls = new ArrayList();
ls.add(userName);
ls.add(userIdcard);
return ls;
}%>
<%!public String tdUserName() {
String u = " ";
for (int i = 0; i < list.size(); i++) {
if (i % 2 == 0) {
u = list.get(i).toString();
}
}
return u;
}%>
<%!public String tdUserIdCard() {
String uc = " ";
for (int i = 0; i < list.size(); i++) {
if (i % 2 == 1) {
uc = list.get(i).toString();
}
}
return uc;
}%>
<%!public String tdUserBd() {
String idCard = tdUserIdCard();
String bd = idCard.substring(6, 10) + "- " + idCard.substring(10, 12)
+ "- " + idCard.substring(12, 14);
return bd;
}%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> My JSP 'uidConvert.jsp ' starting page </title>
<meta http-equiv= "pragma " content= "no-cache ">
<meta http-equiv= "cache-control " content= "no-cache ">
<meta http-equiv= "expires " content= "0 ">
<meta http-equiv= "keywords " content= "keyword1,keyword2,keyword3 ">
<meta http-equiv= "description " content= "This is my page ">
<!--
<link rel= "stylesheet " type= "text/css " href= "styles.css ">
-->
</head>
<body>
<form action= "uidConvert.jsp " method= "post ">
<table width= "400 " border= "0 " align= "center ">
<tbody>
<tr>
<td>
姓 名:
</td>
<td>
<input name= "Uname ">
</td>
</tr>
<tr>
<td>
身份证号码:
</td>
<td>
<input name= "Uidc ">
</td>
</tr>
<tr>
<td>
</td>
<td>