• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To Tag or Not to Tag

 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I have to use the struts tags in my action forms in order to have it work? If so or if not, please refer me to some sites that can help me understand why.

Example ...

<struts:text property="amount" />

Lets exclude the validation part of struts and assume a simple web page.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dale DeMott:
Do I have to use the struts tags in my action forms in order to have it work?


My answer to this question is "no, but you have to do more work if you don't". Since struts utilities that populate the form bean operate solely on the name of the item, you could code: <input name="amount" > and struts would still populate the "amount" property of your form bean when the form is submitted. However, if you have to redisplay the form , the field will be blank unless you code it:

<input name="amount" value='<cut value="${myform.amount}"/>' >

The html:text tag takes care of this automatically.

In my view it's worth the effort to learn how to use the html:xxxx tags in your struts applications. They will save you a lot of work in the long run.

However, since JSTL has equivalent tags for the logic:xxx and bean:xxx tags, I prefer to use the JSTL tags as they are more standard and more powerful.
[ December 13, 2005: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic