3

in struts programming we use <html:text instead of <input type="text" But we can use <input type="text" and it will work also what is the specific reason for using <html:text tag? can any one answer me please?

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
vinoth kumar
  • 659
  • 2
  • 6
  • 13

3 Answers3

1

It will do magic. I.e. if your form has a field with a name of "bob", and you have an html:text with a name of "bob", the value you put in the bob field of the form within an action will cause the rendered html input to be populated. If you just did a nornal

On the other hand, html:button does (IIRC), the exact same thing as a normal button, but is just there so you can consistently put html: in front of everything. I think if you use internationalized labels you can get a small benefit out of html:button, but nothing I have ever done.

bwawok
  • 14,898
  • 7
  • 32
  • 43
0

It's just for convenience. You can easily write an regular input, supplying a proper name for binding, and a value - some EL that takes the current value from the request. You can take a look at the HTML generated by <html:text> to get a better idea.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
0

The only reason to use

<html:text 

instead of using normal

<input type=text 

is the support for Internationalization. With

<html:text 

we use the attribute key, which names the value to be fetched from the Resource.properties file. So for internationalization, all we have to do is change the values stored against the keys in the resource.properties file and nothing else.

Logan
  • 2,445
  • 4
  • 36
  • 56