You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2002/09/03 17:49:33 UTC

html:submit and Image instead of button

Hi,

I have 4 buttons on an jsp page, but what if i have to use image instead of buttons,

like <html:submit>Add</html:submit>

will have a button with Add Text, and then in my Action class i can find out which button has been pressed, 

but what if i have to use Image instead of a button, like how can i find out which image was clicked if i have 4 images on a jsp with value="sumbit"

<input type="image" value="submit" name="login" border="0" src="images/en/buttons/login_off.gif" width="75" height="24" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('login','','images/buttons/login_on.gif',1)" >

<input type="image" value="submit" name="signoff" border="0" src="images/en/buttons/signoff_off.gif" width="75" height="24" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('signoff','','images/buttons/signoff_on.gif',1)" >

the above  are 2 tags with same one <html:form action="/pages/selectenv">

so how will i come to know which image was clicked, what is the best way to do it

Ashish


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: html:submit and Image instead of button

Posted by Ted Husted <hu...@apache.org>.
One trick is to get the ActionForm to do the work:

http://husted.com/struts/tips/001.html

-Ted.

Ashish Kulkarni wrote:

> hi 
> But cant i do it in my action class instead in javascript,??
>  
>  Ravi Kora wrote:Have a javascript function in the href tag like below.
> 
> 
> The javascript function submitAct will have sth like below
> function submitAct(index){
> if (index==0) {...}
> document.forms[0].submit();
> } 
> 
> Hope this helps. Bye
> -Ravi
> 
> 
> 
> Thanks & Regards,
> Ravi Kora
> kora@louisiana.edu
> 337-739-3434(M) 
> 
> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com] 
> Sent: Tuesday, September 03, 2002 11:50 AM
> To: Struts Users Mailing List
> Subject: html:submit and Image instead of button
> 
> 
> 
> Hi,
> 
> I have 4 buttons on an jsp page, but what if i have to use image instead
> of buttons,
> 
> like Add
> 
> will have a button with Add Text, and then in my Action class i can find
> out which button has been pressed, 
> 
> but what if i have to use Image instead of a button, like how can i find
> out which image was clicked if i have 4 images on a jsp with
> value="sumbit"
> 
>  [input] src="images/en/buttons/login_off.gif" width="75" height="24"
> onMouseOut="MM_swapImgRestore()"
> onMouseOver="MM_swapImage('login','','images/buttons/login_on.gif',1)" >
> 
>  [input] src="images/en/buttons/signoff_off.gif" width="75" height="24"
> onMouseOut="MM_swapImgRestore()"
> onMouseOver="MM_swapImage('signoff','','images/buttons/signoff_on.gif',1
> )" >
> 
> the above are 2 tags with same one action="/pages/selectenv">
> 
> so how will i come to know which image was clicked, what is the best way
> to do it
> 
> Ashish
> 
> 
> A$HI$H
> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> 
> 
> --
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 
> 
> 
> A$HI$H
> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> 


-- 
Ted Husted, Husted dot Com, Fairport NY US
co-author, Java Web Development with Struts
Order it today:
<http://husted.com/struts/book.html>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: html:submit problem need help

Posted by Dan Walker <wa...@attbi.com>.
I think this link:

http://husted.com/struts/tips/002.htm

addresses that issue.
-Dan

On Tuesday 03 September 2002 11:53, you wrote:
> Hi,
>
> I have 2 buttons on my jsp and i want to find out which button is pressed
> in my Action class, but i m not getting the submit parameter in request, my
> code is as below
>
> I am 2 buttons on my jsp as below
>
> <html:form action="/pages/test">
>
> <html:submit>Login</html:submit>
>
> <html:submit>signout</html:submit>
>
> </html:form>
>
> my struts-config.xml is as below
>
> <form-bean name="test" dynamic="true"
> type="org.apache.struts.validator.DynaValidatorForm">
>
> <form-property name="envDrop" type="java.lang.String"/>
>
> </form-bean>
>
> <action path="/pages/test" type="com.pfizer.maps.Test"
> input="/pages/test.jsp" name="test" >
>
> <forward name="login" path="/pages/mapslogin.jsp"></forward>
>
> <forward name="signout" path="/pages/signout.jsp"></forward>
>
> </action>
>
> and my Action class is
>
> Enumeration enm = request.getParameterNames();
>         while(enm.hasMoreElements())
>         {
>           System.out.println("paramters are " + enm.nextElement());
>         }
>         String submitVal = request.getParameter("submit");
>         System.out.println("value of submit " + submitVal);
>
>         if("Login".equals(submitVal))
>         {
>         return mapping.findForward("login");
>         }
>         else if("Signout".equals(submitVal))
>         {
>         return mapping.findForward("signout");
>         }
>         else
>         {
>         return mapping.findForward("login");
>         }
>
> when i print the value of submitVal , it is null
>
> Ashish
>
>
>
>
> A$HI$H
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


html:submit problem need help

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

I have 2 buttons on my jsp and i want to find out which button is pressed in my Action class, but i m not getting the submit parameter in request, my code is as below

I am 2 buttons on my jsp as below 

<html:form action="/pages/test">

<html:submit>Login</html:submit>

<html:submit>signout</html:submit>

</html:form>

my struts-config.xml is as below

<form-bean name="test" dynamic="true" type="org.apache.struts.validator.DynaValidatorForm">

<form-property name="envDrop" type="java.lang.String"/>

</form-bean>

<action path="/pages/test" type="com.pfizer.maps.Test" input="/pages/test.jsp" name="test" >

<forward name="login" path="/pages/mapslogin.jsp"></forward>

<forward name="signout" path="/pages/signout.jsp"></forward>

</action>

and my Action class is 

Enumeration enm = request.getParameterNames();
        while(enm.hasMoreElements())
        {
          System.out.println("paramters are " + enm.nextElement());
        }
        String submitVal = request.getParameter("submit");
        System.out.println("value of submit " + submitVal);

        if("Login".equals(submitVal))
        {
        return mapping.findForward("login");
        }
        else if("Signout".equals(submitVal))
        {
        return mapping.findForward("signout");
        }
        else
        {
        return mapping.findForward("login");
        }

when i print the value of submitVal , it is null

Ashish

 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: getting data in value object out of logic:iterate

Posted by Michael Lee <ml...@hotmail.com>.
You are very correct, there is a lot of 'chimp' like work in translating
value objects to forms to jsp tags to ApplicationResource.properties. I
spend lots of time double checking upper, lower case on stuff, simple
conversions (VO.setX(ActionForm.getX()) etc).
I'll have to check it out, thanks for the help!
Mike

----- Original Message -----
From: "John Raley" <jb...@mindspring.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, September 04, 2002 10:32 PM
Subject: Re: getting data in value object out of logic:iterate


> Hi Michael,
>
> You need:
> <logic:iterate name="users" id="aUser">
> <bean:write name="aUser" property="firstName"/>
> <%-- etc --%>
> </logic:iterate>
>
> The name attr in logic:iterate must match the attribute name of the List.
>
> Any BTW you're going to get really tired of writing Beans classes like
> User.  Many folks on this list are using the DynaBean framework.  Also
> let me plug my own project, dynclass.sourceforge.net, which will
> transform an arbitrary java Map into a JavaBean...
>
> Michael Lee wrote:
>
> >I read the docs and looked through the examples and didn't see anything
that
> >did what I was trying.
> >I have an array of Value(view) objects that I want to iterate through in
my
> >jsp.
> >
> >Here it is;
> >
> >public class User
> >{
> >     private String firstName;
> >     private String lastName;
> >     public String getFirstName() { return firstName; }
> >     public void setFirstName(String firstName) { this.firstName =
> >firstName; }
> >     public String getLastName() { return lastName; }
> >     public void setLastName(String lastName) { this.lastName =
lastName; }
> >...
> >}
> >
> >public SomeAction extendsAction
> >{
> >  perform(....
> >  {
> >    User[] users = new User[3];
> >    users[0] = user1;
> >    users[1] = user2;
> >    ...
> >    request.setAttribute("users", Arrays.asList(users));
> >    return mapping.findForward("something.jsp");
> >  }
> >}
> >
> >in the something.jsp
> ><TABLE>
> ><logic:iterate id="userList" name="?">
> ><TR>
> >  <TD>
> >   ??? users.getFirstName(); ???
> >  </TD>
> >  <TD>
> >    ??? users.getLastName(); ???
> >  </TD>
> >...
> ></TR>
> ></logic:iterate>
> >
> >HELP!
> >thanks,
> >Michael Lee
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
> >
> >
> >
>
>
> --
> Check it out: Map -> JavaBean
> http://dynclass.sourceforge.net/
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: getting data in value object out of logic:iterate

Posted by John Raley <jb...@mindspring.com>.
Hi Michael,

You need:
<logic:iterate name="users" id="aUser">
<bean:write name="aUser" property="firstName"/>
<%-- etc --%>
</logic:iterate>

The name attr in logic:iterate must match the attribute name of the List.

Any BTW you're going to get really tired of writing Beans classes like 
User.  Many folks on this list are using the DynaBean framework.  Also 
let me plug my own project, dynclass.sourceforge.net, which will 
transform an arbitrary java Map into a JavaBean...

Michael Lee wrote:

>I read the docs and looked through the examples and didn't see anything that
>did what I was trying.
>I have an array of Value(view) objects that I want to iterate through in my
>jsp.
>
>Here it is;
>
>public class User
>{
>     private String firstName;
>     private String lastName;
>     public String getFirstName() { return firstName; }
>     public void setFirstName(String firstName) { this.firstName =
>firstName; }
>     public String getLastName() { return lastName; }
>     public void setLastName(String lastName) { this.lastName = lastName; }
>...
>}
>
>public SomeAction extendsAction
>{
>  perform(....
>  {
>    User[] users = new User[3];
>    users[0] = user1;
>    users[1] = user2;
>    ...
>    request.setAttribute("users", Arrays.asList(users));
>    return mapping.findForward("something.jsp");
>  }
>}
>
>in the something.jsp
><TABLE>
><logic:iterate id="userList" name="?">
><TR>
>  <TD>
>   ??? users.getFirstName(); ???
>  </TD>
>  <TD>
>    ??? users.getLastName(); ???
>  </TD>
>...
></TR>
></logic:iterate>
>
>HELP!
>thanks,
>Michael Lee
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


-- 
Check it out: Map -> JavaBean
http://dynclass.sourceforge.net/




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


getting data in value object out of logic:iterate

Posted by Michael Lee <ml...@hotmail.com>.
I read the docs and looked through the examples and didn't see anything that
did what I was trying.
I have an array of Value(view) objects that I want to iterate through in my
jsp.

Here it is;

public class User
{
     private String firstName;
     private String lastName;
     public String getFirstName() { return firstName; }
     public void setFirstName(String firstName) { this.firstName =
firstName; }
     public String getLastName() { return lastName; }
     public void setLastName(String lastName) { this.lastName = lastName; }
...
}

public SomeAction extendsAction
{
  perform(....
  {
    User[] users = new User[3];
    users[0] = user1;
    users[1] = user2;
    ...
    request.setAttribute("users", Arrays.asList(users));
    return mapping.findForward("something.jsp");
  }
}

in the something.jsp
<TABLE>
<logic:iterate id="userList" name="?">
<TR>
  <TD>
   ??? users.getFirstName(); ???
  </TD>
  <TD>
    ??? users.getLastName(); ???
  </TD>
...
</TR>
</logic:iterate>

HELP!
thanks,
Michael Lee


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: NullPointerException when using DynaValidatorForm

Posted by Rick Reumann <ma...@reumann.net>.
On Wednesday, September 4, 2002, 10:27:08 AM, Ashish Kulkarni wrote:

AK> HI
AK> Here is my jsp page, this has only one drop down box,
AK> <html:form action="/pages/selectenv" name="test" type="DynaValidatorForm">
AK> <html:select  property="envDrop" size="5" >
AK>      <html:optionsCollection name="ll1002" property="beanCollection"/>
AK> </html:select>
AK> </html:form>
 <SNIP>

AK> So what may be the problem

  Are you sure you have teh "beanCollection" property defined in your
  form definition in you config.xml file? You only posted the
  definition for envDrop so I'm not sure if you are missing
  beanCollection, but if so you will need that defined as well.

--

Rick

mailto:maillist@reumann.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


html:image tag and onmouseover event

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

I want to have a onmouseover effect for an image in <html:image ..> tag,

What i want is to replace a gif image when the mouse is over the image, and then replace it with the original when the mouse is out, I have defined my images in the resourse bundle (properties file), i can get the main image by using srcKey="button.loginoff" , but how do i get the image path for the other image when the mouse is over, here is my tag,  where the image for onmouseover effect is hardcoded, so any suggestion on doing it

here is my tag

<html:image property="login" srcKey ="button.loginoff" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('login','','images/buttons/login_on.gif',1)"/>

 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: NullPointerException when using DynaValidatorForm

Posted by Ashish Kulkarni <ku...@yahoo.com>.
HI
Here is my jsp page, this has only one drop down box,
<html:form action="/pages/selectenv" name="test" type="DynaValidatorForm">
<html:select  property="envDrop" size="5" >
     <html:optionsCollection name="ll1002" property="beanCollection"/>
</html:select>
</html:form>
my struts-config.xml file looks like this

<form-bean name="test" dynamic="true" type="org.apache.struts.validator.DynaValidatorForm">

 <form-property name="envDrop" type="java.lang.String"/>

<tr>
     <td>
     <html:submit>Login</html:submit>

     </td>
     <td>
     <html:submit>Sign out</html:submit>
     </td>
     </tr>

</form-bean>

</action>

<action path="/pages/test" type="com.pfizer.maps.Test" input="/pages/test.jsp" name="test" parameter="submit" scope="request">

<forward name="login" path="/pages/mapslogin.jsp"/>

<forward name="signout" path="/pages/signout.jsp"/>

</action>

So what may be the problem

Ashish

 Rick Reumann wrote:

On Tuesday, September 3, 2002, 4:37:30 PM, Ashish wrote:


AK> I get NullPointerException when i load the form

AK> java.lang.NullPointerException
AK> at org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:551)


What's the JSP page look like? Maybe you are using a
property name that doesn't match a field name in your form
bean?
-- 

Rick
mailto:maillist@reumann.net


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: NullPointerException when using DynaValidatorForm

Posted by Rick Reumann <ma...@reumann.net>.

On Tuesday, September 3, 2002, 4:37:30 PM, Ashish wrote:


AK> I get NullPointerException when i load the form

AK> java.lang.NullPointerException
AK>         at org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:551)
<SNIP>

            What's the JSP  page look like? Maybe you are using a
            property name that doesn't match a field name in your form
            bean?
-- 

Rick
mailto:maillist@reumann.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


NullPointerException when using DynaValidatorForm

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

following is my jsp <html:form> definiation amd struts-config definition.

<html:form action="/pages/test" name="test" type="org.apache.struts.validator.DynaValidatorForm">

<form-bean name="test" dynamic="true" type="org.apache.struts.validator.DynaValidatorForm">

<form-property name="envDrop" type="java.lang.String"/>



</form-bean>

<action path="/pages/test" type="com.pfizer.maps.Test" input="/pages/test.jsp" name="test" parameter="submit" scope="request">

<forward name="login" path="/pages/mapslogin.jsp"></forward>

<forward name="signout" path="/pages/signout.jsp"></forward>

</action>

I get NullPointerException when i load the form

java.lang.NullPointerException
	at org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm.java:551)
	at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:365)
	at org.apache.struts.action.DynaActionForm.reset(DynaActionForm.java:158)
	at org.apache.struts.validator.DynaValidatorForm.reset(DynaValidatorForm.java:387)
	at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:640)
	at org.apache.jsp.test$jsp._jspService(test$jsp.java:172)


 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

Re: LookupDispatchAction and HTML:image tag

Posted by Ted Husted <hu...@apache.org>.
In case you don't see the other thread,

http://husted.com/struts/tips/001.html

might help.

-Ted.

Ashish Kulkarni wrote:

> Hi,
> 
> i was using <html:submit> tag with LookupDispatchAction class, and i was getting which button has generated the submit event, but how do i make it work if i have to replace the <html:submit> with <html:image> tag, one way of doing it would be using a hidden field and calling the onclick event on image tag.
> 
> but is there a way of doing it with out using javascript
> 
> Ashish
> 
> 
> A$HI$H
> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> 


-- 
Ted Husted, Husted dot Com, Fairport NY US
co-author, Java Web Development with Struts
Order it today:
<http://husted.com/struts/book.html>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


LookupDispatchAction and HTML:image tag

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,

i was using <html:submit> tag with LookupDispatchAction class, and i was getting which button has generated the submit event, but how do i make it work if i have to replace the <html:submit> with <html:image> tag, one way of doing it would be using a hidden field and calling the onclick event on image tag.

but is there a way of doing it with out using javascript

Ashish


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

RE: html:submit and Image instead of button

Posted by Ravi Kora <rk...@1bigthink.com>.
Have a property for that bean say
Private Sting act;
and in the jsp have a corresponding hidden tag like
<html:hidden property="act"/>

In the javascript function set the act to whatever you want depending on
the index like
function submitAct(index){ 
if (index==0) { document.form.act.value="act1"; 
} 
document.forms[0].submit(); 
} 

Finally, in the Action class get the value of the property act for the
form. Hope this helps!
-R


Thanks & Regards,
Ravi Kora
kora@louisiana.edu
337-739-3434(M) 

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com] 
Sent: Tuesday, September 03, 2002 12:21 PM
To: Struts Users Mailing List
Subject: RE: html:submit and Image instead of button



hi 
But cant i do it in my action class instead in javascript,??
 
 Ravi Kora wrote:Have a javascript function in the href tag like below.





The javascript function submitAct will have sth like below function
submitAct(index){ if (index==0) {...} document.forms[0].submit(); } 

Hope this helps. Bye
-Ravi







Thanks & Regards,
Ravi Kora
kora@louisiana.edu
337-739-3434(M) 

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com] 
Sent: Tuesday, September 03, 2002 11:50 AM
To: Struts Users Mailing List
Subject: html:submit and Image instead of button



Hi,

I have 4 buttons on an jsp page, but what if i have to use image instead
of buttons,

like Add

will have a button with Add Text, and then in my Action class i can find
out which button has been pressed, 

but what if i have to use Image instead of a button, like how can i find
out which image was clicked if i have 4 images on a jsp with
value="sumbit"

 [input] src="images/en/buttons/login_off.gif" width="75" height="24"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('login','','images/buttons/login_on.gif',1)" >

 [input] src="images/en/buttons/signoff_off.gif" width="75" height="24"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('signoff','','images/buttons/signoff_on.gif',1
)" >

the above are 2 tags with same one action="/pages/selectenv">

so how will i come to know which image was clicked, what is the best way
to do it

Ashish


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: html:submit and Image instead of button

Posted by Ashish Kulkarni <ku...@yahoo.com>.
hi 
But cant i do it in my action class instead in javascript,??
 
 Ravi Kora wrote:Have a javascript function in the href tag like below.





The javascript function submitAct will have sth like below
function submitAct(index){
if (index==0) {...}
document.forms[0].submit();
} 

Hope this helps. Bye
-Ravi







Thanks & Regards,
Ravi Kora
kora@louisiana.edu
337-739-3434(M) 

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com] 
Sent: Tuesday, September 03, 2002 11:50 AM
To: Struts Users Mailing List
Subject: html:submit and Image instead of button



Hi,

I have 4 buttons on an jsp page, but what if i have to use image instead
of buttons,

like Add

will have a button with Add Text, and then in my Action class i can find
out which button has been pressed, 

but what if i have to use Image instead of a button, like how can i find
out which image was clicked if i have 4 images on a jsp with
value="sumbit"

 [input] src="images/en/buttons/login_off.gif" width="75" height="24"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('login','','images/buttons/login_on.gif',1)" >

 [input] src="images/en/buttons/signoff_off.gif" width="75" height="24"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('signoff','','images/buttons/signoff_on.gif',1
)" >

the above are 2 tags with same one action="/pages/selectenv">

so how will i come to know which image was clicked, what is the best way
to do it

Ashish


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

RE: html:submit and Image instead of button

Posted by Ravi Kora <rk...@1bigthink.com>.
Have a javascript function in the href tag like below.

<html:link href="javascript:submitAct(1)" >
	<html:img src="your image.gif" />
</html:link> 

The javascript function submitAct will have sth like below
function submitAct(index){
  if (index==0)  {...}
  document.forms[0].submit();
}									

Hope this helps. Bye
-Ravi







Thanks & Regards,
Ravi Kora
kora@louisiana.edu
337-739-3434(M) 

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com] 
Sent: Tuesday, September 03, 2002 11:50 AM
To: Struts Users Mailing List
Subject: html:submit and Image instead of button



Hi,

I have 4 buttons on an jsp page, but what if i have to use image instead
of buttons,

like <html:submit>Add</html:submit>

will have a button with Add Text, and then in my Action class i can find
out which button has been pressed, 

but what if i have to use Image instead of a button, like how can i find
out which image was clicked if i have 4 images on a jsp with
value="sumbit"

<input type="image" value="submit" name="login" border="0"
src="images/en/buttons/login_off.gif" width="75" height="24"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('login','','images/buttons/login_on.gif',1)" >

<input type="image" value="submit" name="signoff" border="0"
src="images/en/buttons/signoff_off.gif" width="75" height="24"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('signoff','','images/buttons/signoff_on.gif',1
)" >

the above  are 2 tags with same one <html:form
action="/pages/selectenv">

so how will i come to know which image was clicked, what is the best way
to do it

Ashish


A$HI$H


---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>