Custom applications let you embed server-side logic directly into WebJET CMS pages using Spring-based components. Each application is a Java class annotated withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/webjetcms/webjetcms/llms.txt
Use this file to discover all available pages before exploring further.
@WebjetComponent that renders its output into the page wherever you place an !INCLUDE()! tag.
What a custom application is
A custom application is a Spring-managed Java class that extendsWebjetComponentAbstract. It:
- is embedded in any web page using the
!INCLUDE()!directive - maps URL parameters to handler methods automatically
- can accept parameters from the include tag (e.g.
country="sk") - renders output via Thymeleaf, Freemarker, or JSP templates
The basecms project and webjetcms
The source code for a reference custom application project is available on GitHub at github.com/webjetcms/basecms. The WebJET CMS core itself is at github.com/webjetcms/webjetcms. Your custom project depends on the WebJET CMS library and provides its own Spring configuration, JPA entities, repositories, REST controllers, and Thymeleaf templates layered on top.Your application classes should live in the package
sk.iway.INSTALL_NAME where INSTALL_NAME is the value of the installName configuration variable. WebJET scans this package automatically at startup.Development environment setup
WebJET CMS development uses Visual Studio Code with a Gradle-based project.Running the application server
The project uses the gretty Gradle plugin to run an embedded Tomcat server. Key settings inbuild.gradle:
reloadOnClassChange = falsedisables automatic Tomcat restarts when a class is recompiled, so hot-swap works correctly.- The
-Xrunjdwpflag enables remote debugging on port 5005.
Debugging with VS Code
Configure.vscode/launch.json with Java attach and optionally Chrome launch configurations:
Spring configuration
Before your classes are recognized by WebJET, you must create two configuration files in your package.SpringConfig.java
Sets the packages that Spring will scan for your components:JpaDBConfig.java
Configures Spring Data JPA repositories and entity scanning:Customizing Spring Security
If you need to adjust Spring Security settings, implementsk.iway.iwcm.system.spring.ConfigurableSecurity in your SpringConfig:
Project structure
A typical custom application follows this layout insidesrc/main/:
Overriding existing applications
WebJET searches for view files in a priority order that allows customer applications to override defaults. When a method returns a path such as/components/contact/edit, WebJET looks for the file in this order:
viewFolder parameter can be passed through the !INCLUDE()! tag:
Key concepts
@WebjetComponent annotation
@WebjetComponent annotation
Marks a class as a WebJET application. The annotation value must be the fully-qualified class name. This registers the class as a Spring bean and enables the
!INCLUDE()! directive to find and execute it.@DefaultHandler annotation
@DefaultHandler annotation
Marks the method that runs when no URL parameter matches another method name in the class. The annotated method can have any name. URL parameter routing is automatic: a URL parameter named
edit causes the edit() method to be called.App registration in packages
App registration in packages
WebJET scans for
@WebjetComponent annotations in:sk.iway.iwcm— standard WebJET CMS applicationssk.iway.INSTALL_NAME— your customer applications (value ofinstallNameconf. variable)sk.iway.LOG_INSTALL_NAME— applications by logging install name- Packages listed in the
springAddPackagesconfiguration variable
sk.iway.iwcm appear at the top of the App Store list.Bean scope
Bean scope
Application classes are scoped as
@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS). If the same application appears multiple times on one page, the class instance is reused across the HTTP request.Testing
For administration data tables, a base automated test is provided that you configure with a minimal test scenario. Create a file atsrc/test/webapp/tests/apps/contact.js:
perms value must match the itemKey defined in your modinfo.properties file.