Title: RE: [jdjlist] RE: JSP question - FORMs and parameters

You can test what the page sends by using a reflection jsp/servlet, an invaluable tool for JSP development. Just search Google for a handly model of how to do this.

Also, to see it quickly, point your HTML form to itself, and select method=GET.  You should see all the parameters being sent, including logon.x

Greg

-----Original Message-----
From: Luc Foisy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 12, 2002 8:15 AM
To: JDJList
Subject: [jdjlist] RE: JSP question - FORMs and parameters


Great, thanks!

New Controls:
<INPUT TYPE="image" ALT="Regent Logon"  VALUE="Regent Logon" NAME="logonr" SRC="javascript:void(0);" WIDTH="140" HEIGHT="27" ALIGN="top" BORDER="0">

<INPUT TYPE="image" ALT="Member Logon"  VALUE="Member Logon" NAME="logonm" SRC="javascript:void(0);" WIDTH="140" HEIGHT="27" ALIGN="top" BORDER="0">

New logonchoiceprocess.jsp:
if( request.getParameter("logonr.x") != null )
{
  response.sendRedirect("regentlogon.jsp");
  return;
}
else if ( request.getParameter("logonm.x") != null )
{
  response.sendRedirect("memberlogon.jsp");
  return;
}
else
{
  response.sendRedirect("index.jsp");
  return;
}

Hope it doesn't eventually bite me in the rear

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 12, 2002 10:52 AM
> To: JDJList
> Subject: [jdjlist] RE: JSP question - FORMs and parameters
>
>
> If I remember correctly, it's because when you submit via an
> image, instead
> of getting one parameter called "logon" in the request, you
> actually get two
> params called "logon.x" and "logon.y" which contain the
> coordinates at which
> you clicked on the image - there will *not* be a request param called
> "logon". So just check for "logon.x" instead of logon.
>
> It's ages since I used this, so I hope I've remembered it
> right! Hope this
> helps.
>
> Al.
>
>
>
> > -----Original Message-----
> > From: Luc Foisy [mailto:[EMAIL PROTECTED]]
> > Sent: 12 November 2002 15:44
> > To: JDJList
> > Subject: [jdjlist] JSP question - FORMs and parameters
> >
> >
> >
> > Or maybe its not, maybe its just my ignorance of what I am using
> >
> > The form:
> > <FORM NAME="loginchoice" METHOD="post"
> > ACTION=""logonchoiceprocess.jsp">
> >   <INPUT TYPE="image" ALT="Regent Logon"  VALUE="Regent
> > Logon" NAME="logon" SRC=""images\regentlogon.jpg"" WIDTH="140"
> > HEIGHT="27" ALIGN="top" BORDER="0">
> >   <INPUT TYPE="image" ALT="Member Logon"  VALUE="Member
> > Logon" NAME="logon" SRC=""images\memberlogon.jpg"" WIDTH="140"
> > HEIGHT="27" ALIGN="top" BORDER="0"> </FORM>
> >
> > The action ( yes I could probably handle it through html, but
> > thats not what I want ): <%@page
> >             language="java"
> >             contentType="text/html; charset=iso-8859-1"
> > %>
> > <%
> >     if( request.getParameter("logon") != null )
> >     {
> >             if(
> > request.getParameter("logon").equals("Regent Logon") )
> >             {
> >                     response.sendRedirect("regentlogon.jsp");
> >                     return;
> >             }
> >             else if (
> > request.getParameter("logon").equals("Member Logon") )
> >             {
> >                     response.sendRedirect("memberlogon.jsp");
> >                     return;
> >             }
> >     }
> >     else
> >     {
> >             response.sendRedirect("http://www.google.com");
> >             return;
> >     }
> > %>
> >
> > Well, I get get forwarded to google.
> >
> > <INPUT TYPE="submit" NAME="logon" VALUE="Regent Logon">
> > <INPUT TYPE="submit" NAME="logon" VALUE="Member Logon">
> >
> > will work with the above logonchoiceprocess.jsp
> > I am thinking the image is not submitting in the same way, or
> > jsp engine doesn't process that form type, dunno. Both types
> > do have a NAME and a VALUE, which I thought were the
> > important parameters here.... Anyone have a clue for me?
> >
> > Luc
 

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

Reply via email to