Hi,

While trying to implement directives to replace Spring MVC select,
options and option tags [1], I'm wondering what is the best to nest
options or option directive inside form directive.

One straightforward option is:

<@form.select 'user.favoriteSport'; form>
  <@option form value="NONE" label="--- Select ---" />
  <@options form items=sports />
</@form>

As we don't have something like
javax.servlet.jsp.tagext.TagSupport#findAncestorWithClass(Tag, Class)
(bottom to top), we can pass the form directive model to the nested
content like org.apache.freemarker.spring.model.BindDirective does
already (top to bottom).

So, developers are needed to pass it along like the above example,
unless it is as simple as one-liner like the following:

<@form.select 'user.favoriteSport' items=sports />

Does it sounds good? Or do you have any better ideas?

Regards,

Woonsan

[1] https://www.mkyong.com/spring-mvc/spring-mvc-dropdown-box-example/

Reply via email to