这也有错?帮帮忙吧!马上结帐 应该这样写吧:String Code1 = ..... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以贴出你的程序我想问题不是出在这里的另外,Code1=null的写法是否有问题,请检查! 各位兄弟:程序贴出来了,希望实现的功能是输入产品代码,失去光标自动显示产品信息,输入数量后,自动计算总价,同时自动产生一个新的空行。各位大侠,帮帮忙吧,我没分了,多谢。 <%@ page contentType="text/html;charset=gb2312"%><jsp:useBean id="bean0" scope="session" class="TpEpms.ejb.OrderDetailClient" /><jsp:useBean id="person" scope="session" class="TpEpms.ejb.PersonalClient" /><jsp:useBean id="order" scope="session" class="TpEpms.ejb.OrdersClient" /><jsp:useBean id="cust" scope="session" class="TpEpms.ejb.CustomerClient" /><jsp:useBean id="product" scope="session" class="TpEpms.ejb.ProductClient" /><HTML><style type="text/css">.title{FONT-SIZE:9pt; background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid; height: 18px; COLOR=#000000" <%--cursor: default;--%>}</style><HEAD><TITLE> add order</TITLE></HEAD><BODY><H2><FONT size="5" color="#000099" face="新宋体"><TT><U>销售订单</U></TT></FONT></H2><TABLE width="700" style="background-image : url(img/background.gif);"><TR> <TD width="88" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">订单日期</TD> <TD style="color: rgb(0,128,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)" align="center" width="146"><script language="JavaScript">today=new Date();function initArray(){this.length=initArray.arguments.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }document.write("<font color=blue>",today.getYear(),"<font color=blue>年","<font color=blue>",today.getMonth()+1,"<font color=blue>月","<font color=blue>",today.getDate(),"<font color=blue>日 </FONT>"," ");</script></TD> <TD width="68" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">订单编号</TD> <TD width="191"><INPUT TYPE="text" size="20" NAME="" value="" style="color: rgb(24,9,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)"></TD></TR><TR> <TD width="88" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">客户编号</TD> <TD width="146"><INPUT TYPE="text" size="20" NAME="" style="color: rgb(24,9,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)"></TD> <TD width="68" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">销售员</TD> <TD width="191"><INPUT TYPE="text" size="20" NAME="" style="color: rgb(24,9,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)"> </TD></TR></TABLE><%int num,i; num=(new Integer(request.getParameter("itemNum").toString())).intValue(); num++;%><form action="orderadd.jsp" method="post" id="add"><input type="hidden" id="itemNum" name="itemNum" value="<%=num%>"><div class="title" align="left" nowrap="true"> <TABLE border="0" cellspacing="1" cellpadding="1" width="80%"> <tr> <Th height="8" width="70">商品编号</Th> <Th height="8" width="70">商品名称</Th> <Th width="70" height="8">商品单价</Th> <Th width="70" height="8">数量</Th> <Th width="70" height="8">金额</Th> </tr><%String Code1;String Code2;String Num1;for(i=0;i<(num-1);i++){Num1 = "proNum" + ((new Integer(i)).toString());Code2 = "proCode" + ((new Integer(i)).toString());Code1=request.getParameter(Code2);product.findByPrimaryKey(Code1);%><tr> <td align=center width="70"><input size=10 type="text" id="proCode<%=i%>" name="proCode<%=i%>" value=<%=product.getSProdCode()%> onblur="isValid(form)"> </td> <td align=center width="70" size=10><%=product.getSProdName()%></td> <td align=center width="70"><%=product.getMProdPrice()%></td> <td align=center width="70"><input size=10 type="text" id="proNum<%=i%>" name="proNum<%=i%>" value="<%=request.getParameter(Num1)%>" onblur="isValid1(form)"> </td> <td align=center width="70"><%=product.getMProdPrice()%>*<%=request.getParameter(Num1)%></td></tr><%}if(!(Code1=null)){%><tr> <td align=center width="70"><input size=10 type="text" id="proCode<%=i%>" name="proCode<%=i%>" onblur="isValid(form)"> </td> <td align=center width="70"></td> <td align=center width="70"></td> <td align=center width="70"><input size=10 type="text" id="proNum<%=i%>" name="proNum<%=i%>" onblur="isValid1(form)"> </td> <td align=center width="70"></td></tr><%}%></TABLE></DIV></form></BODY></HTML><script language="javascript">function isValid(form) { if(form.proCode<%=i%>.value==""){ alert("don't null!"); return false;} add.submit(); } function isValid1(form) { if(form.proNum<%=i%>.value==""){ alert("please input quantity or no this product!"); return false;} if(form.proNum<%=i%>.value=="0"){ alert("please input quantity or no this product!"); return false;} add.submit(); }</script> if (!(code1 == null)) { 1、 you may define the argument like this: String Code1 = null;2、 why not write the selection sentence like this : if(Code1 != null) ? if (!(code1 == null)) { 黄黄说的对,要先把eode1初试化! : String Code1 = null agree with hyhong_h(黄黄) agree with hyhong_h(黄黄) 为什么点了开始的按扭就停不下来 swt使用中的线程问题! 请问各位高手,怎么查看我的java虚拟机内存大小? 请问“哲学家就餐问题”是个什么样的问题啊? 散分 请问如何建立一个Image对象,并导入gif,jpg,png等格式图片并显示 PASS SCJD,我要散分!!谁知道怎么把分数超过半100? 有问题请教,紧急 JAVA程序里不能正确显示汉字 如何将C++开发的OSG视景整合到Java开发的应用程序中? 急用!!! 关于SCJP的几个问题?给分
我想问题不是出在这里的
另外,Code1=null的写法是否有问题,请检查!
<%@ page contentType="text/html;charset=gb2312"%>
<jsp:useBean id="bean0" scope="session" class="TpEpms.ejb.OrderDetailClient" />
<jsp:useBean id="person" scope="session" class="TpEpms.ejb.PersonalClient" />
<jsp:useBean id="order" scope="session" class="TpEpms.ejb.OrdersClient" />
<jsp:useBean id="cust" scope="session" class="TpEpms.ejb.CustomerClient" />
<jsp:useBean id="product" scope="session" class="TpEpms.ejb.ProductClient" />
<HTML>
<style type="text/css">
.title
{FONT-SIZE:9pt;
background-color: #CCCCFF;
BORDER-RIGHT: #6B0029 1px solid;
BORDER-TOP: #E677B9 1px solid;
BORDER-LEFT: #E677B9 1px solid;
BORDER-BOTTOM: #6B0029 1px solid;
height: 18px;
COLOR=#000000"
<%--cursor: default;--%>
}
</style>
<HEAD>
<TITLE> add order</TITLE>
</HEAD>
<BODY>
<H2><FONT size="5" color="#000099" face="新宋体"><TT><U>销售订单</U></TT></FONT></H2>
<TABLE width="700" style="background-image : url(img/background.gif);">
<TR>
<TD width="88" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">订单日期</TD>
<TD style="color: rgb(0,128,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)" align="center" width="146">
<script language="JavaScript">
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
document.write("<font color=blue>",today.getYear(),"<font color=blue>年","<font color=blue>",today.getMonth()+1,"<font color=blue>月","<font color=blue>",today.getDate(),"<font color=blue>日 </FONT>"," ");</script></TD>
<TD width="68" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">订单编号</TD>
<TD width="191"><INPUT TYPE="text" size="20" NAME="" value="" style="color: rgb(24,9,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)"></TD>
</TR>
<TR>
<TD width="88" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">客户编号</TD>
<TD width="146"><INPUT TYPE="text" size="20" NAME="" style="color: rgb(24,9,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)"></TD> <TD width="68" height="8" style="FONT-SIZE:9pt;background-color: #CCCCFF; BORDER-RIGHT: #6B0029 1px solid; BORDER-TOP: #E677B9 1px solid; BORDER-LEFT: #E677B9 1px solid; BORDER-BOTTOM: #6B0029 1px solid;height: 18px; COLOR=#000000">销售员</TD>
<TD width="191"><INPUT TYPE="text" size="20" NAME="" style="color: rgb(24,9,255); border-left: medium none; border-right: medium none; border-top: medium none; border-bottom: 1pt solid rgb(5,5,5)"> </TD>
</TR>
</TABLE>
<%
int num,i;
num=(new Integer(request.getParameter("itemNum").toString())).intValue();
num++;
%>
<form action="orderadd.jsp" method="post" id="add">
<input type="hidden" id="itemNum" name="itemNum" value="<%=num%>">
<div class="title" align="left" nowrap="true">
<TABLE border="0" cellspacing="1" cellpadding="1" width="80%">
<tr>
<Th height="8" width="70">商品编号</Th>
<Th height="8" width="70">商品名称</Th>
<Th width="70" height="8">商品单价</Th>
<Th width="70" height="8">数量</Th>
<Th width="70" height="8">金额</Th>
</tr>
<%
String Code1;
String Code2;
String Num1;for(i=0;i<(num-1);i++){
Num1 = "proNum" + ((new Integer(i)).toString());
Code2 = "proCode" + ((new Integer(i)).toString());
Code1=request.getParameter(Code2);
product.findByPrimaryKey(Code1);
%>
<tr>
<td align=center width="70"><input size=10 type="text" id="proCode<%=i%>" name="proCode<%=i%>" value=<%=product.getSProdCode()%> onblur="isValid(form)"> </td>
<td align=center width="70" size=10><%=product.getSProdName()%></td>
<td align=center width="70"><%=product.getMProdPrice()%></td>
<td align=center width="70"><input size=10 type="text" id="proNum<%=i%>" name="proNum<%=i%>" value="<%=request.getParameter(Num1)%>" onblur="isValid1(form)"> </td>
<td align=center width="70"><%=product.getMProdPrice()%>*<%=request.getParameter(Num1)%></td>
</tr>
<%}
if(!(Code1=null)){
%>
<tr>
<td align=center width="70"><input size=10 type="text" id="proCode<%=i%>" name="proCode<%=i%>" onblur="isValid(form)"> </td>
<td align=center width="70"></td>
<td align=center width="70"></td>
<td align=center width="70"><input size=10 type="text" id="proNum<%=i%>" name="proNum<%=i%>" onblur="isValid1(form)"> </td>
<td align=center width="70"></td>
</tr>
<%}%>
</TABLE>
</DIV>
</form>
</BODY>
</HTML>
<script language="javascript">
function isValid(form)
{
if(form.proCode<%=i%>.value==""){
alert("don't null!");
return false;} add.submit();
}
function isValid1(form)
{
if(form.proNum<%=i%>.value==""){
alert("please input quantity or no this product!");
return false;}
if(form.proNum<%=i%>.value=="0"){
alert("please input quantity or no this product!");
return false;}
add.submit();
}
</script>
1、 you may define the argument like this: String Code1 = null;2、 why not write the selection sentence like this : if(Code1 != null) ?