Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes Submit tag with Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Submit tag with Image" Watch "Submit tag with Image" New topic

Submit tag with Image

A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Hi again all I am curious if there is an easy way to put an image as a submit button instead of using the button that is given. I want to put an image to represent select all/select none for a list of checkboxes, but haven't seen anything that suggests it is a simple change. It's a nice to have mostly for aesthetics. I'm using Struts 1.2.9 if that makes any difference.
From the research I have done it seems that I will be required to get an action and a method involved for it. Is there no way to do it without going down that route ?

thanks again for all your time.
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 138
You can use the styleclass attribute.
something like
<html:submit value="submit" styleClass="submit" />

and in the style you can write something like as
.submit {
width: 108px;
height: 21px;
padding: 20px 0 0;
margin: 0;
border: 0;
background: transparent url('../images/btn_submit.gif') no-repeat center top;
overflow: hidden;
cursor: pointer; /* hand-shaped cursor */
cursor: hand; /* for IE 5.x */

Paras Jain
SCJP 5.0
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Thanks that's awesome if it works. I'll hopefully try that out tomorrow.
A knibbs
Ranch Hand

Joined: Aug 23, 2006
Posts: 158
Just wanted to say thanks again it works beautifully. I can't believe I couldn't think of something that simple.
I agree. Here's the link:
subject: Submit tag with Image
jQuery in Action, 3rd edition