e**n 发帖数: 10 | 1 When I open an ASCII text file, I set content type as "text/plain" and
everything is ok. But when I tried to open a binary file, it does not work
properly. The Writer looks like only handling characters.
How can I open a binary text file in my servlet code?
Thanks |
|
r*****s 发帖数: 985 | 2 Hi,
I have a servlet for downloading purpose, mapped as name called
"dlservlet". It gets the file from somewhere else and return
it back to the client as a binary stream.
However, anytime the user gets the file, the browser popups the
saveas dialog with the default filename as "dlservlet". My question
is, is there anyway that I can set the name in the popup saveas
dialog to be the original filename?
Thanks a lot! |
|
r*****s 发帖数: 985 | 3 got it, either revise the browser's setting, or add a random number
at the end of each servlet calling. the latter is preferred as we cannot
expect every user's cache setting to be none. |
|
l*********r 发帖数: 80 | 4 那位大虾给打一下?
bapps\HW3example\WEB-INF\lib\hw1_lib.jar;c:\jwsdp-1.3\common\lib\servlet-api.j |
|
l*********r 发帖数: 80 | 5 发了封信给你,十分感谢。
bapps\HW3example\WEB-INF\lib\hw1_lib.jar;c:\jwsdp-1.3\common\lib\servlet-api.j |
|
m******y 发帖数: 588 | 6 I need to transfer some parameters from php to servlet. Is it possible? Please
help me out if you knows! Thanks a million! |
|
m******y 发帖数: 588 | 7 But if I try to use dispatch in servlet to connect to a php page,
will it cause problem if Tomcat and Apache is installed separately? |
|
m******t 发帖数: 2416 | 8
I remember jakarta has a package that does that. Try google "servlet file
upload". |
|
p***p 发帖数: 559 | 9 我这个学期刚刚写了个类似网上住址登记处的PROJECT,用了JSP,SERVLET,WEBSERVICE
,JAAS和JMQ,EJB,MY SQL和XML DB。东西不少,但是基本是东拉西扯四处抄了些代码和
SAMPLE,最终可以运行了,错误还不少,什么SESSION,安全问题等等。之前基本不会编J
SP,粗通JAVA,能撺在一起跑起来已经是很不错了。
这个学期还要一个比较进阶的类似项目,我想好好从头学一下如何规规矩矩写一个类似网
站。总之是希望培养好的编程习惯,学习如何写个大结构,合理用哪些技术。程序细节地
方该如何写,一些经验之谈。还有比如编程和设计时候要考虑安全,效率等等问题,并且
符合商业化,接近工作中编程要求。
两个问题,首先有哪些书能比较有关方面全面指导,而且还包括很多小经验(类似Thinkin
g in Java)。另外哪里有些现成的工程例子和原代码,值得学习,多谢了。哪些网站和讨
论区
请问这本书如何
http://www.oreilly.de/catalog/jsvltjspckbk/ |
|
c**g 发帖数: 274 | 10 Is this a special case in JB? he mentioned if he "把所有BEAN或者
SERVLET打成个JAR文件,然后引入LIB" then no problem.
But as I understand, you always need to import the class if you don't want
to use full path name of a class and the compiled JSP is not under
the same package as that of the class you use, no matter you
"打成个JAR文件,然后引入LIB" or not. |
|
p***p 发帖数: 559 | 11 据我阅读,大概以下几种
SERVLET里面:
session.get/setAttribut("XXX",XXX)
request.set/getAttribut("XXX",XXX)
PageContext.get/setAttribut("XXX",XXX,SLOPE)
JSP里面可以直接用上面几个常量,或者set bean
请问前两种和最后一种有什么不同么?哪些利弊,一般用哪个
我转递一个自定义的BEAN,很奇怪的是只有session正常,其他都不对,好像程序死在那
里,也不出错,好怪。我觉得是最通常的应用呀,一般出问题会是什么地方呢
另外按一般经验,购物网站一般用REQUEST还是SESSION来保存比较合适。 |
|
p***p 发帖数: 559 | 12 一个普通的JSP/SERVLET实现的类似BBS应有。需要实现类似有短信给某个在线用户的时候
,马上提示该用户(比如弹出一个窗口)。
要求实时性很强,也就是即使该用户不刷屏也能得到消息,SERVER要PUSH。最好不要用每
隔两秒FLASH一下的办法,多谢了。 |
|
c***c 发帖数: 6234 | 13 I am looking for a tutorial that includes how to write a web client
(LSP/Servlet) to use existing web services (on different server)
Could you please give me some online tutorials? I can not use Lomboz. Just
pure code and not wizard
Highly appriciated |
|
z**k 发帖数: 65 | 14 小妹刚刚出道,很多不懂,请问服务端的日志是不是TOMCAT 的LOG
FILE(我的AXIS装在TOMCAT上)?我看了一下LOCALHOST_LOGXXX, 好像没有相关的信息。
请问AXIS有自己的LOG FILE 吗?
另外,为什么我从自己的LOCAL computer 可以成功调用(用main
function),可是从SEVLET
里就不行?错误里和weblogic.servlet.internal.ServletStubImpl.invokeServlet有关
,是不是因为THREAD的问题。请问在哪里可以找到相关的例子?
多谢多谢! |
|
x******o 发帖数: 31 | 15 is there any way that I can run a servlet from command line (like run CGI from
console)?
i am new for java.
thanks, |
|
c**g 发帖数: 274 | 16 No. Servlet is not POJO (Plain Old Java Object). |
|
c*****s 发帖数: 214 | 17 当然可以。任何java程序最终都可以(只可以)通过java命令运行
只是servlet没有main程序,
依赖别的实现,要运行需要container提供环境。启动container当然可以通过command
line了(从来不都是通过command line 的吗)。
比如 tomcat
java -cp $CATALINA_HOME/bin/bootstrap.jar
org.apache.catalina.startup.Bootstrap -Dcatalina.home=$CATALINA_HOME
-Dcatalina.base= start
CGI |
|
f****y 发帖数: 70 | 18 如果servlet extends HttpServlet没有实现doGet方法,但是request用get method,这
时候会产生什么情况? |
|
p***p 发帖数: 559 | 19 本来想用Datasource,可是JSP平台是jetty,不知道是否支持J2EE DB Pool,
就想简单在deployment description里面定义个变量,写一下数据库路径,
请问如何写,servlet如何获得。 |
|
p***p 发帖数: 559 | 20 Any servlet container, Tomcat jetty has it in /lib somehow |
|
d********r 发帖数: 199 | 21 有多种办法可以监测网络吞吐:
可以在Windows Task Manager中的Networking中
也可以用DUMeter,
我两者都用了,TCP overhead并不高。
我这两台电脑的硬盘对拷,双方都是SATA RAID0,Gigabit网络连接,
速度至少30MB /s ,GB网卡的利用率峰值可接近30% (300M bps)。
所以TCP overhead并不足以解释何以servlet的吞吐率只有3.5MBytes/s (30M bps),
仅为windows network neighbor 文件copy的 1/10。
不知何故? |
|
p***p 发帖数: 559 | 22 Servlet just used ServetSocket's I/O Stream, nothing to do with Container. |
|
m******t 发帖数: 2416 | 23
Hmm, no... servlet implementations (including HttpServletRequest and
HttpServletResponse) are container specific. I agree with you that ideally
when you get the output stream it should be exactly the underlying
socket stream, but there are too many layers in between to be sure
- for example, you never know if any filter suddenly decides to get
cute and wrap the output stream with its own buffered version. |
|
d********r 发帖数: 199 | 24 我在gigabit网上测过windows文件对拷。知道速度是多少。
现在先在100M网卡上测servlet,如果发现100M NIC是瓶颈,
我就会再在Gigabit LAN上再测一次。
结果发现速度太低,100M上只利用了30%的带宽,就没兴趣再在giga LAN上测了。
因为我没有gigabit switch,平常都是用100M,
如果要测gigabit的话,得用一根网线把两台PC的gigabit网卡直接连起来。
平时都是走100M switch的 |
|
d********r 发帖数: 199 | 25 这位大侠果然高见,真是一针见血啊。
我在原servlet程序的buffer里,加了一个"\r\n",
结果在Gigabit网上测试,传输率轻松达到了40MB/s,也就是平均约320Mbps,
峰值可达400Mbps。
佩服佩服。
看来现在的瓶颈在系统本身的总线带宽了。
\n |
|
r**i 发帖数: 1222 | 26 【 以下文字转载自 BuildingWeb 讨论区 】
发信人: romi (Romi), 信区: BuildingWeb
标 题: 请问godaddy.com所谓的支持Java是支持jsp吗?servlet支持吗?EJ
发信站: BBS 未名空间站 (Tue Apr 18 02:02:15 2006), 站内
rt, thx |
|
p***p 发帖数: 559 | 27 我想在Servlet里面读写文件,于是用getServletContex.getRealPath("/relativePath"),在LINUX
下面可以得到绝对路径,可是在Windows里面总是NULL。哪位能给段现成的Code,读写
一个Object入文件。 |
|
m******t 发帖数: 2416 | 28 I wouldn't write into anywhere under the servlet context. It may not always
work, e.g., when your app is deployed in a war file. |
|
A**o 发帖数: 1550 | 29 add servlet mapping as well...
first timer better used IDE to help you out. |
|
c***c 发帖数: 6234 | 30 Exactly. 每个新servlet,你需要在web.xml里添加两个地方。一个是mapping 一个是
sevelet name (你加的那个)。 |
|
S*******t 发帖数: 97 | 31 我有个servlet专门load image.不过通常这些image
都很大。我不希望用户一直等。如何在load image
的时候在页面上显示loading。。。然后load完了
以后直接转成image? thanks. |
|
e****e 发帖数: 418 | 32 First Head Servlets and Jsp |
|
r*****l 发帖数: 2859 | 33 This is integration of two systems. One the servlet,
one the standard alone Java app. |
|
A**o 发帖数: 1550 | 34 不知道你的production是什么环境,模拟prod的最佳方式还是
建立一个staging环境吧?
实在不行你自己写一个http服务器?
另外,cactus好像是junit在servlet上面的extention,不知道对你有用吗?
easyMock |
|
k***r 发帖数: 4260 | 35 Sounds like you can just starts multiple threads in the junit test class and
call into the servlet class? |
|
l*****b 发帖数: 82 | 36 以下是我的环境:
jboss, servlet, spring (just IOC container, no mvc), maven, Junit
测试是要在unit test阶段自动完成的。对于我的特殊情况,real container 和
JMeter 是不错的组合, JMeter可以模拟客户端的多线程。但我有以下问题:
1。 如何把JMeter整合到unit test中, 我不太熟悉有没有相关的JMeter API。
2。 如何把jboss加进unit test中, 如在setUp()方法中如何加载要测试的模块和启
动等步骤。 |
|
l*****b 发帖数: 82 | 37 Hi, magicfat , thank you. Many suggest to take "synchronized" out. My
Servlet has no any instance or static variable. Could I assume the un-
synchronized method is still thread safe? And this high CPU usage is normal
case for un-synchronized method? |
|
F****n 发帖数: 3271 | 38 Why you so care about high CPU usage? It means your requests are handled
concurrently and therefore faster. Servlet should not have state in most
cases, so there is really no need to make it thread safe. If you need to
access some stateful data, put them into some objects and make them thread
safe.
normal |
|
f*******y 发帖数: 348 | 39 I don't know how to get that message from servlet before the job is all
finished. |
|
t*******e 发帖数: 684 | 40 There are many ways to poll the web server to get the progress back. But the progress variable needs to be streamed through a Servlet or a Filter. The desktop client may use java.net.URL class, apache HTTPClient, even HTTPUnit to poll the server on that variable at 1 second intervals. Web services can be another choice. |
|
b**********g 发帖数: 806 | 41 我们这个东西是这样的,前端一个html的login界面,然后是一个servlet处理request.现
在想把这个做成一个webservices,同时还能把用户名跟密码一起传.这个SOAP
webservices,我从来没用过,所以不知道该怎么开始.从POJO做,是什么意思?多谢了. |
|
|
f*n 发帖数: 254 | 43 jboss做server,最基本的servlet,想列出诸如/subfolder1下所有文件
用File f1 = new File("/subfolder1"),但f1.isDirectory()returns false。。。
从而没法再运行list()。
请问应该怎么做?谢谢。。。 |
|
t*******e 发帖数: 684 | 44 这个和Servlet没什么关系。搞清Java IO的基本操作就可以了。确保path is valid. |
|
c********g 发帖数: 449 | 45 I think full path should be used in java servlets.
my codes for your reference:
static final String USER_DIR = "C:\\users\\";
static final String WORK_DIR = "C:\\work\\";
they have been really working on tomcat on Windows. |
|
m******t 发帖数: 2416 | 46 Best way I can think of is post the form using javascript. The servlet
renders
back an object tag. The javascript then dynamically inserts it onto the page.
forward
这样 |
|
t******h 发帖数: 120 | 47
呵呵
这个我当时倒没想到那么细
可以先让servlet处理一下再返回 |
|
m***i 发帖数: 213 | 48 我能想到的临时办法,就是把object里外倒置一下
把原来在object之外的页面内容,用object来显示,把object里的内容,放在object之外
这样servlet返回的顺理成章
frame |
|
|
u*e 发帖数: 965 | 50 Socket clientSocket = new Socket(ip, port);
clientSocket.close();
这2行放在main()没问题,放在Servlet里就不能频繁执行. |
|