Running the React Viewer
Our sample projects and report templates can help you learn the basics of working with our products.The Stimulsoft React viewer runs as a front-end component that talks to a Java backend (a Java SE servlet) through a request URL.
Render the React viewer component.
How it works. The React front end renders in the browser and calls the a Java SE servlet backend for data and actions, splitting UI from server logic.
Render the React viewer component.
import { StimulsoftViewer } from 'stimulsoft-viewer-react';
export const App = () => (
<StimulsoftViewer
requestUrl="http://localhost:8080/viewer/react_viewer?a={action}"
action="InitViewer"
properties={{ reportName: 'Dashboards.mrt' }}
height="100vh"
/>
);Handle requests in the Java servlet.public class StiReactViewerActionServlet extends HttpServlet implements StiReactViewerHandler {
protected void processing(HttpServletRequest request, HttpServletResponse response) {
StiWebViewerActionServletHelper.processing(
new StiHttpServletRequest(request, this), new StiHttpServletResponse(response));
}
}<StimulsoftViewer requestUrl properties>— the React component;requestUrlpoints at the Java action endpoint.StiReactViewerHandler— the servlet processes the viewer's actions and returns the report data.
How it works. The React front end renders in the browser and calls the a Java SE servlet backend for data and actions, splitting UI from server logic.