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

这段代码问题在哪????
<%  
String   accout=request.getParameter( "accout ");
String   phone=request.getParameter( "phone ");
%>

<div   align=center>
<form     action= "add2.jsp "   method= "post "   name= "form1 ">
<h3> 编辑用户基本信息 </h3>
<br>
<br>
账     号: <input   type= "text "   name= "accout "   value= "
<%
if   (accout!=null&&! " ".equals(accout))
{
%>
    <%=accout%>
}
%> ">           电话: <input   type= "text "   name= "phone "   value= "
<%
if   (phone!=null&&! " ".equals(phone))
{
%>
    <%=phone%>
<%
}
%> ">
<br>
<br>

------解决方案--------------------
%> "> 电话: <input type= "text " name= "phone " value= "
%> 没有匹配的吧
------解决方案--------------------
<%
String accout=request.getParameter( "accout ");
String phone=request.getParameter( "phone ");
%>
<br>
<br>
账 号: <input type= "text " name= "accout " value= "
<%
if (null!=accout&&! " ".equals(accout))
{
%>
<%=accout%>
<%}%> "> <--这里少一个尖括号-->

电话: <input type= "text " name= "phone " value= "
<%
if (null!=phone&&! " ".equals(phone))
{
%>
<%=phone%>
<%
}
%> ">
<br>
<br>
还有一点if (accout!=null&&! " ".equals(accout))最好写成这样:if (null!=accout&&! " ".equals(accout))
这样当accout为空的时候就不会报错了。
------解决方案--------------------
if (phone!=null&&! " ".equals(phone)),你这是在判断什么呀?
------解决方案--------------------
我想这就是写代码格式不规范造成的吧!
------解决方案--------------------
<% ... %> 不匹配
------解决方案--------------------
判断的时候应该是这样吧
if (accout!=null&&!account.equals( " "))
if (phone!=null&&!phone.equals( " "))

并且在 "电话:"前面的那个%>不匹配
------解决方案--------------------
写得也太不规范了吧