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

» JWorld@TW » Application Server » Tomcat  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 我想要讓某個serlvet 在tomcat開啟的時候就啟動 web.xml該怎麼設定
nokia99





發文: 74
積分: 0
於 2004-09-21 11:33 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
如果我有一個class 他是自己跑動迴圈
裡面有

1
2
3
4
5
6
7
Timecheck()
    public void contextDestroyed( javax.servlet.ServletContextEvent event ) {
      System.out.println( "destory taskListener" );
    }
    public void contextInitialized( javax.servlet.ServletContextEvent event ) {
      System.out.println("Init Go!");
    }

那我現在要他跟著Tomcat 開啟而執行...
我應該寫
1
2
3
4
  <servlet>
    <servlet-name>DocCom</servlet-name>
    <servlet-class>doccom.Timecheck</servlet-class>
  </servlet>

我記得以前有在這裡看過...我是不是還要補上什麼字...
他開啟TOMCAT 才會跟著啟動...
請問一下知道的人


reply to postreply to post
作者 Re:我想要讓某個serlvet 在tomcat開啟的時候就啟動 web.xml該怎麼設定 [Re:nokia99]
chlin





發文: 1
積分: 0
於 2004-09-21 12:05 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
Try this. Smile

1
2
3
4
5
<servlet>    
<servlet-name>DocCom</servlet-name>    
<servlet-class>doccom.Timecheck</servlet-class>
<load-on-startup/>
</servlet>


reply to postreply to post
作者 Re:我想要讓某個serlvet 在tomcat開啟的時候就啟動 web.xml該怎麼設定 [Re:nokia99]
shirley_wang





發文: 3
積分: 0
於 2004-09-21 12:30 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
Use Listener:

<listener>
<listener-class>doccom.Timecheck</listener-class>
</listener>

BR/Shirley


reply to postreply to post
作者 Re:我想要讓某個serlvet 在tomcat開啟的時候就啟動 web.xml該怎麼設定 [Re:chlin]
nokia99





發文: 74
積分: 0
於 2004-09-21 14:12 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
chlin wrote:
Try this. Smile

1
2
3
4
5
<servlet>    
<servlet-name>DocCom</servlet-name>    
<servlet-class>doccom.Timecheck</servlet-class>
<load-on-startup/>
</servlet>



我加了...
但是好像還是不會動耶...
我記得我以前可以動耶@@


reply to postreply to post
作者 Re:我想要讓某個serlvet 在tomcat開啟的時候就啟動 web.xml該怎麼設定 [Re:chlin]
zanta





發文: 78
積分: 4
於 2004-09-21 23:36 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
chlin wrote:
Try this. Smile

1
2
3
4
5
<servlet>    
<servlet-name>DocCom</servlet-name>    
<servlet-class>doccom.Timecheck</servlet-class>
<load-on-startup/>
</servlet>



咦,我記得應該是
1
<load-on-startup>1</load-on-startup>


reply to postreply to post
作者 Re:我想要讓某個serlvet 在tomcat開啟的時候就啟動 web.xml該怎麼設定 [Re:nokia99]
Future





發文: 2
積分: 0
於 2004-10-10 22:52 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
你可以把你需要初始化的代码放在Servlet的init()中,然后在web.xml中做注册,我就是这样做的。

reply to postreply to post
» JWorld@TW »  Application Server » Tomcat

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

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8