GithubHelp home page GithubHelp logo

joinfaces / joinfaces-maven-jar-example Goto Github PK

View Code? Open in Web Editor NEW
83.0 11.0 78.0 3.23 MB

JoinFaces Maven Jar Example

Java 78.84% CSS 0.19% HTML 18.70% JavaScript 0.09% FreeMarker 2.18%
joinfaces jsf spring-boot mojarra myfaces jetty tomcat undertow primefaces angularfaces bootsfaces butterfaces

joinfaces-maven-jar-example's Introduction

JoinFaces Example

Build Status Codecov Bugs License

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

JoinFaces autoconfigures PrimeFaces, PrimeFaces Extensions, Apache MyFaces Tobago, OmniFaces, AdminFaces, Mojarra and MyFaces libraries to run at embedded Tomcat, Jetty or Undertow. It autoconfigures Weld, Apache OpenWebBeans and Rewrite too.

Run Example Application locally

1- Clone this project

git clone https://github.com/joinfaces/joinfaces-maven-jar-example.git

2- Build

mvn clean install

3- Run

java -jar target/joinfaces-example-5.4.x.jar

4- Access starter page at http://localhost:8080/ 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>5.4.0-m1</joinfaces.version>
</properties>

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

<dependencies>
  <dependency>
    <groupId>org.joinfaces</groupId>
    <artifactId>faces-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 faces.PROJECT_STATE and faces.primefaces.THEME properties.

joinfaces:
  faces:
    PROJECT_STAGE: Development
  primefaces: 
    theme: overcast

src/main/resources/META-INF/resources/content/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 annotation 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/StarterMBean.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

joinfaces-maven-jar-example's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar larsgrefer avatar melloware avatar persapiens avatar snyk-bot avatar towncube avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joinfaces-maven-jar-example's Issues

Reload

Marcelo,

Primeiramente parabéns pelo seu trabalho, sou iniciante e gostaria de esclarecer uma dúvida.
Sempre que altero um arquivo xhtml, o servidor não le minha alteração e sou obrigado a reiniciar a aplicação, é assim mesmo?

Abraços!
Samir

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.