문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top