Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

i think you can use @modelAttribute annotation, spring will bind the request parameters to model.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top