为什么会报空指针?好奇怪! [问题点数:20分,结帖人z469571695]

Bbs1
本版专家分:20
结帖率 100%
Bbs4
本版专家分:1624
Blank
红花 2016年11月 移动开发大版内专家分月排行榜第一
Bbs1
本版专家分:20
为什么log会报空指针异常错误?
我在编写添加背景音乐的程序时,参考了这里的代码http://apps.hi.baidu.com/share/detail/18496230rnrn我的工程中有两个类,一个是music类,继承activity,另一个是musicServer类,集成service。music类如下:rn[code=Java]package mx.music;rnrnimport android.app.Activity;rnimport android.content.Intent;rnimport android.os.Bundle;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.widget.Button;rnrnpublic class music extends Activity rn /** Called when the activity is first created. */rn rn [color=#FF0000]private Intent intent = new Intent("mx.music.MUSIC");[/color]rn private Button startButton;rn private Button stopButton;rn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn startButton = (Button) findViewById(R.id.startButton);rn stopButton = (Button) findViewById(R.id.stopButton);rn startButton.setOnClickListener(new startListener());rn stopButton.setOnClickListener(new stopListener());rn rn rn rn rn class startListener implements OnClickListenerrnrn public void onClick(View v) rn // TODO Auto-generated method stubrn [color=#FF0000] startService(intent);[/color]rn rn rn rn rn class stopListener implements OnClickListenerrnrn public void onClick(View v) rn // TODO Auto-generated method stubrn [color=#FF0000]stopService(intent);[/color]rn rn rn rn rn @Overridern protected void onPause() rn // TODO Auto-generated method stubrn super.onPause();rn rn rn rn rn rn rnrn[/code]rnrnmusicserver类如下:[code=Java]rnpackage mx.music;rnrnimport android.app.Service;rnimport android.content.Intent;rnimport android.media.MediaPlayer;rnimport android.os.IBinder;rnrnpublic class musicServer extends Servicernrn private MediaPlayer mp;rn @Overridern public IBinder onBind(Intent arg0) rn // TODO Auto-generated method stubrn return null;rn rn @Overridern public void onStart(Intent intent, int startId) rn // TODO Auto-generated method stubrn super.onStart(intent, startId);rn if(mp==null)rn mp=MediaPlayer.create(this, R.raw.mmp);rn [color=#FF0000]mp.start();[/color]/*显示这里<em>空指针</em>异常,但是我在上句都已经定义了啊,并且在raw中存在mmp的MP3文件*/rn rn rn @Overridern public void onDestroy() rn // TODO Auto-generated method stubrn super.onDestroy();rn mp.stop();rn rn rn rnrnrn[/code]
listview下滑会报空指针
package jp.co.tre.pacer.shelfcheck;rnrnimport java.util.ArrayList;rnimport java.util.HashMap;rnimport java.util.List;rnrnimport jp.co.tre.pacer.shelfcheck.R;rnimport jp.co.trejapan.pacer.android.activity.PacerMainActivity;rnimport jp.co.trejapan.pacer.android.ui.FooterAdapter;rnimport android.content.Context;rnimport android.content.Intent;rnimport android.os.Bundle;rnimport android.view.LayoutInflater;rnimport android.view.View;rnimport android.view.ViewGroup;rnimport android.view.View.OnClickListener;rnimport android.widget.AdapterView;rnimport android.widget.AdapterView.OnItemClickListener;rnimport android.widget.ListView;rnimport android.widget.TextView;rnrnpublic class NewShelfReferActivity extends PacerMainActivity rn private List> list = new ArrayList>(); // 声明列表容器rn private HashMap item1 = new HashMap();rn private ListAdapter dataAdapter;rn private ListView listView;rn private TextView title;rn private int selectedPosition = 0;rnrn @Overridern public void onCreate(Bundle savedInstanceState) rnrn super.onCreate(savedInstanceState);rn setContentView(R.layout.shelf_refer);rn titleLayout.setTitleText(getString(R.string.title_name));rn pageinit();rn listInit();rn setFooterStyle();rn rnrn public void pageinit() rn listView = (ListView) findViewById(R.id.mylist_refer);rn title = (TextView) findViewById(R.id.title1);rn Intent intent = getIntent();rn String name = intent.getStringExtra("name");rn title.setText(name);rn for (int i = 0; i < 10; i++) rn HashMap skt = new HashMap();rn skt.put("name", "lll" + i);rn skt.put("id", "8101" + i);rn list.add(skt);rn rn rnrn public void listInit() rnrn dataAdapter = new ListAdapter(NewShelfReferActivity.this, list,rn R.layout.list_shelf_refer, new String[] "name", "id" ,rn new int[] R.id.shelfname, R.id.shelfno ) rn class ViewHolder rn TextView sname;rn TextView sno;rn rnrn public View getView(final int position, View convertView,rn ViewGroup parent) rn ViewHolder holder = null;rn View view = convertView;rn if (view == null) rn LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);rn view = inflater.inflate(R.layout.list_shelf_refer, null,rn false);rn holder = new ViewHolder();rn holder.sname = (TextView) view.findViewById(R.id.shelfname);rn holder.sno = (TextView) view.findViewById(R.id.shelfno);rnrn else rn holder = (ViewHolder) view.getTag();rn rn HashMap record = list.get(position);rn holder.sname.setText(record.get("name"));rn holder.sno.setText(record.get("id"));rn dataAdapter.notifyDataSetChanged();rn return view;rn rnrn ;rnrn listView.setAdapter(dataAdapter);rn listView.setOnItemClickListener(new OnItemClickListener() rnrn @Overridern public void onItemClick(AdapterView arg0, View arg1, int arg2,rn long arg3) rn selectedPosition = arg2;rn item1 = list.get(selectedPosition);rn Intent intent = new Intent();rn intent.setClass(NewShelfReferActivity.this,rn NewShelfLoginActivity.class);rn intent.putExtra("name", item1.get("name"));rn intent.putExtra("id", item1.get("id"));rn startActivity(intent);rnrn rn );rn rnrn // btn定义rn private void setFooterStyle() rn String[] btnText = new String[4];rn btnText[0] = getString(R.string.back);rn btnText[1] = "";rn btnText[2] = "";rn btnText[3] = "";rnrn OnClickListener[] listenner = new OnClickListener[4];rn listenner[0] = new OnClickListener() rnrn @Overridern public void onClick(View v) rn finish();rn System.exit(0);rn rn ;rnrn listenner[1] = new OnClickListener() rnrn @Overridern public void onClick(View v) rn rn ;rn listenner[2] = null;rn listenner[3] = new OnClickListener() rnrn @Overridern public void onClick(View arg0) rn // TODO Auto-generated method stubrnrn rnrn ;rn FooterAdapter adapter = new FooterAdapter(this, btnText, listenner);rn footer.setAdapter(adapter);[code=java][/code]rnrn rnrn
明明有数据为什么会报空指针
[img=https://img-bbs.csdn.net/upload/201610/11/1476177616_50042.png][/img]rn非计算机系新手求指导
我的这段java代码为什么会报空指针
这是学生类package com.lianxi.com;public class Student{private int on;   //学生编号private String name;   //学生名字private int age;   //年龄private double java;  //java成绩private double C;   //c语言成绩private double HTM...
奇怪,询问为什么
我用access创建了一个数据源,里面建立了三个表,当我用ADO进行连接时,头两个表都连接正确,但当连接第三个表时,编译通过了,一运行就报错。我的连接和前面两个表的方式一模一样,请问这是什么原因?
奇怪~好奇怪~~~~
private void Page_Load(object sender, System.EventArgs e)rnrn ......rnrn textbox1.text="hello";rnrn ......rnrnrnprivate void button_click(object sender, System.EventArgs e)rnrn ......rnrn string temp=textbox1.textrn rn ......rnrnrn运行aspx后更改textbox1中的值,点击按钮后触发button_click,但是temp还是"hello",我搞不定呀~~~~这里不会还要象VC里面UpdateData一下吧???快来帮我一把~~~
局域网好奇怪奇怪奇怪奇怪奇怪奇怪的一个问题
一个局域网,其中Win2000 Server 做服务器共享上网,其他机器通过这机器上网。但是最近经常出现一个问题:其他机器都能上网,但是在网上邻居就是看不到其他计算机。这是怎么回事?
帮忙看看为什么运行TestRun会报空指针错误
[code=Java]package test;rnrnpublic class TestRunrnrn private static final String[] myTest = "aaa","bbb","ccc","ddd","eee";rnrn public static void main(String[] args)rn rn String[] test = "aa","bb","cc","dd","ff";rn TestManager ttt = TestManager.getInstance();rn for(int i = 0;i < test.length;i ++)rn rn System.out.println("test"+i+"="+test[i]);rn rn ttt.cacheFormat(test);rn String dfsd = ttt.getString("aa");rn System.out.println("dfsd = " + dfsd);rn rnrn rnrn[/code]rnrn[code=Java]package test;rnrnimport java.util.Hashtable;rnrnpublic class TestManagerrnrn private static TestManager instance = new TestManager();rn private static Hashtable imageCache = null;rn private TestManager()rn rn imageCache = new Hashtable();rn System.out.println("缓存器初始化完毕");rn rn public static TestManager getInstance()rn rn return instance;rn rn public void cacheFormat(String[] names)rn rn for(int i = 0;i < names.length;i ++)rn rn //imageCache.put(names[i], "我是" + i + "号");rn imageCache.put(names[i], names[i]);rn rn rn rn public String getString(String name)rn rn String tm = null;rn if(imageCache.get(name) == null)rn rn imageCache.put(name, "我式特");rn tm = "我式特";rn elsern rn tm = (String)imageCache.get(name);rn rn return tm;rn rnrn[/code]rnrn
为什么空指针
<em>空指针</em>就是没有实例化,要new对象才能调用对象的方法!!!
奇怪的JSP页面空指针错误
我原来的一个WEB项目现在重新运行居然报<em>空指针</em>错误,不管什么JSP页面都无法运行。(struts2+spring+hibenate) 于是新建一个空的JSP页面0k.jsp 运行时也出现<em>空指针</em>错误,错误如下:rn严重: Servlet.service() for servlet jsp threw exceptionrnjava.lang.NullPointerExceptionrn at org.apache.jsp.ok_jsp._jspInit(ok_jsp.java:22)rn at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)rn at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:248)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:72)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn2009-3-5 10:48:30 org.apache.catalina.core.ApplicationDispatcher invokern严重: Servlet.service() for servlet jsp threw exceptionrnjava.lang.NullPointerExceptionrn at org.apache.jsp.common.uncaughtException_jsp._jspInit(uncaughtException_jsp.java:22)rn at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)rn at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)rn at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)rn at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)rn at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)rn at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)rn at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn2009-3-5 10:48:30 org.apache.catalina.core.StandardHostValve customrn严重: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/common/uncaughtException.jsp]rnorg.apache.jasper.JasperException: java.lang.NullPointerExceptionrn at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)rn at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)rn at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)rn at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)rn at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)rn at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnCaused by: java.lang.NullPointerExceptionrn at org.apache.jsp.common.uncaughtException_jsp._jspInit(uncaughtException_jsp.java:22)rn at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)rn at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)rn ... 19 morern各位大侠,这是<em>为什么</em>啊!在线等待。。。。
奇怪空指针问题
应用服务器:WEBSPHERErn每次重启服务后,第一次登陆时(到数据库里核实用户号和密码),总是出错,后台提示:rn00000034 ServletWrappe E SRVE0068E: 未捕获到 servlet /main.jsp 的其中一个服务方法中抛出的异常。rn抛出的异常:java.lang.NullPointerExceptionrn可是我仔细核查了main.jsp的代码,没有<em>空指针</em>问题。rn更<em>奇怪</em>的是,刷新一下页面后,再登陆就没有问题,以后也没有问题。只是在WEBSPHERE重启后的第一次登陆出现这种问题,哪位高手知道这是什么原因造成的?该如何解决?谢谢
奇怪空指针问题(求救)
很<em>奇怪</em>的<em>空指针</em>问题,第49行能够打印出值1,说明能得到值,但第50行报出<em>空指针</em>异常。请问大虾们这一般是什么问题引起?rnrn在ACTION 中代码如下:rnrn48:int qid = Integer.parseInt(request.getParameter("qid"));rn49:System.out.println(“*******+”qid);rn50:this.iquestiondao.updateClickcount(qid);rnrn*******+ 1 rnjava.lang.NullPointerExceptionrn at org.lxh.myzngt.struts.action.ShowAction.selectid(ShowAction.java:50)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.lxh.myzngt.filter.EncodingFilter.doFilter(EncodingFilter.java:22)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)
null和“”调用方法都会报空指针
今天和同事谈论关于<em>空指针</em>的简单问题,条件是一个EditText获取输入的值,当没有输入值的时候,editText.getText();返回的是什么? 打印出来后,才发现并不是Editable对象,而是一个空字符串,空字符串调用方法的时候,是不<em>会报</em><em>空指针</em>的,只有null调用方法才<em>会报</em><em>空指针</em>。
java基本类型接收null值会报空指针
Long l1 =null;long l2 =l1;java.lang.NullPointerException
Fragment+ViewPager+ButterKnife时控件会报空指针问题
Fragment+ViewPager+ButterKnife时控件<em>会报</em><em>空指针</em>问题 首先聊一下ViewPager+Fragment的机制吧,ViewPager在滑动的时候会缓存前后面各一个fragment,也就是说,一共是三个fragment在内存中,而如果滑动的过多的话,与视图fragment距离超过1的fragment就会被回收掉。 那接下来再聊一下ButterKnife在fragment中的绑...
奇怪的文件操作? 请教为什么
从a中读内容复制到b中,删除a,然后从b中再把内容复制到a中去rn最后 a中因该就会有内容,可是我的a中什么都没有,<em>为什么</em>?rn代码如下:rn#include rnint main()rn FILE *table=fopen("a","r+");rn FILE *tmp=fopen("b","w");rn char buf[255];rn while(fgets(buf,255,table))fprintf(tmp,"%s",buf);rn close(table);rn close(tmp);rn remove("a");rn FILE *in,*out;rn out=fopen("a","w");rn in=fopen("b","r");rn int c;rn while((c=fgetc(in))!=EOF)fputc(c,out);rnrn
为什么老是出错??好奇怪
NMHTTP数组出错!rnrnvarrn MyNMHTTP: array[0..MaxHttp] of TNMHTTP;rn i:ingeter;rnbeginrnfor i:=0 to MaxHttp dorn MyNMHTTP[i].Post(Edit1.Text,'');rnend;rnrn<em>为什么</em>老是出错,中断之后查看i的值,居然始终从101开始。MaxHttp我定义为100。
为什么不行啊,好奇怪!!!!
我在框架类定义了一个public 的变量(int m_DrawType)rn在view类里,我使用了这个变量,但是却编译不过:m_nDrawType' : undeclared identifierrn我已经在源文件里包含了框架类的头文件了,<em>为什么</em>还不行??!
奇怪的,为什么看不到网上邻居?
WIN2000专业版,对等的网,从别的电脑可以看到A电脑,但当从A电脑上打开网上邻居时就错:无法访问workgroup 服务器没有设置事物处理,\\192.168.0.1也打不开说找不到网络名,在线等待
奇怪奇怪奇怪???????????
<em>为什么</em>我一条简单的UPDATE数据后,马上刷新数据集在SQL SERVER下好使,可以在ACCESS下就不能刷新啊 ????? rn
为什么会报404错误
rn//struts-config.xmlrnrn rn rnrn//test.jsprnrnrnrnrn rn Insert title herernrnrnssssssssssssssssssssrnrnrnrn//Test.javarnrnpackage com.edu.action;rnrnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport org.apache.struts.action.Action;rnimport org.apache.struts.action.ActionForm;rnimport org.apache.struts.action.ActionForward;rnimport org.apache.struts.action.ActionMapping;rnrnpublic class Test extends Action rn public ActionForward execute(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response)rn throws Exception rn return mapping.findForward("test");rn rnrn
为什么会报这个错误》??
SQL> desc test3;//是个视图,由多个表字段组成rn名称 是否为空?类型rn------------------------------- -------- ----rn PERSONAL_TAX NUMBERrn EMP_ID NOT NULL NUMBER(4)rnrnSQL> desc payroll_item;//是张表rn名称 是否为空?类型rn------------------------------- -------- ----rn PAY_ID NOT NULL NUMBER(2)rn EMP_ID NOT NULL NUMBER(4)rn ITEM_ID NOT NULL CHAR(4)rn AMOUNT NUMBER(12,2)rnrnrnSQL> update payroll_itemrn 2 set amount=(rn 3 select personal_taxrn 4 from test3rn 5 where test3.emp_id=payroll_item.emp_id)rn 6 where test3.emp_id=payroll_item.emp_idrn 7 and payroll_item.item_id='0157'rn 8 and payroll_item.pay_id=11;rnwhere test3.emp_id=payroll_item.emp_idrn *rnERROR 位于第 6 行:rnORA-00904: invalid column namern<em>为什么</em><em>会报</em>这个错误》??rn原因何在???
求救:为什么会报nullpointexception???
运行下面这段code的时候老是报nullpointexception.rn在in_accept(),send();finish()中都报了rn好像和变量in有关系rnrnimport java.io.*;rnimport java.net.*;rnpublic class Server rnrnrn private ServerSocket server = null;rn private int port = 9090;rn private Socket in = null; rnrn public static void main(String args[]) rn rn Server sock = new Server();rn System.out.println("Waiting for one new connection....");rn sock.in_accept();rn System.out.println("Got one new connection....");rn sock.send();rn System.out.println("Send finished for this connection");rn sock.finish();rnrn rnrn//===========================================================rn public void Server()rn rn try rn rn server = new ServerSocket (port);rn rn catch(IOException e)rn rn System.out.print("Construct Get one exception");rn rn rn public void in_accept() thrown Exceptionrn rn tryrn rn in = server.accept(); rn rn catch(IOException e)rn rn System.out.println("send get exception"); rn rn rn public void send()rn rn tryrn rn PrintStream outstream=new PrintStream(in.getOutputStream());rn outstream.println("HTTP/1.0 200 OK");rn outstream.println("MIME_version:1.0");rn outstream.println("Content_Type:text/html");rn outstream.println("Haha, Suc!!!");rn outstream.close();rn rn catch(IOException e)rn rn System.out.println("send get exception"); rn rn rn public void finish()rn rn tryrn rn in.close();rn server.close(); rn rn catch(IOException e)rn rn System.out.println("finish get exception"); rn rn rn rnrn
为什么会报这样的错???
我的代码是这样的rnrn rnrn<em>为什么</em>会出现这样的异常rn严重: Servlet.service() for servlet jsp threw exceptionrnjavax.servlet.ServletException: File "/WEB-INF/views/search/WEB-INF/views/common/careersInfo.jsp" not foundrnrnrn[color=#FF0000]/WEB-INF/views/search[/color]/WEB-INF/views/common/careersInfo.jsprn 怎么会出现这个东西???rnrnrnrn
为什么会报Segmentation fault????????
#include rnrnint main() rn char buf[4096];rn char *str = "#include \r\n";rnrn snprintf(buf,sizeof(buf),str);rn printf("%d %d %d\n",buf[18],buf[19],buf[20]);rn printf("%s\n",buf[18]);//这里<em>为什么</em><em>会报</em>Segmentation faultrn rn return 0;rnrnrn
为什么会报这个错?
public class welcomern rn rn rn public static void main(String args[])rn rn rn System.out.print("welcome to java world!"); rn rn rn rn rnrn很简单得一个小程序,可是他报错:rnException in thread "main" java.lang.NoClassDefFoundError: welcomern这是<em>为什么</em>呢?rn谢谢~~~
为什么会报NumberFormatException啊?
rnrnrnid为从上一个.JSP文件传过来的参数 打印在命令行为10
为什么会报这样的错误?
[Error] Incompatible types: 'TPanel' and 'TControl'rnrn报错的那句话是:if ATabSheet.Controls[iTabSheet] is TPanel then
为什么会报异常呢???
tryrn rn string t = "\',\'"; // ','rn byte age = Byte.Parse(comboBox2.Text);rn string stradduser = "Insert manager values (\'" + textBox1.Text + t + textBox2.Text + t + comboBox1.Text + "\'," + agern + ",\'" + textBox3.Text + t + textBox6.Text + "\'," + "getdate()," + "\'" + textBox4.Text + "\')";rnrn SqlConnection thisConnection = new SqlConnection(Form_BookManager.strConnection);rn SqlDataAdapter sqldata = new SqlDataAdapter(stradduser, thisConnection);rn DataSet ds = new DataSet();rn sqldata.Fill(ds, "Manager");rn SqlCommandBuilder sqlbuilder = new SqlCommandBuilder(sqldata);rn BindingSource bind = new BindingSource();rn bind.DataSource = ds.Tables["Manager"];rn sqldata.Update((DataTable)bind.DataSource);rn //此句报异常,<em>为什么</em>啊?如何修改?rn /*rn 值不能为空。rn 参数名: dataTablern 未处理ArgumentOutOfRangeException rn * */rn thisConnection.Close();rn rn catch (SqlException)rn rn MessageBox.Show("用户名已存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);rn rn rnrnrnrn这个功能是添加用户,然后写入数据库表。
为什么会报这种错?
rn if (TextBox1.Text == "" && TextBox2.Text == "")rn rn Response.Write(" ");rn rnrnrn<em>为什么</em>报以下错误rn错误 1 当前上下文中不存在名称“TextBox2”
为什么会报这个错误
template rnclass NodeList;rn执行这条语句时:rnNodeList *newNode = new NodeList(item);rnrn报错:error C2664: “NodeList::NodeList(const NodeList &)”: 不能将参数 1 从“int”转换为“const NodeList &”。rnrn在主函数中,rnNodeList List;
为什么会报NotFoundError 求解
rn rn 书名 价格 新的一天1 新的开始1 新的一天 新的开始rn rn rn rn
为什么会报语法错?">";"为什么会报语法错?
报错内容:rn语法错误,将“;”插入到完整 LocalVariableDeclarationStatement 中rnrn这行注释掉就在上一行的末尾的分号后面报这个错rn
请教为什么会报NullPointerException
[code=java]rnimport java.io.Console;rnrnpublic class NewConsole rn public static void main(String[] args) rn Console c = System.console();rn char[] pw = new char[10];rn pw = c.readPassword("%s", "pw: ");rnrnrn[/code]rnrnException in thread "main" java.lang.NullPointerExceptionrn at NewConsole.main(NewConsole.java:7)rnrnpw = c.readPassword("%s", "pw: ");这一句是什么问题呢?rn如果改成pw = c.readPassword();还是一样的错误
为什么会报异常!
1。在mdi主窗体中进行监听,在一个打开的子窗体中发送,<em>为什么</em>退出后<em>会报</em>异常!谢谢!rnImports System.NetrnImports System.Net.SocketsrnImports System.ThreadingrnPublic Class Form1rn Inherits System.Windows.Forms.Formrnrn Private th As New Thread(AddressOf Listen) '一个线程rn Private tcpl As New TcpListener(5656) '从 TCP 网络客户端侦听连接。rn Private listenerRun As Boolean = Truern Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadrn th.Start()rn End Subrn Private Sub Listen()rn Tryrn '服务器端,从 TCP 网络客户端侦听连接,5656是端口号rn 'Dim tcpl As New TcpListener(5656)rn tcpl.Start() '开始侦听rn 'StatusBar1.Text = "正在监听..."rn While listenerRun '一直进行监听rn '接受挂起的连接要求rn Dim s As Socket = tcpl.AcceptSocket()rn '定义一个数组作为数据缓冲区rn Dim stream(80) As Bytern '将数据从连接的sokets接受到接受缓冲区的特定位置rn 'stream是接受到的数据的存储位置rn Dim i As Integer = s.Receive(stream)rn '将接收的数据进行解码,使用UTF8编码格式。rn Dim message As String = System.Text.Encoding.UTF8.GetString(stream)rn 'richTextBox1.AppendText(message)rn MessageBox.Show(message)rn End Whilern Catch ex As System.Security.SecurityException '检测到安全性错误引发的异常rn MessageBox.Show("防火墙安全错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)rnrn Catch ex As Exceptionrn MessageBox.Show(ex.Message, "kaishi")rn 'MessageBox.Show("error!")rn 'StatusBar1.Text = "已停止监听!"rn End Tryrn End Subrnrn Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Clickrn Dim newform As New Form2()rn newform.MdiParent = Mern newform.show()rn End Subrnrn Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closingrn Tryrn listenerRun = Falsern tcpl.Stop() '停止侦听rn th.Abort() '终止线程rnrn Catch ex As Exceptionrn MessageBox.Show(ex.Message, "11")rn End Tryrn End SubrnEnd Classrn///////////////////rn在form2中rnPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickrn Send()rn End Subrn Private Sub Send()rn Tryrn rn Dim msg As String = "工单已完成!"rn '初始化 TcpClient 类的新实例并连接到指定主机上的指定端口rn Dim tcpc As TcpClient = New TcpClient("192.254.63.221", 5656)rn '返回发送或接受数据的流 rn 'NetworkStream 提供用于网络访问的基础数据流()rn Dim tcpstream As NetworkStream = tcpc.GetStream()rnrn Dim reqstreamw As StreamWriter = New StreamWriter(tcpstream)rn reqstreamw.Write(msg)rn reqstreamw.Flush() '清除当前编写器的所有缓冲区,并使所有缓冲数据写入基础流rn tcpstream.Close()rn tcpc.Close() '客户端连接关闭rn rn Catch ex As Exceptionrn MessageBox.Show(ex.Message)rn End Try
jsp连接mysql时 出现空指针错误 好奇怪
我想用一个bean文件:mysql.java连接数据库 然后用一个jsp文件:conn_data_mysql.jsp测试,运行后就出现这个异常了.找了半天也没解决,rnrnorg.apache.jasper.JasperExceptionrn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnroot cause rnrnjava.lang.NullPointerExceptionrn org.apache.jsp.conn_005fdata_005fmysql_jsp._jspService(conn_005fdata_005fmysql_jsp.java:73)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.rn//////////////////////////////////////////////////////////////////////////////////////////////////////////////rnrnconn_data_mysql.jsp代码:rnrnrnrn 在线回答问题rnrnrn 这是我的COUNTERrnrnrnrnrnrnrnrn///////////////////////////////////////////////////////////////////////////////////////////////rnrnmysql.java代码:rnrnpackage sql;rnrnimport java.sql.*;rnpublic class mysqlrnrn String sDBDriver="org.gjt.mm.mysql.Driver";rn String sConnStr="jdbc:mysql://localhost:3306/counter?user=root&password=root";rn Connection conn=null;rn ResultSet rs=null;rn Statement stmt;rnrn public mysql()rn rn tryrn rn Class.forName(sDBDriver);rn conn=DriverManager.getConnection(sConnStr);rn stmt=conn.createStatement();rn rn catch (java.lang.ClassNotFoundException e)rn rn System.err.println("counter():"+e.getMessage());rn rn catch(Exception e)rn rn rn rnrn public ResultSet executeQuery(String sql)rn rn rs=null;rn tryrn rn rs=stmt.executeQuery(sql);rn rn catch (SQLException ex)rn rn System.err.println("aq.executeQuerry:"+ex.getMessage());rn rn return rs;rn rnrnrn////////////////////////////////////////////////////////////////////////////////////////////////rnrn这期间还有一个实现中文转换的bean文件:str_filter.java,代码是:rnrnpackage test;rnpublic class str_filterrnrn public str_filter()rn rn rn public String strtochn(String str_in)rn rn byte[] byte1=str_in.getBytes();rn String temp="";rn tryrn rn temp=new String(byte1,"gbk");rn rn catch (Exception e)rn rn rn return temp;rn rnrnrn题目有点长......耐心等待ingrnrn
为什么会报类型错误??????
sqlInsertCommand1.Parameters["@name"].Value=TextBox1.Text; rnrn  //将TextBox赋值给对应参数rnrn  sqlInsertCommand1.Parameters["@email"].Value=TextBox2.Text;rnrn  sqlInsertCommand1.Parameters["@age"].Value=TextBox3.Text;rnrn  sqlInsertCommand1.Parameters["@address"].Value=TextBox4.Text;rnrn  sqlInsertCommand1.Connection.Open(); rnrn  //打开连接rnrn  sqlInsertCommand1.ExecuteNonQuery(); rnrn  //执行Insert语句rnrn  sqlInsertCommand1.Connection.Close();rnrn  //关闭连接rnrn  sqlConnection1.Open(); rnrn  DataSet objDataset; rn
为什么我的会报NullPointerException
rn首先这个是我的JSP页面:rnrnrnrnrn rn 美讯购物网rn rn rn rn 商品添加页面rn rn rn rn rn rn rn 商品名称:rn rn *rn rn rnrnrn rn rn 商品单价:rn *rn rn rnrn rn rn 商品图片:rn rn rnrn rn rn 是否推荐:rn 是 rn 否rn rn rn 是否有效:rn rn 是 rn 否rn rn rn rn rn 商品类别:rn rn rn $category.ctypern rn rn rn rn rn 产品描述:rn rn rn rnrn rn 详细介绍:rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrnrn这个是我的Servletrn public void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOException rn String status = request.getParameter("status");rn if(status.equals("saveGoodss")) //这里有问题rn Goods goods = new Goods();rn goods.setGname(request.getParameter("gname"));rn String str = request.getParameter("gprice");rn double gprice = Double.parseDouble(str);rn goods.setGprice(gprice);rn goods.setGpic(request.getParameter("gpic"));rn goods.setGiscommend(Boolean.parseBoolean(request.getParameter("giscommend")));rn goods.setGisopen(Boolean.parseBoolean(request.getParameter("gisopen")));rn goods.setCategory((Category)request.getSession().getAttribute("category"));rn goods.setGremark(request.getParameter("gremark"));rn goods.setGxremark(request.getParameter("gxremark"));rn goodsImpl.saveGoods(goods);rn response.sendRedirect("/t31/admin/saveGoods.jsp");rn rn
为什么会报错了???yumen
运行下列代码:rnimport java.io.*;rnimport javax.Servlet.*;rnimport javax.Servlet.http.*;rnpublic class Morning extends HttpServletrnrn public void service(HttpServletRequest req,rn HttpServletResponse res)rn throw ServletException,IOExceptionrn rn res.setContentType("text/html; charset=Big5");rn PrintWriter pw=res.getWriter();rn pw.println("");rn pw.println("");rn pw.println(" Moring");rn pw.println("");rn pw.println("");rn pw.println(" GOOD MORNING!! ");rn pw.println("");rn pw.println("");rn rnrn报错:javax.servlet.*;不存在rn javax.servlet.http.*;不存在rn <em>为什么</em>会这样!!!!????
奇怪的问题!好奇怪的问题!好奇怪的问题!
把写好的网站放到新服务器上(WIN2003英文版、OFFICE2003英文版)后,出现下面的问题:rnMicrosoft OLE DB Provider for ODBC Drivers error '80004005' rn[Microsoft][ODBC Microsoft Access Driver] Selected collating sequence not supported by the operating system. rnrn/meilga/index.asp, line 106 rnrnrn源代码如下:rn=================================================================rnrn=================================================================rnrnrn可是我把上面的sql语句改为:rnsql="select * from news order by id" rn这样又没错误了!但是读出来的中文是乱码!rn真是好<em>奇怪</em>的问题啊!而且SQL语句是肯定没错的啊!何况那么简单的SQL语句,并且此网站随便找台电脑都可以,就这台不可以。好郁闷。。。大家帮我看看,谢谢了!rnrnrn
android 开发中的奇怪空指针
今天测试组突然遇到很<em>奇怪</em>的错误。我还是那个态度,有错误就拿日志给我。这样才能解决。然后日志就来了。排查一下立马定位错误日志为:如下。瞬间懵逼,日志原因很明确<em>空指针</em>。然后继续找相关代码。找到3遍愣是没找到和我代码中相关的代码。都是api层的日志提醒。这怎么看。我就在想什么时候会出现这个问题呢,最终通过各种办法,终于了解到。这个是由于我在adapter的getView() 中返回了null导致的。至于为
[javax.servlet.ServletException: java.lang.NullPointerException] 一个奇怪空指针
[code=text]rn2013-12-5 11:15:46 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet [jsp] in context with path [/module-linkman] threw exception [javax.servlet.ServletException: java.lang.NullPointerException] with root causernjava.lang.NullPointerExceptionrn at org.apache.tomcat.util.http.parser.HttpParser.parseMediaType(HttpParser.java:217)rn at org.apache.tomcat.util.http.parser.MediaTypeCache.parse(MediaTypeCache.java:54)rn at org.apache.catalina.connector.Response.setContentType(Response.java:805)rn at org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFacade.java:245)rn at org.apache.jsp.pages.sgllinkman.addSglGroup_jsp._jspService(addSglGroup_jsp.java:61)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at com.chinaboxun.module.linkman.filter.SessionFilter.doFilter(SessionFilter.java:101)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)rn at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:314)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)rn at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)rn at java.lang.Thread.run(Thread.java:619)rn[/code]rnrn情况是这样的,一个父页面index.jsp其中的page指令为:rn[code=html][/code]rnrn子页面addSglGroup.jsp的page指令:rn[code=html][/code]rnrn当点击打开这个子页面addSglGroup.jsp的时候提示上面贴出的错误。可把我找死了,利用删除代码各个排除的方法,发现了这个page指令有问题,果然去掉子页面的contentType="text/html;"过后页面正常打开了。很费解这是<em>为什么</em>,求解惑!!!rnrn
奇怪的问题 好奇怪
CreateProcess(ls_appname,ls_commandline,nil,nil,lb_inherit,ll_flags,nil,nil,lstr_startupinfo,lstr_processinformation);rnrn该调用 在一个函数就可以 一个就不行 我检查了一下 就是后面两个结构变量的初始化的值不一样! 可两个地方的变量都是在调用所在函数的 VAR 中定义了。后面都没有做处理,可以就是0,NIL等初始值 这样调用就没有问题。而另一个地方就返回998 的错误rn 998 Invalid access to memory location. ERROR_NOACCESS rn<em>为什么</em>呢?<em>奇怪</em>
为什么空指针啊?
[code=java]rnpublic class AAA rn private static Queue queue;rnrn public static Queue getQueue() rn return queue;rn rnrn public static void setQueue(Queue queue) rn AAA.queue = queue;rn rnrn public static void setQueue(String a) rn queue.add(a);rnrn rnrnrn[/code]rn[code=java]rnpublic class BBB rn public static void main(String[] args) rn String a = "111";rn int count = 0;rn AAA.setQueue(a);rn count++;rn System.out.println(count);rn rnrn[/code]rnrn请大神帮忙修改下。
为什么空指针
public static void main(String[] args) rnrn int number = 2;rn List ex = new ArrayList();rn String [][] arr = new String[number][];rn for (int j = 0; j < 8; j++) rn if (number > 0) rn for (int i = 0; i < number; i++) rn arr[i][j] = "a";rn rn rn rn for(int i = 0;i
为什么空指针啊?!
page.jsprnrnrnrnrnrnrnrn rnrn rn 分页浏览数据库技巧rn rn rn rn JSP中分页控制,version 1rn rn rn rn rn 学生编号rn 学生姓名rn 性别rn 联系电话rn rn rn rn rn rn rnrnrnrn报错rnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: An exception occurred processing JSP page /page.jsp at line 16rnrn13: str = "";rn14: tryrn15: rn16: rs.absolute((Page-1)*PageSize+1);rn17: rn18: catch(SQLException e)rn19: rnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrnroot cause rnrnjava.lang.NullPointerExceptionrn org.apache.jsp.page_jsp.ShowOnePage(page_jsp.java:23)rn org.apache.jsp.page_jsp._jspService(page_jsp.java:142)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/6.0.13rnrnrn感觉就是那句话的错误啊!rnrs.absolute((Page-1)*PageSize+1);rn可是rs没有问题,absolute这个方法也有。。。。rn哪里错了啊?!!rnrn求教育
为什么hibernate返回空指针?
struts2:rnList list=MyDBManager.findsql(sql);rnrnrnrnpublic class MyDBManager extends HibernateDaoSupport rnrnpublic MyDBManager() rnsuper();rnrnrnpublic List findsql(String sql) throws Exception rnreturn this.getSession(true).createSQLQuery(sql).list();rnrnrnrn错误:rnjava.lang.NullPointerExceptionrn org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:167)
为什么空指针错误??
String s="abc";rnString ss=null;rnStringBuffer sb=new StringBuffer();rnss.concat(sb.append(s.charAt(0)).toString().toUpperCase());rnSystem.out.println(ss);rnrn编译器说第4行 <em>空指针</em>错误!!!rn那错了,应该怎么改?
为什么空指针
在myclipse写的:有个异常 rnjava.lang.NullPointerException rnmypack.HibernateDAO.getCurrentSession(HibernateDAO.java:7) rnrnrn相应的代码如下:public Session getCurrentSession() rnreturn HibernateSessionFactory.getSessionFactory().getCurrentSession(); rnrn顺便问下myeclipse中,自动生成的SessionFactory 要不要重写。rn
为什么sqlMap是空指针
data.properties文件如下rndriver=com.mysql.jdbc.Driverrnurl=jdbc:mysql://127.0.0.1/com_rizu?useUnicode=true&characterEncoding=UTF-8rnusername=rootrnpassword=5217jeanrndata.xml文件如下rnrnrnrnrn rn rnrnrn rnrn rn rn rn rn rn rn rn rn rn rnrnsql.xml文件如下rnrnrnrn rn rn select * from com_hotel rn rn rnrnrn调用类如下:rnpackage Com;rnrnimport java.util.ArrayList;rnimport java.util.List;rnrnimport com.ibatis.sqlmap.client.SqlMapClient;rnrnpublic class Jean rn public List list_hotel()rn SqlMapClient sqlMap = null;rn List hotellist= new ArrayList();rn tryrnrn hotellist =sqlMap.queryForList("hotel_list");rn //NUll pointer access:the variable sqlMap can only be null at the locationrn catch(Exception e)rn hotellist=null;rn rn return hotellist;rn rnrnrnrn<em>为什么</em>说起来sqlMap是<em>空指针</em>呢?rn郁闷了!rn
为什么空指针错误啊???
问题:我用debug测试的时候categoryArray[i]明明有值啊,可是<em>为什么</em>就是传不到list里面呢?rnrnlog:rn[code=Java]06-14 09:33:00.830: E/AndroidRuntime(736): FATAL EXCEPTION: mainrn06-14 09:33:00.830: E/AndroidRuntime(736): java.lang.RuntimeException: Unable to start activity ComponentInfonapo.news.activity/napo.news.activity.WenpingNewsActivity: java.lang.NullPointerExceptionrn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.ActivityThread.access$2300(ActivityThread.java:125)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.os.Handler.dispatchMessage(Handler.java:99)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.os.Looper.loop(Looper.java:123)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.ActivityThread.main(ActivityThread.java:4627)rn06-14 09:33:00.830: E/AndroidRuntime(736): at java.lang.reflect.Method.invokeNative(Native Method)rn06-14 09:33:00.830: E/AndroidRuntime(736): at java.lang.reflect.Method.invoke(Method.java:521)rn06-14 09:33:00.830: E/AndroidRuntime(736): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)rn06-14 09:33:00.830: E/AndroidRuntime(736): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)rn06-14 09:33:00.830: E/AndroidRuntime(736): at dalvik.system.NativeStart.main(Native Method)rn06-14 09:33:00.830: E/AndroidRuntime(736): Caused by: java.lang.NullPointerExceptionrn06-14 09:33:00.830: E/AndroidRuntime(736): at napo.news.activity.WenpingNewsActivity.onCreate(WenpingNewsActivity.java:55)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)rn06-14 09:33:00.830: E/AndroidRuntime(736): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)rn06-14 09:33:00.830: E/AndroidRuntime(736): ... 11 morern[/code]rnrnjava代码:rn[code=Java]rnpackage napo.news.activity;rnrnimport java.util.ArrayList;rnimport java.util.HashMap;rnimport java.util.List;rnrnimport napo.news.util.DensityUtil;rnimport android.app.Activity;rnimport android.os.Bundle;rnimport android.view.Gravity;rnimport android.view.ViewGroup.LayoutParams;rnimport android.widget.GridView;rnimport android.widget.LinearLayout;rnimport android.widget.SimpleAdapter;rnrnpublic class WenpingNewsActivity extends Activity rnrn private final int COLUMNWIDTHPX = 55;rn private int mColumnWidthDip;rnrn /** Called when the activity is first created. */rn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn mColumnWidthDip = DensityUtil.px2dip(this, COLUMNWIDTHPX);rnrn String[] categoryArray = getResources().getStringArray(rn R.array.categories);rnrn List> categories = new ArrayList>();rn for (int i=0; i < categoryArray.length; i++) rn HashMap hashMap = new HashMap();rn hashMap.put("category_title", categoryArray[i]);rn categories.add(hashMap);rn rn rn SimpleAdapter categoryAdapter = new SimpleAdapter(this, categories, R.layout.category_title, new String[]"category_title", new int[] R.id.category_title);rnrn GridView category = new GridView(this);rn category.setColumnWidth(mColumnWidthDip);rn category.setNumColumns(GridView.AUTO_FIT);rn category.setGravity(Gravity.CENTER);rn rn int width = mColumnWidthDip * categories.size();rn LayoutParams params = new LayoutParams(width,rn LayoutParams.WRAP_CONTENT);rn category.setLayoutParams(params);rnrn category.setAdapter(categoryAdapter);rn rn LinearLayout categoryList = (LinearLayout)findViewById(R.id.catgory_layout);rn categoryList.addView(category);rnrn rnrn[/code]
为什么第一次启动报“空指针”?
做了一个J2EE项目,但是每次启动Tomcat时,第一次访问页面都<em>会报</em>“<em>空指针</em>”,再访问就正常了面(除了登陆页)。rn断点测试发现,在执行init方法之前就报<em>空指针</em>了。rn请问这是怎么回事?
为什么提示 空指针
package com.edu.action;rnrnimport java.io.IOException;rnimport java.util.HashMap;rnimport java.util.Map;rnrnimport javax.servlet.ServletException;rnimport javax.servlet.http.HttpServlet;rnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnimport javax.servlet.http.HttpSession;rnrnimport com.edu.bean.User;rnimport com.edu.dao.UserDaoImpl;rnrnpublic class CommonServlet extends HttpServletrn private UserDaoImpl userDao;rnrn @Overridern protected void doPost(HttpServletRequest request, HttpServletResponse response)rn throws ServletException, IOExceptionrn // TODO Auto-generated method stubrn //操作标示rn String type=request.getParameter("type");rn if("login".equals(type))rn rn try rn this.login(request, response);rn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rn rn /**rn * 用户登录验证rn * @param requestrn * @param responsern * @throws Exception rn */rn private void login(HttpServletRequest request,HttpServletResponse response) throws Exceptionrn Map map=new HashMap();rn String username=request.getParameter("username");rn String password=request.getParameter("password");rn [color=#FF0000] User user=userDao.findByLogin(username, password);[/color] [color=#FF0000] //这句报错[/color]rn if(user==null)rn map.put("state", "error");rn map.put("info", "用户不存在");rn rn elsern HttpSession session=request.getSession();rn session.setAttribute("user", user);rn response.sendRedirect("main.jsp");rn rn rn rn rnrnrn
为什么就可以避免空指针
public static void main(String[] args) rn rn String a=null;rn if("aa".equals(a))//这种情形,不出现<em>空指针</em>异常rn //if(a.equals("aa"))//出现<em>空指针</em>异常rn rn System.out.println(true);rn rn else rn System.out.println(false);rn rn rn上面的两句不同的比较语句测试,第一句不出现<em>空指针</em>异常,第二句出现。rn所以在变量和常量比较的时候,一般把常量放在前面。为了避免<em>空指针</em>异常。rn但是我的问题是:变量在前时候,读到变量,变量为空,就出现异常了。rn<em>为什么</em>变量在后时候,a变量就不用读了吗?既然要比较肯定也要读啊,问题rn只是先后的问题。<em>为什么</em>放在后面就就不报<em>空指针</em>呢?
奇怪的一个问题!真的好奇怪
<em>为什么</em>我从数据库复制6W行数据粘贴到excel2003表格中,少了9行 只有59991行数据了。我的数据库是sqlserver2008-64位的rnrnrn刚开始复制了几次还正常,后面的就越来越不正常了。 过一会儿数据库就报错了 什么outofmemoryexception还是什么的
奇怪
有时在CSDN上提些问希望能看多点人的见解,但为何总是三几个人回复我的?看到有些人的问题有几十个上百个人回复,这是<em>为什么</em>呢?
奇怪
我想创建一个基于CSplitterWnd的新类,但是在列表中找不到CSplitterWnd这个类,只有一个Splitter,这是什么东东?
奇怪!!!
我写了一段这样的程序:rn String sqlCon="select * from db_contractwherecontract_no='"+ls_contract_no+"'";rnResultSet rsCon=opendb.executeQuery(sqlCon);rn if (rsCon.next())rn rn String ls_contract_name=rsCon.getString("contract_name");rn rnrn 合同rn rn<em>为什么</em>我用rsCon.getString("contract_name")就对,而用ls_contract_name替代rnrsCon.getString("contract_name")就不对?ls_contract_name中有值,而且是正确的。rnrnrnrnrnrn
奇怪奇怪的查询问题 50分!
我的查询有新查询和二次查询两种rnrn我把以前EXCEL导入到数据库中查询一点问题也没有,但是我把我同事做好的EXCEL数据库导入到数据库中,一条记录都没有。。。。怎么回事?<em>奇怪</em><em>奇怪</em>真<em>奇怪</em>
奇怪!?
我用red hat linux 7.3的完全安装方式安装了linux,在打开相应的服务后,可以看到apache的测试页,但是,却不能处理php脚本,我在测试页里嵌入了一段脚本(echo),但不能显示。rn不知道是什么原因,诸位有这方面的经验吗?
奇怪
安装是 点击安装图标竟然没有反映 高手有办法吗rn我用的系统win2000 server, 是正版 的oracle9i,而在其他的机子 却没有这样的问题。rn请问是否和我系统设置 有关系呢
奇怪?????
-
奇怪????
xp: “我的电脑”和“回收站”右键怎么多出了:“关闭计算机”和“重新启动”
奇怪!!
我以前写了个程序,存盘后再打开,class view 里面什么也没有,只有“0 files left to load”rn再打开随书光盘上的原代码时,也有这种现象。你说这是<em>为什么</em>哪?
奇怪......
我在笔记本上写C/S程序,局域网中没有问题,可是只要用猫上网时,把电话线插上,再打开数据模块,就找不到数据库,这是怎么回事???
奇怪???
总见有人问MDX语句,可<em>为什么</em>我做的BI项目从来没有用过MDX呢?有没有人能跟我说说MDX到底怎么回事呀!或许做项目能有更好的方法,呵呵,希望各抒己见,盼复!!
奇怪????
在一个lan上, 我能够发现我的网上邻居, rn可是, 我不能够用ping 到达其他的计算机(使用ip地址)rnrnrn什么原因???rn网卡工作正常, 而且tcp/ip也正确安装和配置了
------好奇怪,为什么赋值不上??--------
------好<em>奇怪</em>,<em>为什么</em>赋值不上??-------- rnrn定义的变量<em>为什么</em>赋不上值?rn我看到以前在这个论坛有人发类似的帖子,可是现在<em>为什么</em>总上不去,总是报错,然后进入CSDN的主页,真郁闷
奇怪。。这个是为什么啊!!!!
#includernvoid main()rnrn unsigned int a = 6;rn int b = -20;rn int c;rn c=a+b;rn (c> 6) ? puts("> 6") : puts(" 6") : puts(" 6rn这是<em>为什么</em>呢?rn
为什么总是错,好奇怪
CSocket m;rnm.Create(portnum)rnm.Listen()rn就是这么简单几句话,<em>为什么</em>总返回0rn端口我也该了几次了,rn望大侠指点!
奇怪, 为什么得不到 TextBox 的值呢??????
前台:rn rnrnrn后台:rnprivate void Page_Load(object sender, System.EventArgs e)rnrn txtaa.Attributes.Add("onkeydown",@"isInt('"+ txtaa.Text +"')");rnrnrn<em>为什么</em>弹出对话框中无值呢????rn请教各位!!
奇怪啊!这是为什么啊?
事情是这样的:这要从一个漆黑的晚上说起一只菜鸟(据说是叫 Blade Ching)想飞上天空成为不是很菜的鸟。于是他就想做一个小程序来帮助自己,可是呢菜鸟就是菜鸟于是他碰到了一个很严重的问题:他想保存一个控件的颜色属性于是呢就用了文件的读写他是这样子做的:fprintf(qqcfg,"GroundColor=%u\n",ColorToRGB(ButtonBar->Color));rn保存好了以后呢他就想读出来用。这只菜鸟这样读: fscanf(qqcfg,"GroundColor=%i\n",temp);可是呢,问题来了:显示的颜色不是一样的了!·<em>为什么</em>啊?
------好奇怪,为什么赋值不上??--------
程序如下:rnvoid CArraytestDlg::OnButton3() rnrn CString* aa=new CString;rn *aa="kk";rn rn Test3((unsigned short**)aa);rn MessageBox(*aa);rnrnrnvoid CArraytestDlg::Test3(BSTR *aa)rnrn CString bb="asdfasfd";rn (CString)*aa=bb; rnrnrn当OnButton3() 时候,aa的值该改变的,<em>为什么</em>运行的结果aa的值仍就是“kk”呢??rn应该如何把aa的值在Test3(BSTR *aa)中正确改变?rnrnTest3中的参数aa类型一定是BSTR,不能用其他的。rnrn
奇怪为什么总是出错啊
rn hunter_区段1rn 1rn 0rn Increasingrn 0rnrnrn小弟有上述xml,想要获取变量target对应的元素的innertext,node已经定位到了Face节点rnrna = node.SelectSingleNode(target).InnerText <em>为什么</em>不对啊?rnrnrnrn
---------好奇怪为什么赋值不上??----------
程序如下:rnvoid CArraytestDlg::OnButton3() rnrn CString* aa=new CString;rn *aa="kk";rn rn Test3((unsigned short**)aa);rn MessageBox(*aa);rnrnrnvoid CArraytestDlg::Test3(BSTR *aa)rnrn CString bb="asdfasfd";rn (CString)*aa=bb; rnrnrn当OnButton3() 时候,aa的值该改变的,<em>为什么</em>运行的结果aa的值仍就是“kk”呢??rn应该如何把aa的值在Test3(BSTR *aa)中正确改变?rnrnTest3中的参数aa类型一定是BSTR*,不能用其他的。rnrn rnrn
奇怪为什么这样的正则无法匹配?
[code=HTML] rn rn rn 记住我rn rn rn rn rn [/code]rnrn正则:[color=#FF0000]\]*)\>[/color]rnrn这样无法匹配。但是去掉蓝色部分却可以。只是把 也匹配进去了,不符合要求。rn好<em>奇怪</em>啊!
为什么这段程序输出这个?好奇怪
程序如下:rn#include rnusing namespace std;rnrnclass arnrnpublic:rn int id;rn a doit()rn rn a tmp;rn tmp.id=12345;rn return tmp;rn rn void prid_addr()rn rn cout<<
为什么弹不出提示框,好奇怪的问题,谢谢
tryrn rnrn System.Web.Mail.SmtpMail.SmtpServer = "mail.intel.com";rn System.Web.Mail.SmtpMail.Send(message);rn rn catch (Exception ex)rn rn // m_gel.GeneratePopUpMsg("Email Error-" + ex.Message.ToString());rn string strError = "Email Error--"+ex.Message.ToString();rn HttpContext.Current.Response.Write(" ");rn rnrnrn上面strError = "Email Error--"可以弹出对话框,但<em>为什么</em>rnrn加上ex.Message.ToString()后就弹不出了
为什么这样过滤不行,好奇怪
我编写一个本地查询,数据保存成本地cds格式。我用的是以下格式:rnrn if edtName.Text<>'' thenrn lsWhere := lsWhere + ' and NAME like ''%'+ trim(edtName.Text)+'%''';rnrn cdsCustomer.Filter := lsWhere ;rn cdsCustomer.Filtered :=true;rn rn rn 如果我用姓名的全部内容,如edtName填写“王大名” 就查不到记录,如查询“王大”就可以查询到“王大名”这条记录。我太<em>奇怪</em>了,有没有碰到过这样的问题,help mern
真的好奇怪为什么org.apache.struts.actions.ForwardAction不能用??!!!
搞了老长时间。。。rn rn rnrn错误;rnjava.lang.ClassNotFoundException: org.apache.struts.actions.ForwardActionrnrn敬请各位高手指教!
if语句为什么得不到执行??好奇怪
[code=java]if(map.get("topic")=="国内")rn rn System.out.println("entry");rn map0.put("0", "国内");rn [/code]rn代码如上:经过输出语句判断map.get("topic")等于“国内”rn那<em>为什么</em>不进入if判断语句??求救
“”@@串口通信问题,好奇怪的,不可能不对的,为什么@@“”
我作了一个串口控制程序是这样的rn  Dim ByteArray(0) As Byte '定义动态数组rn ByteArray(0) = &H20rn com.OutBufferCount = 0rn com.Output = ByteArrayrn  不知<em>为什么</em>下位机不可以正确接收,而用comtools的软件是没有问题,好像是下位机收到的数据不正确。rn
为什么编译时会报这样的错???
我用eclipse编译以下代码,编译器就<em>会报</em>错,不知道是怎么一回事rn代码如下:rnrnpackage p426_I_O_stream;rnrnimport java.io.*;rnpublic class IOStreamDemo rn // throw exceptions to console:rn public static void main(String[] args) throws IOException rn // 1. reading input by lines:rn BufferedReader in = new BufferedReader(rn new FileReader("IOStreamDemo.java"));rn String s, s2 = new String();rn while((s = in.readLine()) != null);rn s2 += s + "\n";rn in.close();rn rn // 1b. reading standard input:rn BufferedReader stdin = new BufferedReader(rn new InputStreamReader(System.in));rn System.out.print("Enter a line:");rn System.out.println(stdin.readLine());rn rn // 2. Input from memory:rn StringReader in2 = new StringReader(s2);rn int c;rn while((c = in2.read()) != -1);rn System.out.print((char)c);rn rn // 3. format memory input:rn try rn DataInputStream in3 = new DataInputStream(rn new ByteArrayInputStream(s2.getBytes()));rn while(true)rn System.out.print((char)in3.readByte());rn catch(EOFException e) rn System.err.println("End of Stream");rn rn rn // 4. file output:rn try rn BufferedReader in4 = new BufferedReader(rn new StringReader(s2));rn PrintWriter out1 = new PrintWriter(rn new BufferedWriter(rn new FileWriter("IODemo.out")));rn int lineCount = 1;rn while((s = in4.readLine()) != null)rn out1.println(lineCount++ + ": " + s);rn out1.close();rn catch(EOFException e) rn System.err.println("End of stream");rn rn rn // 5. storing & recovering datarn try rn DataOutputStream out2 = new DataOutputStream(rn new BufferedOutputStream(rn new FileOutputStream("Data.txt")));rn out2.writeDouble(3.14159);rn out2.writeChars("that was pi\n");rn out2.writeBytes("that was pi\n");rn out2.close();rn DataInputStream in5 = new DataInputStream(rn new BufferedInputStream(rn new FileInputStream("Data.txt")));rn BufferedReader in5br = new BufferedReader(rn new InputStreamReader(in5));rn // must use DataInputStream for data:rn System.out.println(in5.readDouble());rn // can now use the "proper" readLine():rn System.out.println(in5br.readLine());rn // but the line comes out funny.rn // the one created with writeBytes is ok:rn System.out.println(in5br.readLine());rn catch(EOFException e) rn System.err.println("end of stream");rn rn rn // 6. reading/writing random access filesrn RandomAccessFile rf = new RandomAccessFile("rtest.dat","rw");rn for(int i = 0; i < 10; i++)rn rf.writeDouble(i*1.414);rn rf.close();rn rn rf = new RandomAccessFile("rtest.dat","rw");rn rf.seek(5*8);rn rf.writeDouble(47.0001);rn rf.close();rn rn rf = new RandomAccessFile("rtest.dat","rw");rn for(int i = 0; i < 10; i++)rn System.out.println("Value" + i + ": " + rf.readDouble());rn rf.close();rn rnrn----------------------------------------------------------------------rnrn报错如下:rnrnjava.io.FileNotFoundException: IOStreamDemo.java (系统找不到指定的文件。)rn at java.io.FileInputStream.open(Native Method)rn at java.io.FileInputStream.(FileInputStream.java:103)rn at java.io.FileInputStream.(FileInputStream.java:66)rn at java.io.FileReader.(FileReader.java:41)rn at p426_I_O_stream.IOStreamDemo.main(IOStreamDemo.java:9)rnException in thread "main"
为什么会报变量重复定义
我想问个问题,在用C编程时,如果把数据定为全局变量,放在一个data.h文件中,然后有两个.cpp文件都包含这个头文件,然后<em>会报</em>重复定义了data.h中的变量,即使在data.h中用条件编译方法只让里面编译一次,但还是<em>会报</em>重复定义,除非把里面变量用const型才可以,我想问下如果不用const 能实现吗?
框架中为什么会报拒绝访问?
我有一个页面a.jsp,它的主要功能是将其中FORM的内容提交到另一个SERVLET,而这个SERVLET的作用是生成文件,并产生一个application/octet-stream类型的(response的)OutputStream以让用户下载该文件,所以a.jsp不会刷新.rn现在的问题是,rn而如果a.jsp在一个frame中,则提交一次FORM后(能正确得到下载的文件),就无法进行任何其他操作.都<em>会报</em>JS错误"拒绝访问".rn我进行了很多次其他试验,结果如下:rn1.a.jsp如果不在frame中,则提交一次FORM后(即下载了一次文件),a.jsp还可以进行其他操作.rn2.将a.jsp更名为a.html(即去掉了一些BEAN的引用和使用),问题依旧.rn3.以新建窗口(window.open())方式提交,则问题不存在.rn4.将a.jsp的提交部分提炼出来(因为a.jsp中包含了一个xml数据岛外部文件的载入,和一些比较复杂的JS代码)作为b.jsp,并在框架中用b.jsp代替a.jsp,则问题不存在.rn5.对以上试验都实现了GET和POST方式.rn有谁知道<em>为什么</em>会出现这样的情况,谢谢!
VMware+Workstation+6.0.45731+绿色精简中文版.rar下载
VMware+Workstation+6.0.45731+绿色精简中文版.rar 相关下载链接:[url=//download.csdn.net/download/friendan/5112997?utm_source=bbsseo]//download.csdn.net/download/friendan/5112997?utm_source=bbsseo[/url]
Python环境搭建下载
Python环境搭建方法,是一种面向对象、直译式计算机程序设计语言,也是一种功能强大的通用型语言,已经具有近二十年的发展历史,成熟且稳定 相关下载链接:[url=//download.csdn.net/download/qq_17833233/7648343?utm_source=bbsseo]//download.csdn.net/download/qq_17833233/7648343?utm_source=bbsseo[/url]
智能H3鼠标输入法下载
好的输入法是工作好的开始,大家多多支持,谢谢 相关下载链接:[url=//download.csdn.net/download/fankylee/7868773?utm_source=bbsseo]//download.csdn.net/download/fankylee/7868773?utm_source=bbsseo[/url]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数
我们是很有底线的