FAQ 2 - [email protected]

*如何使用JavaBean
需要把JavaBean.class文件拷贝到对应的文件夹,Tomcat不会编译java文件

*为什么JDBC连接Oracle数据库的时候,update ResultSet 数据库失败?
见./lib/关于ResultSet接口插入数据的问题.htm

*JSP处理表单的时候读入的中文出现乱码,用如下方式解决:
见/lib下的JSP乱码解决办法

*Tree View developed in Javascript(Javascript创建树形目录)
see lib/nanotree.htm and lib/nanotree.rar

*如何在linux上添加Oracle "thin"模式的JDBC驱动程序?
STEP1 将对应的jar文件拷贝到jdk的库目录中
STEP2 在/etc/profile中设置CLASSPATH,如下所示:
CLASSPATH=/home/sonic/jdk/j2sdk1.4.2_03/lib/tools.jar:/home/sonic/jdk/j2sdk1.4.2_03/lib/dt.jar:/home/sonic/jdk/j2sdk1.4.2_03/lib/classes12.jar:/home/sonic/jdk/j2sdk1.4.2_03/lib/ojdbc14.jar:/home/sonic/jdk/j2sdk1.4.2_03/lib/nls_charset12.jar:.
# JAVA_HOME=/home/sonic/jdk/j2sdk1.4.2_03
# PATH=${PATH}:/home/sonic/jdk/j2sdk1.4.2_03/bin
export CLASSPATH

*如何为TOMCAT添加JDBC驱动程序?
STEP1 将对应的jar文件拷贝到[CATALINA_HOME]/common/lib下
STEP2 重新启动tomcat

*如何配置Tomcat的连接池?

1 sever.xml中对应的<Context><Resource></Resource></Context>中添加Resource, 这里(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html)有详细描述
2 webapp的web.xml中描述对应的资源,这里(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html)也有
3 重新启动Tomcat服务器就可以了
注意:
- 一定要在正确的Context中加入Resource
- 一定要保证jsp中,WEB-INF/web.xml中的<res-ref-name>名和<Context>中的<Resource name="..">保持一致
-  好像在4.1.18版本以下第2步并不需要
- 可以用tomcat自带的administrator工具来做可以提高效率

还有一种方式:在<GlobalNamingResources></GlobalNamingResources>中加入Resource,然后再在对应的Context中用ResourceLink引用即可。方法与上类似。


- 用Tomcat的Administrator工具,在对应的webapp中添加一个DataSource
- 在对应的sever.xml的<Context><Resource></Resource></Context>中可以手工更改设置
  - 连接池管理器类名
  - 连接池资源的Auth属性
  - 连接池的各种参数
- 重新启动Tomcat服务器就可以了
注意:
1.一定要在正确的Context中加入DataSource的Resource
2.一定要保证jsp中,WEB-INF/web.xml中的<res-ref-name>名和<Context>中的<Resource name="..">保持一致
3.好像在4.1.18版本中<res-ref-name>并不需要

./lib/tomcat-dbcp-config.zip中包含成功配置的三个文件:server.xml和webapp

还有一种方式:
在globalnaming中加入Resource,然后再在对应的Context中用ResourceLink引用即可。

-Tomcat 4.1.18版本(可能主版本为4的所有Tomcat都是)在安装的时候,若钩上“安装成Windows Service”的话,
启动以后右下角不会出现Tomcat的图标。但是服务器实际上已经启动起来了,系统进程名为Tomcat.exe

*配置CVS服务器的方法:
./lib/CSDN_配置CVS服务器和客户端完全解析.htm

*使用文件目录服务的时候,无法initialContext的问题怎么解决?

因为包含com.sun.jndi.fscontext.RefFSContextFactory的fscontext.jar包不是标准包,
需要手工加入classpath,{J2SDKEE}/imp//lib/fscontext.jar就可以了

*为什么lib/ex2.html中的javascript代码不能执行?
该代码中有几个错误:
-忘记给函数加“function”标识
-document.getElementById()调用给的是元素的id,而不是name!!!

*在作"TreeView"时遇到的问题:
<a onClick="Toggle(this)"><img src="plus.bmp">root </a>
<div style="display:none">abcdefggg</div>

<a onClick="Toggle(this)"><img src="plus.bmp">root</a>
<div style="display:none">abcdefggg</div>

这两段HTML代码有什么不同??

前者调用this.nextSibling.style.display 可控制<div>的属性,但对后者调用则找不到对象??
这是怎么回事呢?root后面的空格起什么作用?

*如何解决动态加载iframe时,窗口大小随内容变化?
见/lib/container.html

*如何解决Tomcat 5.0.24 中用不了Session的问题?
Tomcat 5.0.24中,用自带的web发布工具时,处理webapp的session时会有问题。workaround:如果不用web
发布工具就可以了参见/lib/session.html

*页面上的中文出现乱码时怎么办?
用<%@ page  contentType="text/html;charset=gb2312"%>和
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
定义页面的字符集。第一个好像对jsp也有效。所以用它比较好。
注意使用页面跳转<jsp:forward>的时候,前面的页面设置session变量时候用到不正确的
字符集会使跳转目标的中文显示乱码。

*如何配置Tomcat为servlet执行环境?
http://www.itpub.net/showthread.php?s=&threadid=226990

*如何使用Eclipse调试servlet?
http://www.sysdeo.com/eclipse/tomcatPlugin.html

*如何使用Eclipse调试JSP?
见lib中的Eclipse 3 + Lomboz 3 + Tomcat 5三篇。另外注意以下几个问题:
-Tomcat中XML配置文件XML标签属性区分大小写
-Tomcat5.0.27在使用中有问题(启动Tomcat服务器失败)Tomcat5.0.24可以和Eclipse3M09版本正常使用。

*如何在Servlet中调用JSP?
-见lib/【如何在servlet里调用JSP Errorpage】

*为什么在linux+tomcat的环境中,表单输入项中若有中文的话,读入之后变成乱码?
-<connector ... URIEncoding="GBK"/>
                --------------------->有这个就可以了
*注意POST和GET方法对于表单输入的处理不一样。中文出现乱码的情况也不同,注意研究。本方法对GET方法有效

*如何向Oracle数据库表中导入excel数据?
STEP1 用OFFICE将.xls文件转换成文本文件
STEP2
方法一
1.编写录入控制文件,内容如下所示:

filename:input.ctl

load data
infile 'test.txt'  //--指定要导入的文件
append into table sonic.test //--指定要导入的表
fields terminated by X'09' //--域值由制表符分割
(id,username,password,sj) //--表列的属性

2.用如下的命令将数据导入:
C:>sqlldr userid=sonix/sonix@oracle_162.105.130.50 control=input.ctl log=load_date.log

方法二
自己写一个Java程序将数据导入

*安装lirc的问题:
- 如果不能make的时候出现如下错误:
[...]
make[3]: Entering directory `/usr/src/lirc-0.6.4/drivers/lirc_serial'
DIR=`pwd`; (cd /usr/src/linux/; make SUBDIRS=$DIR obj-m=lirc_serial.o modules)
/usr/src/linux/scripts/pathdown.sh: TOPDIR: parameter null or not set
make[4]: Entering directory `/usr/src/linux'
make[4]: *** No rule to make target `lirc_serial.o', needed by `modules'.
[...]
     
This means that you did not set up and compile your current kernel from the given Linux kernel sources. Recompile your kernel and reboot before proceeding to compile LIRC. There is no other reliable way to get working LIRC modules than compiling your kernel yourself. During compilation LIRC uses the kernel sources to get the current kernel configuration.
- lirc暂时不支持2.6的kernel
- 运行mode2出现下列错误:
mode2: error opening /dev/lirc
mode2: No such device
很可能是因为模块没有载入内核:/lib/modules/2.4.20/ 用insmod添加

- 运行mode2可以测试是否接受成功
- 运行irrecord可以学习遥控器
- 运行irw可以检测遥控码
- 运行rc可以发送已知遥控码
- SONY摄像头的遥控码需要重复发送遥控接收端才能够正确收到每个码的间隔也各不相同

*如何跨网段用exceed连接服务器?
- make sure 'Xaccess' file allows any host to get a login window[http://www.hummingbird.com/support/nc/exceed/ex60237.html?cks=y]
-make sure 'xdm-config' file allows any host to connect
- 本地启动XServer
- ssh2服务器,启动xdm连接Xserver

*linux 不能启动了怎么办?
- 用光盘1的Rescure功能可以进入维护模式,维护模式中,所有文件系统都在内存和光盘上,
可以用mkdir接mount命令将磁盘挂到当前文件系统上进行操作,如修改配置文件等等。

*编译内核以后网卡不支持怎么办?
- 在make xconfig命令之后选择-->Network device support-->10/100M Ethernet-->选择自
己需要的设备。再make dep/make clean/make bzImage/make modules/make modules_install

*使用struts+JSTL的时候,做好的中文properties文件,其中的中文value在页面显示乱码,怎么办?
- 用native2ascii -encoding gb2312 <input-file> <output-file>处理properties文件即可,native2ascii是jdk自带工具
见lib/Java 相关编程技术乐园 - struts中文问题,struts国际化问题的终极解决方案.htm

*为什么使用"<html:text>、<html:password>"等标签时报错?
- <html:text><html:password>表签需要嵌入到html:text中才可用。http://struts.apache.org/userGuide/struts-html.html

*为什么使用Java中的HashMap的时候,如果用自定义对象作为key,查不到对应的值?
- 在自定义的类中重载Object.hashCode()和Object.equals()两个方法,第一个用于计算对象的哈希值,后面一个用于判断两个哈希值相同的对象是否真正相同。

*在使用tiles:put标签的时(<tiles:put name="tree" value="welcomeTree.jsp"/>)为什么不能将需要的内容插入?
为了插入一个jsp页面,value="...":必须使用绝对路径<tiles:put name="tree" value="/welcome/welcomeTree.jsp"/>

*如何向select对象中动态插入值?
select.html

*如何通过JavaBean或JSP的request对象获得<select multiple ...>提交的数据?
用JavaBean的String [] 属性或者request.getParameterValues()方法即可获得,注意提交的只有
selected属性的options

*如何实现改变一个下拉菜单,另一个下拉菜单的内容随之变化(从数据库中取数据),就像www.smth.org的左边?
roomselect.jsp,tst2.jsp,roomselect2.jsp,tst3.jsp

*为什么有时候在用sysdeo的eclipse tomcat plugin调试Servlet时找不到源代码?
检查window->preferences...->Tomcat->Source Path,当前的项目是否已经勾上?

*如何实现通过网页向指定用户发邮件?
用sun的javamail包

*RBDatabase pool中checkquery是必需的

*为什用JSTL的fmt:message时${pageScope.var-a}不能正确显示?
-pageScope等,变量命名规则不允许hyphen.

*如何生成.war文件?
>cd XXXX
>jar -cvf XXXX.war *
XXXX=app-root

*在tomcat中使用javamail时遇到javax.mail.NoSuchProviderException: smtp怎么办?
delete the "mail.jar" in <tomcat-dir>/common/lib/, whose version is probably different with what you put in WEB-INF/lib/, or
delete what you put in WEB-INF/lib, let your application use tomcat's "mail.jar"
the first one sounds awkward, second is better.

*如何在CVS创建branch?
lib/见cvs-branch-tag.doc
*如何配置tomcat的SSL?
www.apache.org->找tomcat的document的how-to
注意通过https://xxxxx:8443来访问
还有一点要注意:关闭不支持https的代理服务器
*如何使得url栏中不显示表单内容?
表单用"POST"方法提交而不用"GET"方法提交
*如何用Java获得Http内容?
用Jakarta的http client
*无法将tomcat端口改到80?
用root帐户启tomcat即可80端口访问权限要求root
*重启xinetd的方法
/sbin/service xinetd start/stop/restart
*helix DNA server 在fedora Core3 for i386上可以安装但是运行后客户端无法与之通信
helix DNA Server 10.0.1在RH Linux 9/Windows XP/RH Linux AS上可以正常运行
怀疑该版本的DNA Server不支持2.6的内核(OK)
*helix DNA Server 11可以从CVS上check out出来但是20050105的版本在linux2.4.21/gcc3.3.3编译出错。
-源代码server/engine/core/platform/unix/main.cpp 中把stub_errno函数给注释掉OK
-按照build.out的步骤biuld剩下的部分OK。
-依然不支持IPv6
*SQL语言中的大小写模糊查询
upper() lower()
*gtk-config找不到?
从gtk2.0起,gtk-config不再使用,改用pkg-config
*ram文件是什么?
ram文件实际上就是地址文件。我们把实际文件的地址写到ram文件中,然后在网页上链接ram文件。例如rock.ram的内容就是:rtsp://www.5dmedia.com:554/rock.rm,而上面的链接就改成http://www.5dmedia.com/rock.ram
*为什么我的VLC-8.0播出来的东西,Windows Media Player不能看?
Make sure your Windows media player version is higher than or equal to 9.0.
Make sure your contents are encoded in 'DIV3' format.
Make sure your contents are encapsulated in 'ASF' format
More information can be found in VLC's document.
*如何将media player嵌入页面?
见lib/计算机世界网-嵌入式流媒体web页面实现.htm
*如何用java进行C/S网络编程?
用ServerSocket类,见lib/Matrix-与Java共舞 - java技术专栏.files
*如何在java中调用那些只能在command line[windows]/shell[unix like systems]中执行的程序?
用Runtime.exec(String [] cmds)方法来实现
Windows:cmds = {"cmd.exe","/C", "notepad.exe"};
Unix:cmds = {"/bin/sh","-c","/sbin/ifconfig>ifconfig.txt"};
具体实现方法参见:lib/Java 技術論壇 - 使用Runtime類別開啟命令列問題
==========================================================================================
*How to install skyeye?
- download skyeye from ftp://166.111.68.183/pub/embed/skyeye,
- download vnet from ftp://166.111.68.183/pub/embed/skyeye/src/vnet
- install vnet. NOTE: update Makefile by adjusting the HEADER_DIR line for your situation before compiling.
- download and install arm tool chain from ftp://166.111.68.183/pub/embed/uclinux/soft/tools/arm
- install skyeye by source or binary.
- download ucosii tester to test your installation.
*My program needs dynamic libraries in directory other than '/usr/lib' or '/lib', what can I do?
- set "LD_RUN_PATH" and "LD_LIBRARY_PATH" environment variable to the directory contains your libraries and restart your program
*When compiling 'xmms', configure tool complains that no glib or gtk is available, but it is indeed installed!
- make sure the development package,instead of the runtime libraries, is installed!
*How to add ipv6 support on HHARM2410 board???
Currently, I tried it this way:
-recompile the kernel with ipv6 support.
-download the kernel and run it.
-ping its Global Link address. OK
*Why inetd/xinetd?
-unix like systems have a lot of program that listening on ports.
-large memory will consumed if let them waiting by them self
-inetd/xinet listen on this port and call them.
*Why 'mount nfs-server:/nfs-folder' complains 'Permission denied'?
- A couple of things to keep in mind with NFS: permissions are handled by UID.
  It is very beneficial to ensure that a user on the client has the same UID
on the server. Otherwise the permissions will just confuse you.  If you are
just using root, and using the no_root_squash option on every mount, you don't
have to worry about this.
*Why my DNS Server on Linux doesn't work??
Try BIND9, which supports IPv6 nameing query.http://www.isc.org
*Why gcc complains 'storage size of `xxx' isn't known'
-Make sure the struct type defining xxx is correct.
*I'm using vlc 0.8.1, I want to play a stream sent to my udp port:5555 on IPv6. I checked the []force IPv6 checkbox in 'opening network stream' dialog, but the console prints 'main input error: no suitable access module for `udp://@[::]@:5555'', why?
-change '@[::]@:5555' to '@[::]:5555' in the command text box of 'open network stream' window, then play.
*How to stream video on IPv6?
-To relay stream, use command like this:
  vlc udp://@[::]:5555 --sout '#transcode{vcodec=DIV3,vb=1024,scale=1}:duplicate{dst=display,dst=std{access=mmsh,mux=asfh,url=:7777}}'
-To publish stream, use command like this:
  vlc v4l:/dev/video:norm=pal:size=320x240:channel=1:audio=0 --sout '#transcode{vcodec=mp4v,vb=512,acodec=mpga,ab=192}:duplicate{dst=display,dst=std{access=udp,mux=ts,url=238.1.1.238:1234}}'
*Why my 'Timer' complains about 'Cancel again' Exception?
- a Timer can only be cancelled once, even if it is scheduled again after the first cancel()
- note: if a Timer hasn't been stopped explicitly, the timer thread will never will never end.
*Why my fedora linux has no source code installed with 'installing everything'?
- Fedora no longer ships with the kernel-source RPM. You must install it separately(http://www.mjmwired.net/resources/mjm-fedora-fc3.shtml#kernelsrc).
*Why the LIRC rpm package along with Fedora Core 3 doesn't work with my home-brewed serial ir-sender/recevier?
- " The default binary build of this package will only work with the Pinnacle PCTV serial remote. if you have a different device, your will probably need to recompile the source RPM changing the "--with-driver=" configure option to your device. if your remote requires special kernel modules to run, I guess you're stuck having to recompile a kernel and recompile lirc manually to get the modules!" - http://dag.wieers.com/packages/lirc/
*How to make lirc 0.6.0 work on Linux with kernel 2.6.x?
http://www.home.no/zkronk/lirc.html
*Why sirs doesn't work on my computer?
- your computer may be too fast or too slow, adjust the gSUTL(Sirs UART Transmitter Latency) and gDutyCycle for your system: the faster your computer is, the smaller the number should be, ther are several working example for reference:
COMPUTER gSUTL gDutyCyle
PIII450MHz 400 50
PIV3.2GHz 0 55
*Why 'try_module_put(THIS_MODULE)' doesn't work in my driver: compilation
complains that the symbol is not linked
- currently don't know why
*Why my CyberLink UPnP Control.Point doesn't identify online UPnP Device?
- If you are using JDK 1.5.0, make sure you've chosen a right UPnP.setEnable(XXX) configuration for your device:
 DEVICE   ControlPoint
 USE_ONLY_IPV6_ADDR USE_ONLY_IPV6_ADDR
 USE_ONLY_IPV4_ADDR USE_ONLY_IPV4_ADDR
NOTICE:
<BLOOD EXPERIENCE I>if you are using JDK 1.4.2 or lower version, it is equal to that you are using JDK 1.5.0 with 'USE_ONLY_IPV4_ADDR'
<BLOOD EXPERIENCE II>if you are running an IPv6 ControlPoint on Fedora Core 3, the CyberLink's UPnPSDK won't work!!!I'm gonna report this problem to RedHat!Ethereal show that after an IPv6 enabled UPnPDevice is started on FC3, only 6 'byebye' SSDP package are multicasted.

*How to get working path on servlet?
-Servlet.getServletContext().getRealPath("/");

*Why 'ssd' can send CORRECT infrared code in terminal(real terminal), but
emits INCORRECT infrared code in X?
- my Fedora Core3 with kernel 2.6.10-SMP on Pentium 4 HT(HyperThreading) has this problem, but after my recompile the same kernel source and make a 2.6.10 signal CPU image, this problem disappears.
===========================================================================================
* linux下的sniffer工具是什么?
Ethereal,tcpdump都可以
* 为什么用htonl(portnumber)得到的结果不正确?
注意htonl是处理8字节的,htons是处理4字节的。
* 如何在CEdit里面换行?
lib下
* MFC应用程序退出
发送WM_CLOSE消息即可
* 为什么我用select()调用总是返回10022错误?
每次select()之后最好重置被select的集合set!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值