Benefits of Stapler over standard Servlets/JSPs
masterStapler solves several common issues found in traditional Servlet/JSP development:
- Hierarchical URLs vs. Parameter-heavy URLs: Instead of using complex query parameters (e.g.,
/servlets/SearchList?listName=announce), Stapler uses clean, hierarchical paths (e.g.,/list/announce/search). This makes generating relative links much easier; a link from a summary page to a search page can simply besearchrather than a full path with parameters. - Reduction of Boilerplate: You no longer need to write repetitive code to locate objects from request parameters. Stapler handles object lookup and provides the object via the
itvariable or as the target of method invocation. - Natural Recursive Structures: Stapler handles recursive data structures (like a
Folderclass containing otherFolderobjects) naturally. The URL structure will follow the tree structure of your objects, whereas Servlets typically require flattening the structure or using unique IDs at a top-level servlet.