註冊 | 登入 | 全文檢索 | 排行榜 |
![]() |
» JWorld@TW
» Servlet/JSP 討論區
![]() ![]() |
![]() ![]() ![]() ![]() |
本主題所含的標籤 |
作者 | web.xml設定問題 | ||
weberhwang
![]() ![]() ![]() ![]() ![]() ![]() 發文: 53 積分: 0 ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() 大家好 環境: Windows 10 pro 繁體中文版 Tomcat 8.5.37 Servlet 3.1 請問 我想在web.xml中設定,當user亂輸入網址時,自動轉至index.jsp(首頁) 例如:我自己的網址是 http://localhost:8081/myWebSite/index.jsp 但有人輸入 http://localhost:8081/myWebSite/xxxx123123.jsp 時,將它導引至index.jsp頁面 所以我就加了最下面紅色那段(63-70行 顏色有點跑掉), 我的想法是「當前面所有的url patten都mapping不到時,最後就引導至index.jsp」
但我發現,只要我一設定後,啟動Server就會出錯,無法啟動Server(若把該段設定拿掉又可以正常啟動Server), 錯誤訊息,如下 不知是那邊用法上出了問題? 各位先進指點 感謝。 一月 15, 2019 10:34:21 下午 org.apache.catalina.deploy.NamingResourcesImpl cleanUp 警告: Failed to retrieve JNDI naming context for container [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myWebSite]] so no cleanup was performed for that container javax.naming.NamingException: No naming context bound to this class loader at org.apache.naming.ContextBindings.getClassLoader(ContextBindings.java:268) at org.apache.catalina.deploy.NamingResourcesImpl.cleanUp(NamingResourcesImpl.java:1019) at org.apache.catalina.deploy.NamingResourcesImpl.stopInternal(NamingResourcesImpl.java:1002) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5514) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:264) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:856) at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1042) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:856) at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1042) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:883) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.startup.Catalina.start(Catalina.java:691) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493) 補充:我自己有另外試了下面這個方法是可行的,只是不知前述方法為何不行 <error-page> <error-code>404</error-code> <location>/index.jsp</location> </error-page> 最後想請問...像我用 Tomcat 8.5.37 + Servlet 3.1 的話,關於web.xml的官方文件, 要去那邊找,我自己找了半天,大多是網友提供的片段教學, 不知有詳細的官方文件網址嗎? ![]() ![]() |
話題樹型展開 |
人氣 | 標題 | 作者 | 字數 | 發文時間 |
760 |
![]() | weberhwang | 5121 | 2019-01-15 22:58 |
650 |
![]() ![]() | kentyeh | 505 | 2019-01-16 17:00 |
594 |
![]() ![]() ![]() | weberhwang | 715 | 2019-01-16 19:21 |
562 |
![]() ![]() ![]() ![]() | kentyeh | 341 | 2019-01-17 10:14 |
614 |
![]() ![]() ![]() ![]() ![]() | weberhwang | 1480 | 2019-01-17 13:27 |
709 |
![]() ![]() ![]() ![]() ![]() ![]() | kentyeh | 170 | 2019-01-17 15:55 |
» JWorld@TW » Servlet/JSP 討論區 |
![]() ![]() ![]() ![]() |
![]() ![]() ![]() |