Search code examples
spring-mvcliferayliferay-6spring-portlet-mvcliferay-aui

mapping aui tags to spring mvc ModelAndView object


I am using spring mvc for developing my portlets. Is it mandatory that we have to use spring taglibs in the jsp too? I used and aui tags. Can I map ModelAndView object to aui tags? I need to populate the fields using the model I set from the render method. Or is there any other wrokaround for this? I also have a model bean autowired in my controller. For eg: I should be able to set the model in modelandview object and retrieve that model in jsp to populate aui fields.


Solution

  • I set a bean from the controller and used the bean attribute of aui tags. It worked.<aui:input bean="${questionnare}" .... This works fine for me and if bean has value, it gets prepopulated.

    class YourModel{
     String someValue;
    }
    

    In the controller we add to the rendermapping method the parameter @ModelAttribute("yourModel") YourModel yourModel

    and in the liferay jsp page, just add

    <aui:input type="text" name="someValue"... bean="${yourModel}"/>
    

    this will populate the value if it is present.