struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Kulkarni <kulkarni_ash1...@yahoo.com>
Subject Re: Please review code for LookupDisptach using Image Buttons
Date Tue, 28 Jan 2003 17:30:16 GMT
Hi,
Did any one look at this code??
Ashish
--- Ashish Kulkarni <kulkarni_ash1312@yahoo.com>
wrote:
> Hi,
> I have a jsp with 2 image buttons, and i needed to
> forward the request to different jsp depending upon
> the image button clicked by the user, and I want to
> do
> it without using javascript ( I was using javascript
> along with DispatchAction class)
> Here is what I have done,
> I wrote a new class called TestLookupDispatchAction
> which extend DispatchAction class, override execute
> method and has one abstract method called
> getMethodName
> I am pasting the code of my 
> TestLookupDispatchAction and the class which extends
> this TestLookupDispatchAction class and my jsp
> definitation of code,
> Can people please comment on it
> public abstract class TestLookupDispatchAction
> extends
> DispatchAction
> {
>  public ActionForward execute (
>     ActionMapping mapping,
>     ActionForm form,
>     HttpServletRequest request,
>     HttpServletResponse response)
>     throws Exception
>     {
>         String methodName = getMethodName(request ,
> mapping);
>           return dispatchMethod (mapping, form,
> request, response, methodName);
> 
> 
> 
>     }
> 
> protected abstract String getMethodName
> (HttpServletRequest request, ActionMapping mapping
> );
> }
> 
> /** class that extends this class**/
> 
> public class TestImageButton extends
> TestLookupDispatchAction
> {
> protected String
> getMethodName(javax.servlet.http.HttpServletRequest
> request, ActionMapping mapping)
>     {
>         Enumeration enu = request.getParameterNames
> ();
>         String att="";
>         while(enu.hasMoreElements ())
>         {
>             att = (String)enu.nextElement ();
>             System.out.println ("parameter name: " +
> att + "... value: " + request.getParameter (att));
>             if(att.equals ("add.x"))
>             {  
>               return "add";
>             }
>             else if(att.equals ("change.x"))
>             {  
>              return "change";
>             }
>             else if(att.equals ("back.x"))
>             {  
>              return "back";
>             }
>             
>             
>         }
>         return "";
>     }
> 
>  public ActionForward add (ActionMapping mapping, 
> ActionForm form,
>     HttpServletRequest request,
>     HttpServletResponse response)
>     throws IOException, ServletException
>     {
> 
>     }
> }
> 
> My jsp definiation
> /**
> I am using normal html tag because i want to use the
> mouse over effect, which is not possible to get
> using
> struts taglib
> **/
> <html:form action="pages/TestImageButton" >
>  <input type="image"  src="<bean:message
> key="button.addoff"/>" name="add"
> onMouseOver="MM_swapImage('add','','<bean:message
> key="button.addon"/>',1)"
> onMouseOut="MM_swapImgRestore()"/>
>  <input type="image" src="<bean:message
> key="button.changeoff"/>" name="change"
> onMouseOver="MM_swapImage('change','','<bean:message
> key="button.changeon"/>',1)"
> onMouseOut="MM_swapImgRestore()"/>
> </html:form>
> 
>  
> 
> 
> 
> =====
> A$HI$H
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


Mime
View raw message