3

When I try to write something like this: <html:text styleId="Istituto" type="number"> in the struts1 it gives me an error

Attribute type invalid for tag text according to TLD

How can I add "type" attribute to <html:text> tag?

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
EA0906
  • 472
  • 6
  • 14
  • 1
    You can't. html:text is a tag used to produce an ``. – JB Nizet Dec 28 '15 at 10:38
  • But doesn't exist. In such case how it possible to make input of type number using jstl? – EA0906 Dec 28 '15 at 11:41
  • You can generate the input by yourself, or create a tag equivalent to html:text, or realize that Struts 1 is an officially abandoned project for years, and start using something modern and maintained. – JB Nizet Dec 28 '15 at 11:44
  • The canonical answer is to modify the taglib's TLD to accept dynamic attributes. IIRC Struts 1.3 already does this, but I might be wrong about that. – Dave Newton Dec 29 '15 at 00:55

2 Answers2

6

I know this is old, but I'm currently working on a super old application that uses Struts 1 framework, and today I had the same problem. Here's the solution I'm using that works:

<input type="number" name="budgetValue" 
 value="<bean:write name="applicantForm" property="budgetValue"/>">

Where: budgetValue - is the Form property; applicantForm - is the Form

Milebza
  • 93
  • 2
  • 8
1

Thanks to Milebza for the answer, but for me only this way has worked.

<input type="number" name="budgetValue" value="${applicantForm.budgetValue}" />
Nikola Andreev
  • 624
  • 4
  • 18