Hi,
Did any one look at this code??
Ashish
--- Ashish Kulkarni <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
=====
A$HI$H
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>