Re: Struts tag <html:label> ?
Lew wrote:
What ActionForm element corresponds to a <label>?
grz01 wrote:
ActionForm element? It would be a normal String field with getter/
setter method.
Even though <label> is not an input field and does not contribute to the HTTP
request content?
From the programs viewpoint, I would expect it to behave just like the
"hidden" field (but maybe I'm wrong...?)
A so-called "hidden" field, actually a <text> element with an attribute
indicating that it's hidden, is an input field and does contribute to the HTTP
request. It is quite different from a <label> element.
It's just a text that the user cannot change; difference only being
that the text is visible to the user.
A <label> is more than that, in that it can be tied to an input field via its
'for' attribute, and less than that, in that a <text> element is an input and
a <label> element is not. It is a tag element, unlike contained text. In
all, a <label> is really quite different from "a text". Also there are plenty
of text output pieces of HTML that are visible to the user.
Calling leaner, better code a "work-around" and "not as elegant" doesn't make
it so. Please substantiate those comparatives.
Well, just compare it to what you had, if the "hidden" element didnt
exist when you wanted it.
You would have to make a "less elegant" "workaround" I guess...
I was talking about <label>, not a hidden <text> element. The two are
radically different.
I dont see a good reason for removing it, if it was once there -- you
would also break old code?
Would you?
Owen is right that <html:label> seems to have gone away, but the version
number he cited was different from the one you did. Try viewing your Struts
JAR with 'jar tf' and see if the label tag class is even in there. What does
that show you?
Owens link says 1.3.9, while mine said 1.x.
x == 3.9
I have 1.2.9 which I got with a Netbeans bundle downloaded a couple of
months ago
and, no, there is no LabelTag.class in the jar.
More evidence that Owen is on to something.
What happens if you just use a plain HTML <label> tag instead of the
non-existent Struts <html:label> in your code?
Yeah, that may be a "workaround" --- only then it doesnt get sent back
and forth by the ActionForm, so more code = "less elegant"
I don't see how the ActionForm has anything to do with it. How about using
JSTL to fill the label content, if it's dynamic?
--
Lew