struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aamir Majeed" <aami...@SoftHome.net>
Subject Re: html:submit problem need help
Date Mon, 04 Sep 2000 09:02:34 GMT
I think ur code will work if u just write different value of ur sumit button
means

<html:submit  value ="login"/>
 <html:submit  value ="signout"/>

and take value of parameter from request within ur Action class
means
if ("login".equalsIgnoreCase(request.getParameter("submit"))){
// login code
}
else if ("signout".equalsIgnoreCase(request.getParameter("submit"))){
//submit code
}
 Regards
Aamir
----- Original Message -----
From: "Dan Walker" <walkerdan2@attbi.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Tuesday, September 03, 2002 10:01 PM
Subject: Re: html:submit problem need help


> 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:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>
>



--
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