谁帮我看看我的这个web.xml 里面的 url-pattern错了吗?我只想要个以jsp结尾的url

doudouluo77 2007-09-13
这个小程序是通过Appfuse 1.9.4产生的。web.xml里面我是这样写的。

<servlet>
      <servlet-name>Faces Servlet</servlet-name>
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
     <load-on-startup>2</load-on-startup>
  </servlet>

  <servlet-mapping>
     <servlet-name>Faces Servlet</servlet-name>
     <url-pattern>*.faces</url-pattern>
  </servlet-mapping>

那么这个url是可以工作的: http://localhost/appfuse/login.faces


可是我想通过这个url工作:  http://localhost/appfuse/login.jsp


于是我把url-pattern改成:*.html,  然后通过 http://localhost/appfuse/login.jsp 来呼叫,得到下面这个错误:
[appfuse] ERROR [http-80-Processor25] UIComponentTag.setupResponseWriter(612) | Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml.


然后我又改成*.jsp, 得到下面的不断滚动的错误:
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
at org.apache.myfaces.application.jsp.

改成"/*", 也不行。

最后改成"/path2/*" , 然后url改成: http://localhost/appfuse/path2/login.jsp
这个可以工作,可是路径却深了一层。

怎么才可以在 http://localhost/appfuse/login.jsp  下工作呢?

谢谢指教啊!!

doudouluo77 2007-09-14
有一点我说错了,

在用*.html 的时候,然后呼叫

http://localhost/appfuse/login.jsp

我得到的错误是:

java.lang.NullPointerException
at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:646)
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:254)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:90)
at org.apache.jsp.login_jsp._jspx_meth_f_view_0(org.apache.jsp.login_jsp:179)
at org.apache.jsp.login_jsp._jspService(org.apache.jsp.login_jsp:99)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

谁知道怎么回事么?

我的login.jsp确实含有jsf的Tag.

xxqn 2007-10-06
<!-- JSF -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jspx</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

以上可以通过http://localhost/appfuse/login.jsp
访问实际的/appfuse/login.jspx
Global site tag (gtag.js) - Google Analytics