After pondering this for a bit, I think that the best approach would be to
create a new button tag - s:button.

The button tag has 3 types, button, reset, and submit. It is similar to the
other FormButtons, with the exception that it has a "body" or nested value
in the tag, unlike the input tag.

I've thrown together the files needed to do this (haven't done the tests
yet), so let me know if that is a direction you'd like to go, and I can
share what I've done.

There are a few ways to go as far as implementation, but as I've coded it so
far, the label attribute would no longer be used, and the tag would render
the nested value (body) as the button "label" and if the body is null, it
will just display a default value of "button".

Thanks,
Eric



Ted Husted wrote:
> 
> I cross-posted to the WW dev list, just in case.
> 
>  * http://forums.opensymphony.com/thread.jspa?threadID=170962
> 
> On Nov 29, 2007 1:25 PM, Eric Martin <[EMAIL PROTECTED]> wrote:
>>
>> In looking into this issue, I ran into something that might part of the
>> problem...
>>
>> In org.apache.struts2.components.Component, there is a method, usesBody,
>> which always returns false and is supposed to be overridden for tags that
>> do
>> use a body. The problem is, for the submit tag, two of the options
>> (input,
>> image) render an HTML input tag, do not require a body, whereas the
>> button
>> option renders a button tag, which does require a body.
>>
>> Given the way the classes are set up, I'm not sure how to override
>> usesBody
>> for just s:submit tags of type button.
>>
>> So, I would thing that we could either 1) make usesBody return a variable
>> that has to be previously set (or defaults to false), or 2) create a
>> class
>> specifically for the button element.
>>
>> This is my first time digging into this code, and I may be way off
>> here...so
>> I'd appreciate any feedback.
>>
>> Thanks,
>> Eric
>>
>>
>>
>>
>>
>> Ted Husted wrote:
>> >
>> > It's true that the inner text of the JSP tag is not rendering as the
>> > inner text of the HTML tag, and so I reopened the issue.
>> >
>> > If anyone had a patch, I'd be happy to apply it.
>> >
>> > -Ted.
>> >
>> > On Nov 28, 2007 11:36 PM, Eric Martin <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Martin,
>> >>
>> >> Yes, there is a problem with the output. The SubmitTextName should be
>> >> inside
>> >> the button tag, but in your example and others posted, the value gets
>> >> placed
>> >> outside the button tag (seems to get displayed before the rendering of
>> >> the
>> >> button.
>> >>
>> >> I would expect the output to be:
>> >>
>> >> <button type="submit" id="example1_0"
>> >> value="SubmitTextName">SubmitTextName</button>
>> >>
>> >> In HTML, what is used for the value attribute, is what will be sent to
>> >> the
>> >> server on submit. Whereas, the "value" that is nested in the button
>> tag,
>> >> is
>> >> only the "label" of the button and is not sent on submit.
>> >>
>> >> So, as far as Struts is concerned, I would expect the following:
>> >>
>> >> - User nests a "value" inside the s:submit tag, but does not include a
>> >> value
>> >> attribute
>> >>
>> >>  <s:submit type="button" theme="simple">
>> >>        <s:text name="SubmitTextName" />
>> >>  </s:submit>
>> >>
>> >>  <button type="submit" id="example1_0">SubmitTextName</button>
>> >>
>> >> ======================================================
>> >>
>> >> - User does not nest a "value", but does include the value attribute
>> >>
>> >>  <s:submit type="button" theme="simple" value="SubmitTextName"/>
>> >>
>> >>  <button type="submit" id="example1_0"
>> >> value="SubmitTextName">SubmitTextName</button>
>> >>
>> >> ======================================================
>> >>
>> >> - User does not nest or include a value with the s:submit tag. A
>> default
>> >>   value will be used for both.
>> >>
>> >>  <s:submit type="button" theme="simple" />
>> >>
>> >>  <button type="submit" id="example1_0" value="Submit">Submit</button>
>> >>
>> >> ======================================================
>> >>
>> >> - User adds both a nested "value" and a value attribute:
>> >>
>> >>  <s:submit type="button" theme="simple" value="SubmitTextName">
>> >>        <s:text name="SomeOtherSubmitTextName" />
>> >>  </s:submit>
>> >>
>> >>  <button type="submit" id="example1_0"
>> >> value="SubmitTextName">SomeOtherSubmitTextName</button>
>> >>
>> >> ======================================================
>> >>
>> >> Hopefully that makes sense ;) Thanks for looking into this...
>> >>
>> >> -Eric
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> mgainty wrote:
>> >> >
>> >> > Eric-
>> >> >
>> >> > I just tossed this into a test.jsp page
>> >> >  <s:submit type="button" theme="simple">
>> >> >        <s:text name="SubmitTextName" />
>> >> >  </s:submit>
>> >> >
>> >> > ..and this was the rendered html output..
>> >> >
>> >> >        SubmitTextName
>> >> >  <button type="submit" id="example1_0"
>> value="Submit">Submit</button>
>> >> >
>> >> > anything wrong with the output???
>> >> > Martin--
>> >> > ----- Original Message -----
>> >> > From: "Eric Martin" <[EMAIL PROTECTED]>
>> >> > To: <[EMAIL PROTECTED]>
>> >> > Sent: Wednesday, November 28, 2007 8:27 PM
>> >> > Subject: Re: WW-167 not working
>> >> >
>> >> >
>> >> >>
>> >> >> https://issues.apache.org/struts/browse/WW-1677
>> >> >>
>> >> >>
>> >> >> mgainty wrote:
>> >> >> >
>> >> >> > Alberto-
>> >> >> >
>> >> >> > which button component are you speaking of?
>> >> >> >
>> >> >> > Martin--
>> >> >> > ----- Original Message -----
>> >> >> > From: "Alberto A. Flores" <[EMAIL PROTECTED]>
>> >> >> > To: <[EMAIL PROTECTED]>
>> >> >> > Sent: Wednesday, November 28, 2007 3:05 PM
>> >> >> > Subject: WW-167 not working
>> >> >> >
>> >> >> >
>> >> >> >> Has anyone been able to confirm that this issue is working? I
>> don't
>> >> > seem
>> >> >> >> to get it to work yet JIRA says it is. This is about having a
>> >> <button>
>> >> >> >> tag with an image and text inside the button.
>> >> >> >>
>> >> >> >> Thanks,
>> >> >> >>
>> >> >> >> Alberto
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-WW-1677-not-working-%28was-Re%3A-WW-167-%29-tf4895694.html#a14031962
>> Sent from the Struts - Dev mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Re%3A-WW-1677-not-working-%28was-Re%3A-WW-167-%29-tf4895694.html#a14037204
Sent from the Struts - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to