- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章IDEA 2020.2 部署JSF项目的详细过程由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
。
idea2021最新激活方法 。
去官网下载glassfish4.1.1(最后发现glassfish5也行) 。
官网地址:GlassFish 。
https://javaee.github.io/glassfish/ 。
点击download 。
选择图中版本 。
下载完解压到自己指定的目录即可 。
。
将glassfish的bin目录添加到系统变量path中 。
。
将之前系统环境变量path里的jdk1.8的环境变量上移到第一个 。
注意:jdk一定要是1.8,并且必须移到第一个 。
。
在cmd里直接输入 asadmin start-domain ,出现下图所示即表明配置成功 。
再输入 asadmin stop-domain 可以停止glassfish 。
。
1.选择 java Enterprise, 点击next 。
2.勾选 Web Profile,IDEA会自动帮你勾选其他所需要的框架(包括JSF),点击next 。
3.输入模块名,点击finish 。
4.IDEA生成默认的项目结构 。
5.默认pom文件内容 。
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>jsf-03</artifactId> <version>1.0-SNAPSHOT</version> <name>jsf-03</name> <packaging>war</packaging> <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> <junit.version>5.6.2</junit.version> </properties> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>8.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.0</version> </plugin> </plugins> </build></project>
6.修改默认生成文件,不修改会报错 。
<faces-config 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-facesconfig_2_2.xsd" version="2.2"> </faces-config>
7.在webapp目录下新建index.xhtml文件 。
<?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:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"><f:view> <h:outputLabel value="Hello, world"/></f:view></html>
8.配置运行环境 。
点击运行->编辑配置 。
9.点击左上角➕,选择glassfish,local 。
10.点击配置,找到自己解压的glassfish的根目录 。
11.点击部署,点击➕,点击工件,选择war_explore结尾的 。
12.点击应用,点击服务器,修改默认生成的url 。
13.点击确定, 启动服务器,在浏览器里输入相应链接进行访问 。
。
1.页面代码如图所示 。
<?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" xml:lang="en" lang="en" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core"><head> MessagesTags</head><h:head></h:head><h:body> <h:form> <h:panelGrid columns="1" width="60%"> <f:facet name="header">Login</f:facet> <f:facet name="footer"> <h:outputText value="快到中秋节了"/> <h:commandButton action="Layoutpage" value="Submit"/> </f:facet> <h:panelGroup> <h:outputText value="Enter ID:"/><h:inputText id="it1" required="true" requiredMessage="ynb"/> <h:message for="it1"/> </h:panelGroup> <h:panelGroup> <h:inputSecret required="true"> <h:outputLabel value="Enter Password"/> </h:inputSecret> </h:panelGroup> </h:panelGrid> <h:messages/> </h:form></h:body></html>
2.运行效果图 。
3.报错代码:
Error in event handler: Error: Failed to execute "appendChild" on "Node": This node type does not support this method. at Updater.check (chrome-extension://fhopckooaleifhophcpcakhfkajmnffo/js/gmWrapper.js:4:3204) at init (chrome-extension://fhopckooaleifhophcpcakhfkajmnffo/js/jquery-1.7.2.js:1:3311) at onReadyGM (chrome-extension://fhopckooaleifhophcpcakhfkajmnffo/js/jquery-1.7.2.js:1:76) at Object.onInitializedGM (chrome-extension://fhopckooaleifhophcpcakhfkajmnffo/js/gmWrapper.js:4:636) at Object.callbackResponse (chrome-extension://fhopckooaleifhophcpcakhfkajmnffo/js/gmWrapper.js:4:331) at chrome-extension://fhopckooaleifhophcpcakhfkajmnffo/js/gmWrapper.js:4:3378 。
4.原因,web.xml 文件配置错误 。
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> <display-name>JSF_SE_CH2_html01_0915</display-name> <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> </servlet-mapping> <context-param> <description>State saving method: "client" or "server" (=default). See JSF Specification 2.5.2</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>resources.application</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <welcome-file-list> <welcome-file>faces/index.xhtml</welcome-file> </welcome-file-list></web-app>
5.解决办法,将web.xml文件内容删除,只保留 <welcome-file-list> 即可 。
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0"> <display-name>JSF_SE_CH2_html01_0915</display-name> <welcome-file-list> <welcome-file>faces/index.xhtml</welcome-file> </welcome-file-list></web-app>
6.运行截图,至此,大功告成! 。
到此这篇关于IDEA 2020.2 部署JSF项目的文章就介绍到这了,更多相关IDEA 2020.2 部署JSF项目内容请搜索我以前的文章或继续浏览下面的相关文章希望大家以后多多支持我! 。
原文链接:https://blog.csdn.net/happy488127311/article/details/120299408 。
最后此篇关于IDEA 2020.2 部署JSF项目的详细过程的文章就讲到这里了,如果你想了解更多关于IDEA 2020.2 部署JSF项目的详细过程的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
我试图了解 JSF 实现如何识别用户的各种可能操作。在我放在一起的简单应用程序中,我在 login.xhtml 页面中配置了以下字段。 用户名 - 输入字段 密码 - 密码字段 登录按钮 取消按钮 登
我已经开始学习 JSF,我想知道在我们的类路径中包含什么 JAR 以开始使用 JSF。是jsf-api或 jsf-impl ?或者我们必须同时包含两者?如果两者都是,那么为什么它们不合并? 最佳答案
我是 java server faces (JSF) 的初学者,我需要将文本输入的内容传递到第二页以显示它,同样适用于第二页:我想将单选按钮值传递到第三页。我搜索并尝试了很多但没有成功。例如我试过
我有一个 JSF 页面。我的 CommandButton 操作方法值取决于 bean 变量值。 例子: Bean headerBean 具有可变的 actionValue,值为“someBean.do
我有两个 JSF 页面,假设 A 和 B。从这两个页面 A 和 BI 可以导航到页面 C。现在页面 C 中有一个按钮(确定按钮),单击它应该导航回 A 或 B,具体取决于从哪里(A 或 B)调用 C
我可以在没有 JSTL 标签的情况下使用 JSF 执行条件逻辑吗? 例如,我制作了一个复合组件,并想说明,如果指定了“id”属性,则定义“id”属性,但如果未指定“id”属性,则不要指定“id”属性。
我有一个应用程序,用户可以在其中从我的应用程序的欢迎页面动态切换语言环境。我看到早期的开发人员(在没有太多文档的情况下继承了代码)已经从 ViewHandler 覆盖了以下三个方法,并告诉我这是动态切
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
有没有一种方法可以在我的 JSF 2.0 应用程序中处理浏览器刷新事件,以便在浏览器刷新页面时将用户导航到欢迎页面? 这让我想到了另一个问题,即如何在托管 bean 中进行页面导航? 干杯, 最佳答案
我有两页。搜索页面是第一个接受用户输入的页面。第二页显示数据表中的结果集。第二页有 3 个面板,用于结果集、更新和在单个页面中创建。根据单击的按钮,我将面板呈现为真和假。 . . . . . .
由于我们在 Asp.Net 中有 comparevalidator,我们在 JSF 中有什么来验证两个字段的值是否相同?我想验证密码和确认密码字段。 最佳答案 不,这样的验证器在基本的 JSF 实现中
我想构建一个自定义 JSF 组件。现在我从 oracle 阅读了一些文档并看到了一些代码示例。问题是我有点困惑: 似乎有两种方法可以使用 JSF 2.0+ 构建自定义组件。据我了解,自 JSF 2.0
我遇到了与 user1598186 在他的问题中提到的相同的问题:p:commandButton doesn't call bean's method in an page 但是,没有给出解决方案(
这个问题在这里已经有了答案: Ajax update/render does not work on a component which has rendered attribute (1 个回答)
是否有内置机制可以有条件地重定向到另一个 View ?如果他/她已经登录,我希望用户从登录页面重定向到“主页”。 我已经有两种基本方法,但对于第一种我不知道如何实现,第二种是一种肮脏的解决方法。 添加
如何在 JSF 中格式化值 我需要格式化一个数字,如:12345.67 到 12,345.67 可以用模式吗? 最佳答案 尝试使用: 关于jsf - 用逗号格式化为数字 JSF,我们在Sta
根据this blog JSF 正在走向无状态。使用 JSF 的全部意义不在于它使保存和恢复状态成为一件苦差事。 JSF 成为无状态的有什么意义?您能否提供一个有用的示例。 最佳答案 首先,我想澄清
我读到某个地方(不再找到它),可以在资源包中使用EL Expresions,然后在不更改* .xhtml文件的情况下使用它。 some.text=#{someBean.stepsLeft} more
我想看一个简单的登录应用程序,不像this那么简单尽管。 我想要实现的是对 JSF 的工作原理的理解,我开发了很多 ASP.NET,您可以在其中隐藏代码,并且您可以在其中检查是否在登录时创建了 ses
如果#{myBean.birthdate}是java.util.Calendar或java.util.Date类型,我可以格式化吗this 在 EL 本身内部可能使用现有函数,其输出类似于 DateF
我是一名优秀的程序员,十分优秀!