JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Application Server » Tomcat  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Tomcat 如何跑 CGI ? [精華]
proshine_roger





發文: 6
積分: 0
於 2005-01-11 17:53 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我照 O'reilly Tomcat 書上所說,
將 servlets-cgi.renametojar 改為 servlets-cgi.jar
並於 Web.xml 的
<servlet><servlet-name>cgi</servlet-name>....</servlet>

<servlet-mapping>....</servlet-mapping>
註解拿掉

再把 cgi 程式放到 webapps\ROOT\WEB-INF\cgi 下

restart tomcat 後,仍無法執行
出現下面錯誤訊息
--------------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
java.io.IOException: CreateProcess: perl "C:\Tomcat 4.1\webapps\ROOT\WEB-INF\cgi\printenv.pl" error=2
  at java.lang.Win32Process.create(Native Method)
  at java.lang.Win32Process.<init>(Win32Process.java:66)
  at java.lang.Runtime.execInternal(Native Method)
  at java.lang.Runtime.exec(Runtime.java:566)
  at java.lang.Runtime.exec(Runtime.java:428)
  at org.apache.catalina.servlets.CGIServlet$CGIRunner.run(CGIServlet.java:1718)
  at org.apache.catalina.servlets.CGIServlet.doGet(CGIServlet.java:599)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)

--------------------------------------------------------------------------------
;我試了三台電腦,都是這個結果

請問有人可以幫幫我嗎,感謝

我的環境是 windows 2000 Professional + j2sdk1.4.2_05 + tomcat-4.1.31

printenv.pl的程式內容
--------------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/local/bin/perl
##
##  printenv -- demo CGI program which just prints its environment
##
 
print "Content-type: text/html\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}
 
`pause`


proshine_roger edited on 2005-01-12 10:13
reply to postreply to post
心是人類的最大戰場
話題樹型展開
人氣 標題 作者 字數 發文時間
13183 [精華] Tomcat 如何跑 CGI ? proshine_roger 1626 2005-01-11 17:53
11087 Re:Tomcat 如何跑 CGI ? jimmy14 252 2005-01-12 00:13
9584 Re:Tomcat 如何跑 CGI ? yenchechang 308 2007-07-31 15:56
10793 Re:Tomcat 如何跑 CGI ? proshine_roger 238 2005-01-12 10:11
11029 Re:Tomcat 如何跑 CGI ? jimmy14 103 2005-01-12 12:17
10842 Re:Tomcat 如何跑 CGI ? proshine_roger 207 2005-01-12 12:38
11801 Re:Tomcat 如何跑 CGI ? jimmy14 1768 2005-01-12 14:12
10931 Re:Tomcat 如何跑 CGI ? proshine_roger 1390 2005-01-12 14:48
10563 Re:Tomcat 如何跑 CGI ? hkdennis2k 42 2005-01-12 18:31
10721 Re:Tomcat 如何跑 CGI ? proshine_roger 1504 2005-01-12 18:42
10814 Re:Tomcat 如何跑 CGI ? jimmy14 348 2005-01-12 19:32
10890 Re:Tomcat 如何跑 CGI ? proshine_roger 49 2005-01-14 11:03
» JWorld@TW »  Application Server » Tomcat

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8