日期:2014-05-18  浏览次数:20704 次

关于在jsp中的表单处理问题
小弟是初学者,接触jsp不到一个月
现在在做一个简单的银行转账系统时碰到一个问题!
怎么获取客户端输入的转账金额的问题!
代码如下:
<%@page   contentType= "text/html;   charset=gb2312 "   pageEncoding= "gb2312 "   %>
<html>
<head>
<title> 欢迎使用网上银行 </title>
<link   rel= "stylesheet "   href= "css\style4.css "   type= "text/css "   />

</head>

<body>
<%@include   file= "head2.jsp "   %>
<form   name=transferform   action= "confirm.jsp "   method=post>
<center>
<table>
<tr>
<td> 对方账户: </td>
<td> <input   type=text   name=objectname   maxlength=19>   </td>
</tr>
<tr>
<td> 请输入转账金额: </td>
<td> <input   type=text   name=money   >   </td>
</tr>
<tr>
<td> <input   type=submit   name=submit   value= "确定 ">   </td>
<td> <input   type=reset   name=reset   value= "重新填写 "> </td>
</tr>
</table>

</center>
<input   type=hidden   name=xx     value=xx>
</form>

</body>

</html>

confirm.jsp:
<%@page   contentType= "text/html;   charset=gb2312 "   pageEncoding= "gb2312 "   %>
<%@   page   import= "java.util.Date,java.text.DateFormat "   %>
<jsp:useBean   id= "dologin "   scope= "session "   class= "log.Login1 "/>
<html>
<head>
<title> 欢迎使用网上银行 </title>
<link   rel= "stylesheet "   href= "css\style4.css "   type= "text/css "   />

</head>

<body>
<%@include   file= "head2.jsp "   %>
<center>
<table   boder=1>
<tr>
<td> 对方账户: </td>
<td> <%=request.getParameter( "objectname ")   %>   </td>
</tr>
<tr>
<td> 转账金额: </td>
<td>   <%=request.getParameter( "money ")   %>   </td>
</tr>
<tr>
<td> 交易时间: </td>
<td> <%=DateFormat.getTimeInstance().format(new   Date())%> </td>
</tr>
<tr>
<td> 交易日期: </td>
<td> <%=DateFormat.getDateInstance().format(new   Date())%> </td>
</tr>
</table>


<form   name=form1   action= "do_transfer.jsp "   method=post>
<input   type=hidden   name=username     value= <%=dologin.getUser()   %>   >
<input   type=hidden   name=objectname     value= <%=request.getParameter( "objectname ")   %> >
<input   type=hidden   name=money     value= <%=request.getParameter( "money ")   %> >
<input   type=hidden   name=time     value= <%=DateFormat.getTimeInstance().format(new   Date())%> >
<input   type=hidden   name=time