Versions Compared

Key

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

...

The Struts Tags help you create rich web applications with a minimum of coding. Much, and often most, Often, much of the coding effort in a web application goes into creating and maintain the pages. The Struts Tags reduce effort by reducing code.

...

Looking over the markup, it's easy to see what why Java web development is hard! So far, we've only coded two controls, and there are six more to go! Let's finish the form using Struts 2 Tags.

Code Block
titleAfter Struts Tags (a complete form)
<s:actionerror/>
<s:form action="Profile!update" validate="true">
 <s:textfield label="Username" name="username"/>
 <s:password label="Password" name="password"/>
 <s:password label="(Repeat) Password" name="password2"/>
 <s:textfield label="Full Name" name="fullName"/>
 <s:textfield label="From Address" name="fromAddress"/>
 <s:textfield label="Reply To Address" name="replyToAddress"/>
 <s:submit value="Save" name="Save"/>
 <s:submit action="Register!cancel" value="Cancel" name="Cancel"
   onclick="form.onsubmit=null"/>
</s:form>

In about the same amount of code as two conventional controls, the Struts Tags can a complete create an entire data-input form with eight controls. Not only is there less code, but the code is easier to read and maintain.

...