jQuery in Action, 3rd edition
The moose likes Struts and the fly likes html:link wraps a button but not on IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:link wraps a button but not on IE" Watch "html:link wraps a button but not on IE" New topic

html:link wraps a button but not on IE

Andre LeDuc

Joined: Mar 08, 2006
Posts: 7
I have the following snippet in my JSP page:

This code works fine in Firefox but fails in IE. When I say "fail" I mean nothing at all happens (save for a hiccup on the button). If I swap the comments, the link works in both browsers. The rendered HTML in the view source is identical for both. Is this behavior fallout from the browser wars or am I overlooking something fundamental? I really would prefer to use a button as opposed to an image. Is there some other way to do this so it works in any browser?

Thanks to all who reply ...
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I understand the idea of an image inside a link tag, but a button seems odd. I am wondering if this is valid html. Is your button wrapped in an html:form or form tag? If you want a button, then you are probably better off using some java script in the onclick event. Or you can use an html:submit tag and submit the page on the click.

- Brent
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Did you declare the HTML version you're using at the top of the document? If not, try it, and see if this fixes it.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Consultant, Sima Solutions
Andre LeDuc

Joined: Mar 08, 2006
Posts: 7
I do have the DOCTYPE statement included but it makes no difference.

This is the welcome page to a site and all it is is static text detailing how the site works - instructions basically, so there is no form per se, and no request parameters. I code the action attribute on <html:link> to forward directly to a org.apache.struts.Action instance that does app setup. The reason I'm wrapping a button in a link is because I don't have the time to create the images and for right now, the buttons give me glyphs as a proxy for proper images. For this iteration of the app, all I want to do is get something in front of the users so they can verify that I have all the right stuff in the right places so we can make any major content, navigation and business logic changes earlier rather than later. Later on I'll go back and style the pages and create the images. Truth is though, I struggle with technologies like CSS and PhotoShop. To solve my immediate problem though, I'll probably just use text for the links.

Thanks for your help. This is my first time posting to JavaRanch and I appreciate the response.
I agree. Here's the link: http://aspose.com/file-tools
subject: html:link wraps a button but not on IE
jQuery in Action, 3rd edition