/
Module Portlets

Module Portlets

Create a module portlet controller

Module portlet controllers, along with form controllers, are typically put in the omod/src/main/java/web.controller folder and have names ending with PortletController.  Portlet controllers should extend PortletController. If there are actions that need to be taken when the portlet is referenced, override the populateModel method.  Any property added to the model in the populateModule method is available UNDER the "model" property.  So if you add "myvar" to the model object, in your portlet jsp you access it with ${model.myvar}.  Here is an example:

@Controller @RequestMapping("**/this.portlet") public class ThisPortletController extends PortletController { private static final Log log = LogFactory.getLog(ThisPortletController.class); @SuppressWarnings("unchecked") @Override protected void populateModel(HttpServletRequest request, Map<String, Object> model) { // your code here } }

Make sure the following line exists in your ModuleApplicationContext.xml file, substituting your module name for ModuleID.  It typically is put just above the </beans> tag at the end.