Running the Designer and Viewer with Spring Boot
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.This example hosts both the Stimulsoft web viewer and the web designer in a single Spring Boot application using server-rendered views.
The viewer action. The controller loads and renders a report, builds a
The designer action. A second mapping opens the same report in the designer, with a handler that processes designer requests such as saving:
How it works. Each Spring route (
The viewer action. The controller loads and renders a report, builds a
StiWebViewerOptions, and adds both to the model:@Controller
public class StimulsoftController {
@Autowired
ServletContext context;
@GetMapping("/viewer")
public String viewerAction(Model model) throws Exception {
String reportPath = context.getRealPath("/reports/Dashboards.mrt");
StiReport report = StiSerializeManager.deserializeReport(new File(reportPath));
report.render();
StiWebViewerOptions options = new StiWebViewerOptions();
options.getToolbar().setViewMode(StiWebViewMode.Continuous);
model.addAttribute("report", report);
model.addAttribute("options", options);
return "viewer";
}
}The designer action. A second mapping opens the same report in the designer, with a handler that processes designer requests such as saving:
@GetMapping("/designer")
public String designerAction(Model model) throws Exception {
String reportPath = context.getRealPath("/reports/Dashboards.mrt");
StiReport report = StiSerializeManager.deserializeReport(new File(reportPath));
StiWebDesignerOptions options = new StiWebDesignerOptions();
model.addAttribute("report", report);
model.addAttribute("options", options);
return "designer";
}How it works. Each Spring route (
/viewer, /designer) prepares a report on the server, attaches it and its options to the model, and returns the name of a view template that emits the Stimulsoft component. This gives you a complete edit-and-preview workflow — view a report, jump into the designer, and back — entirely within a Spring Boot application.