I am new in reactjs and I have a little project in reactjs to play with and learn it. I need to have to type of headers which will be shown based o
My solution is like a workaround for JSP engines (e.g. Tomcat), but it works great with minimal code.
I created an "index.jsp" parallel to "index.html" (in the content root folder) with following code:
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@include file="index.html"%>
I configured all urls to redirect to this JSP in web.xml
web.xml
index
index.jsp
index
/*
Now any URL requested to Tomcat will internally get redirected to index.jsp that is effectively index.html. Once react-router loads in browser, it takes care of rendering the right component and subsequent requests.