Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Struts 2 has several control tags that can be used in the view. This tutorial will discuss and show examples of how to use the Struts 2 if and iterator tags. For more information about these and other control tags visit tags reference.

...

The purpose of the above markup is to use either "Car model" or "Car models" depending on how many car models the user selected on the edit page. So the value for the test attribute of the Struts 2 tag get this iterator tag gets the length of the carModels String array and compares that to 1. If it's greater then 1, the correct grammer grammar is "Car models" else the correct grammer grammar is "Car model".

Struts iterator Tag

...