Code Snippets: How to set id property using Struts HTML Tag library

For those new to Struts and in particular the Struts HTML library it might come as a surprise that there is no id property on their tags. Don’t get frustrated the tag library document clearly states that the styleId property renders its assigned value as the element id. This means that instead of id use styleId as shown by the following example.

Example

HTML

<input type="text" name="firstName" id="firstName"
maxlength="10" size="12" />

Struts HTML

<html:text property="firstName" styleId="firstName"
maxlenght="10" size="12" />

Resources

// Code Snippets // JSP //

Comments & Questions

Add Your Comment