struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Beal <jbb...@gmail.com>
Subject Re: Render an html button tag
Date Tue, 28 Jun 2005 18:46:47 GMT
Oddly, the <button/> element doesn't work well in Internet Explorer. 
(I just checked.)

I have this form in an HTML page:
    <form action="test.html" method="get">
      <button name="btn" value="1" type="submit">Click</button>
      <button name="btn" value="2" type="submit">Click 2</button>
    </form>

Now, if you click on one of the buttons, only that button and its
value are supposed to be submitted.  However, both are.  Not only
that, but the button text is submitted, not the value:
file:///C:/work/scratch/test.html?btn=Click&btn=Click+2

Clicking the first button in Firefox gives me the URL:
file:///C:/work/scratch/test.html?btn=1

So, as long as you want to support Internet Explorer, there's not much
use to the <button> element as opposed to <input type="submit"/>.

-- Jeff

On 6/28/05, Wendy Smoak <java@wendysmoak.com> wrote:
> From: "Gary Cauthon" <gcauthon@hotmail.com>
> 
> > Using HTML, I can create a button using this syntax:
> > <button name="removeButton" value="1">remove</button>
> > <button name="removeButton" value="2">remove</button>
> >
> >  So how do I
> > do this with the struts html:button tag?  As far as I can tell, it just
> > renders an tag of type "input" that does nothing when you click it.
> > Do I need to write it myself via a taglib?
> 
> Struts <html:button> does render an <input> tag, not a <button> tag.
> http://struts.apache.org/userGuide/struts-html.html#button
> 
> I can't say why we don't have something that renders <button>.  It's in the
> HTML 4.01 specification so I don't think there would be any objection to
> adding it if someone wanted to.  (Though what would we call it?)
> 
> Back to your issue... if the content isn't dynamic, you can just use
> <button> directly.  If it is dynamic, you can embed a <c:out> tag for the
> values... or just an expression if you're on a JSP 2.0 container.
> 
> --
> Wendy Smoak
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message