首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >错误:选项-Xbootclasspath/p:在清洁构建JSF web应用程序时目标11不允许

错误:选项-Xbootclasspath/p:在清洁构建JSF web应用程序时目标11不允许
EN

Stack Overflow用户
提问于 2021-04-16 07:24:21
回答 1查看 207关注 0票数 0

我试图运行简单的JSF应用程序(Java ),在windows中使用JDK11.0.4和apache 12.1单击按钮时,将数据从一个页面发送到另一个页面。当我清理构建项目时,它会显示“error:/p:不允许目标11”。

JSF框架版本

  1. 托管豆
代码语言:javascript
运行
复制
package model;

import javax.inject.Named;
import javax.enterprise.context.RequestScoped;

@Named(value = "bean1")
@RequestScoped
public class bean1 {

    String nm;

    public String getNm() {
        return nm;
    }

    public void setNm(String nm) {
        this.nm = nm;
    }
    
    /**
     * Creates a new instance of bean1
     */
    public bean1() {
    }
    
}
  1. page1.xhtml
代码语言:javascript
运行
复制
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <h:head>
        <title>Page 1</title>
    </h:head>
    <h:body>
        <h2>Hello Page 1</h2>
        <h:form>
            <h:outputLabel for="txtName"></h:outputLabel>
            <h:inputText id="txtName" value="#{bean1.nm}" />
            #{bean1.nm}
            <h:commandButton value="SEND" />
        </h:form>
    </h:body>
</html>

3.page2.xhtml

代码语言:javascript
运行
复制
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <title>Page2</title>
    </h:head>
    <h:body>
        #{bean1.nm}
    </h:body>
</html>

4.web.xml

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <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>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsf</welcome-file>
    </welcome-file-list>
</web-app>

5.faces-config.xml

代码语言:javascript
运行
复制
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.3"
              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_3.xsd">

</faces-config>

它仍然会被部署并运行,在浏览器上运行之后,当我单击按钮page1.xhtml时会出现以下错误

误差图像

EN

回答 1

Stack Overflow用户

发布于 2021-04-19 15:46:30

现在,在创建一个具有新项目名称.Keep的新java应用程序之后,这个问题已经解决了--请记住,不要使用与当前项目提供的名称相同的名称,例如:如果我的这个项目名是JSFDemo,那么新的项目名应该是JSFDemo以外的其他名称,因此只能解决:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67120828

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档