• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

joinfaces/joinfaces-maven-war-example: JoinFaces Maven War Example

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

joinfaces/joinfaces-maven-war-example

开源软件地址(OpenSource Url):

https://github.com/joinfaces/joinfaces-maven-war-example

开源编程语言(OpenSource Language):

Java 78.4%

开源软件介绍(OpenSource Introduction):

JoinFaces War Example

Heroku Build Status Codecov Bugs License

This SAP (Single Page Application) illustrates JSF usage inside WAR packaged Spring Boot Application.

JoinFaces autoconfigures PrimeFaces, PrimeFaces Extensions, AdminFaces, BootsFaces, ButterFaces, IceFaces, RichFaces, RichFaces-AYG, Tobago, OmniFaces, AngularFaces, Mojarra and MyFaces libraries to run at embedded Tomcat, Jetty or Undertow. It autoconfigures Weld and Rewrite too.

Run Example Application locally

1- Clone this project

git clone https://github.com/joinfaces/joinfaces-example-war.git

2- Build

mvn clean install

3- Copy into tomcat

4- Start tomcat

5- Access starter page at http://localhost:8080/joinfaces-example/. This page can help you to choose the JoinFaces Starter that fits your needs. You may log in with credentials

User Password Roles
persapiens 123 ROLE_ADMIN
nyilmaz qwe ROLE_USER

Optional: If your IDE is showing build errors install Lombok

Key Files

pom.xml

Includes joinfaces starter dependency. All other jsf dependencies are included transitively.

<properties>
   <joinfaces.version>4.7.0</joinfaces.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.joinfaces</groupId>
            <artifactId>joinfaces-dependencies</artifactId>
            <version>${joinfaces.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>org.joinfaces</groupId>
    <artifactId>jsf-spring-boot-starter</artifactId>
  </dependency>
</dependencies>

Note that security-spring-boot-starter is included to secure the application.

<dependencies>
    <dependency>
        <groupId>org.joinfaces</groupId>
        <artifactId>security-spring-boot-starter</artifactId>
    </dependency>
</dependencies>

src/main/resources/application.yml

Configure jsf.PROJECT_STATE and jsf.primefaces.THEME properties.

joinfaces:
  jsf:
    PROJECT_STAGE: Development
  primefaces: 
    theme: overcast

src/main/webapp/starter.xhtml

Example page to help you choose the right JoinFaces Starter for you.

Note that xhtml, js, css and images files should be located at src/main/resources/META-INF/resources directory to JSF use them.

Look at authorize and anonymous jsf spring security facelet tags in action to secure page information.

  <sec:authorize access="hasRole('ROLE_ADMIN')">
    <p:panelGrid columns="1" rendered="#{sec:isFullyAuthenticated()}">
      <p:link title="Logout" href="/logout">
        <p:outputLabel value="You are logged in as an ADMIN" />
      </p:link>
    </p:panelGrid>
  </sec:authorize>

src/main/java/org/joinfaces/example/JoinFacesExampleApplication.java

Very simple spring main application. Only SpringBootApplication configuration is required.

@SpringBootApplication
public class JoinFacesExampleApplication {

src/main/java/org/joinfaces/example/SecurityConfig.java

Spring Security configuration class to secure authentication with credentials to persapiens and nyilmaz users.

src/main/java/org/joinfaces/example/view/HelloWorldMBean.java

Managed bean using ViewScoped CDI annotation. The equivalent spring scope of ViewScoped annotation is configured automatically by JoinFaces Starter.

@Named
@ViewScoped
public class StarterMBean {

Getting Help

Contributing




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap