Search code examples
javaspringspring-mvcspring-roo

Springroo calling method from Controller or create menu item


I tried to figure it out by myself, but i did not get it either how to create my own menu category/item to link to a new page or just call a method from my controller in the view.

I implemented Spring batch for XML/Database stuff, it's working fine, i put the call of this method inside the "list all" method to test it until i find a way call this method in the view.

Thank you for your time.


Solution

  • For creating my menu Entry and my controller, i did in roo shell :

    controller class --class ~.web.DataTransferController --preferredMapping /datatransfer
    

    Then my method :

     @RequestMapping(value = "/exportdatatoxml" , method=RequestMethod.GET)
        private void runExportDataTOXML(HttpServletRequest request, HttpServletResponse response) throws SQLException {
    ...
    }
    

    And in my jspx

    <input type="button" onclick="location.href='${pageContext.request.contextPath}/datatransfer/exportdatatoxml'" value="Export to XML" />
    

    i should look harder.