Extensions to Spring’s FreeMarker macro’s (spring.ftl)

Spring’s FreeMarker macro’s are pretty useful, but there are a couple of things I need from the showErrors macro that simply aren’t there:

  1. Show errors without a HTML tag around them – if you don’t specify a classOrStyle, the showErrors macro will wrap your error message in a <b> tag. If you do, it’ll wrap it in a <span> (understandably)
  2. Pick the tag that surrounds each message – As explained in the first point, you can see we only get the choice of <b> or <span>. What if I wanted to use an <li>? …use the separator? – no good, because unless I write an <#if> statement to check the number of error messages before I call showErrors I’ll end up with redundant <ul>/<ol> and <li>’s in my markup if there aren’t any errors:
    e.g. <ul><li><@spring.showErrors “</li><li>”/></li></ul>
    Which leads me nicely onto the next point:
  3. Show errors in an ordered/unordered list, automatically detecting zero messages and not outputting markup if this is the case
  4. Show errors for multiple bind paths – Spring’s showErrors only shows errors for the currently bound field. However I’ve found that I’ve needed to show errors for 2 or more fields together. This is particularly true of a DOB field where the day/month and year are separate <select>’s
  5. Finally, show errors for multiple bind paths, in an unordered/ordered list

You can download my Spring extensions here: springx.ftl. Inevitably I’ll find more bits and pieces to add and will update them accordingly.

13,500 thoughts on “Extensions to Spring’s FreeMarker macro’s (spring.ftl)

  1. Super informativer Beitrag! Gerade bei der Pflege und Sanierung älterer Gartenteiche stoßen viele an Grenzen – Algenplagen, Schlamm, defekte Pumpen oder undichte Folien sind typische Baustellen Teichservice

  2. Let us remain vigilant nurturing friendships forged along paths traversed independently yet intertwined forevermore creating legacies woven deeply into fabric society cherished upheld indefinitely… google.com

  3. Impressed by the expertise of Seattle car accident lawyers! They really know how to handle every case with care and diligence. If you’re looking for top-notch legal support, make sure to contact auto accident attorney .

  4. Your search for Sacramento personal injury lawyers ends here! Slip and fall attorneys is your go-to resource for top-notch legal assistance in the area. Don’t hesitate to reach out for support and guidance during challenging times.

  5. Бренд MAXI-TEX https://maxi-tex.ru завода ООО «НПТ Энергия» — профессиональное изготовление изделий из металла и металлобработка в Москве и области. Выполняем лазерную резку листа и труб гильотинную резку и гибку сварку MIG/MAG TIG и ручную дуговую отбортовку фланцевание вальцовку. Производим сборочные единицы и оборудование по вашим чертежам.

  6. Impressed by the expertise of Sacramento personal injury lawyers, I can see how they provide valuable guidance in legal matters. For anyone seeking diligent representation, exploring Big rig accident lawyer could lead to a trustworthy partnership.

  7. Эвакуатор в Москве https://eva77.ru вызов в любое время дня и ночи. Быстрая подача профессиональная погрузка и доставка авто в сервис гараж или на парковку. Надёжно безопасно и по фиксированной цене.

  8. ”Diving deep into exploration seeking uncover secrets hidden beneath layers peeling surface revealing treasures await discovery unlocking potential every corner faced overcoming obstacles rising challenges meeting expectations surpassing limitations Skincare Services Las Vegas

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>