foolish
2006-08-31 10:17:55 UTC
<%
String back_check[]=request.getParameterValues("yron");
String back_ins_no[]=request.getParameterValues("ins_no");
[-----------]String back_check[]=request.getParameterValues("yron");
String back_ins_no[]=request.getParameterValues("ins_no");
這種寫法,不是翻到了古書。就是之前在學別的語言轉不過來XD
String[] foo的寫法比較好,也不會因為不同的ide出現不同莫名奇妙的error
int i;
[----] 如果沒有特殊用途,local value儘量一開始就初始可以寫在for之中 for(int i=0;...........)
int size=9;
for(i=0;i<size;i++)
{
if(back_check[i].equals("checked"))
[-----------] 你有把握每一個element都不是null嗎?for(i=0;i<size;i++)
{
if(back_check[i].equals("checked"))
null的reference是不能被呼叫的。
來個簡單的實驗
public class NullCall {
public static void main(String[] args) {
String x = null;
x.equals("3");
}
}
=============================================
Exception in thread "main" java.lang.NullPointerException
at NullCall.main(NullCall.java:4)
{
out.println("back_ins_no[i]");
}
}
%>
==========================================
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /Management/do.jsp:15
12: int size=9;
13: for(i=0;i<size;i++)
14: {
15: str=back_check[i];
16: if(str.equals("checked"))
17: {
18: out.println("back_ins_no[i]");
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
org.apache.jsp.Management.do_jsp._jspService(do_jsp.java:61)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
========================================================================
請教各位前輩該怎麼解決,另外還有個問題..就是arrary的陣列個數要如何取得?
感謝大家!
*大驚*out.println("back_ins_no[i]");
}
}
%>
==========================================
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /Management/do.jsp:15
12: int size=9;
13: for(i=0;i<size;i++)
14: {
15: str=back_check[i];
16: if(str.equals("checked"))
17: {
18: out.println("back_ins_no[i]");
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
org.apache.jsp.Management.do_jsp._jspService(do_jsp.java:61)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
========================================================================
請教各位前輩該怎麼解決,另外還有個問題..就是arrary的陣列個數要如何取得?
感謝大家!
array是java最初級物件了他有一個屬性是存長度的length
快找書去認識一下吧
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.17 logs.
--------------------------------------------------------------------------------
--Tomcat/5.5.17 logs.
--------------------------------------------------------------------------------
[1;32m※ Origin: [33mSayYA 資訊站 [37m<bbs.sayya.org> [m
[1;31m◆ From: [36m163.26.34.247[m