English 中文(简体)
开放JSF2脸书页面后,JSP档案中的404页结果。
原标题:Opening a JSF2 Facelets page results in a 404 on a JSP file

我创建了一个新项目, 名为“ a href=” 。 http://www.4 shared.com/ photo/ 39FUSNfF/what.html” rel=“ nofollow” > JSF 工具教程 - 构建一个 JSF 2. 0 应用程序

当我尝试右键点击 m.xhtml 并选择服务器运行时,我在 m.jsp 上有一个404错误。

浏览器地址栏中的 URL 是:http://localhost:8080/marwa/m.jsf

错误消息上写着", http://www.4 shared.com/pho/ 39FUSNfF/what.html" rel="nofollow" >HTTPstatus 404 -/Marwa/m.jsp

原因何在,我怎样才能解决?

这是我的web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
 <display-name>Marwa</display-name>
  <welcome-file-list>
    <welcome-file>m.xhtml</welcome-file>

  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
   <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
   <param-value>false</param-value>
  </context-param>
  <context-param>
   <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
   <param-value>true</param-value>
  </context-param>

</web-app>
最佳回答

它正在寻找一个 JSP 文件, 而不是一个 Flacelets 文件 。

JSP是旧JSF 1.x的默认视图技术。 这个问题因此表明您实际使用 JSF 1.x 或正在运行 JSF 1.x 的 JSF 2.x 。

确保您在那里真的有 JSF 2.x 图书馆。 您可以查看 JSF 的准确版本, 查看服务器启动日志, 或者用拉链工具提取 JSF JAR 文件, 并阅读 MINIFEST 文件。 您也可以在 < a href=" http://myfaces. papache. org/ download. html" rel=“ nofollow” > http://myfaces.apache.org/ download. html (或者 < a href="http://javaserverfaces.java. net/" rel="nofollows" > 上重新下载正确的版本 。 请确保您获得 2.x 版本 。

确保faces- config.xml 被宣布为符合 JSF 2.x spec 版本。 它应该这样看:

<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <!-- Config here -->

</faces-config>

如果您的 Eclipse 没有自动这样做, 那么您显然会重新使用过时的 Eclipse 版本 。 首次在 Java EEE 的 Eclipse Helios ( 3. 6) 中引入了 Guiltin JSF2 支持 。 您可以在 < a href=" http:// www. eclipse. org/ downloads/ " rel=“ nofollow" > http:// www. eclipse. org/ downloads/ 中获取最新版本, 目前为 Indigo SR2 (3. 7.2) 。

问题回答

暂无回答




相关问题
How to change the width of h:outputLabel

I am having a hard time trying to change the width of my h:outputLabel, but I still could not get it changed. By using CSS, I can change the color, font, frame, anything but NOT the WIDTH. Thank you ...

JSF problem with FireFox 3.5 caching, wyciwyg:// prefix

I am new to JSF and have a problem with my simple JSF application. I use Facelets and Richfaces on WebLogic 10.3.2 (11g). The application is essentially 3 pages: A <--> B <--> C where the ...

How to freeze or disable an update input form

I wonder if it is possible for me to freeze or disable the entire update form? I have an input h:form with a check box in it. when users check the box, I would like to freeze or disable the entire ...

Inner UI:repeat does not bind to a bean in a nested UI:repeat

HI, I am using nested ui:repeats to display my data. the outer UI:repeat works and binds to bean just fine, but the inner does not bind to the bean. In sumary, I would like to display a list of people ...

热门标签