Git Product home page Git Product logo

react-portlet's Introduction

React Portlet

An old portlet with a new face!

Getting Started

  1. Javascript framework used: React framework
  2. Tool to build our javascript application: Yarn
  3. UI library used: Material UI

Yarn does not have to be installed locally on your system to build the application. Yarn and node will be downloaded and installed via the maven build process. This is all handled by the frontend maven plugin.

Prerequisites

  1. maven 3+
  2. jdk 7+ (preferably 8)

Installing

mvn clean package
cd $UPORTAL_SOURCE
ant deployPortletApp -DportletApp=/path/to/portlet.war

React Setup

We added the react code to the project using the tool create-react-app. After that we ejected from the create-react-app project. This allows us to change the transpilied javascript output file name. When you build a react application the output filenames have the file hash appended. An example would be something like index.abef34d.js. The filename changes every time the project is built. This makes it difficult for us to include the javascript file in our JSP file. We modified the file webpack.config.prod.js to remove '[hash]' from all output files.

If we take a look at main.jsp we can see that we are including the javascript file containing our react code. You will also see an empty div with the id of "app". If we have multiple react portlets on the same page, make sure that the id is unique per portlet. Otherwise react will render ALL portlets to the same div. Looking at index.js we can see where the react application figured out where it needs to render to.

The way this project is setup is for NO external CSS files. All CSS must be done essentially in-line. This will help prevent portlet's CSS bleeding into others on the page.

Building The Project

As stated before, you do not need to build the react side of the project by its self. The maven process will build and copy the generated artifacts to the correct location for you. But if you wish to build the react project by hand, go to the src/main/react/ directory and do either a npm run build or a yarn run build.

react-portlet's People

Contributors

bpowell avatar

Watchers

James Cloos avatar

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.