Java – how to populate with a list?

I have a list < string > in the controller I pass to the view I need to fill in < form: Select > with these data

I tried to set the itemvalue property to "name", but it didn't work

Solution

You can do the following:

<form:select path="selectName">
    <form:option value="0" label="Select an Option" />
    <form:options items="${nameOfList}" />
</form:select>

By providing only the items attribute to the form: options tag, it should create a value and tag the value of each string in the list

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>