Here's a boiled down version of my code.

public void doGet(HttpServletRequest request, HttpServletResponse response)
                 throws ServletException, java.io.IOException
{
         String cmd = request.getParameter("cmd");

         if (cmd == null || cmd.equals(""))
         {
                 ExportHTML(request, response, filePath + "default.htm");
         }
         else if (cmd.equals("load"))
         {
                 String pgName = request.getParameter("pg");

                 if (pgName == null || pgName.equals(""))
                 {
                         System.out.println("page is missing or empty!!!");
                 }
                 else
                 {
                         System.out.println("Outputing page: " + pgName);
                         ExportHTML(request, response, filePath + pgName + 
".htm");
                 }
         }
         else if (cmd.equals("search"))
         {
         }
}

ExportHTML() is a function that reads in a html file and outputs it to the 
client.



Matt

At 02:19 PM 1/16/01, you wrote:

>Matt,
>
>You are doing it right.Try restarting the server and close all browser 
>windows that are open(just to make sure that the browser is not dishing 
>out the cached page).Also please post your code so that we can take a look 
>at it.
>
>hope this solves your problem
>Ram
>
>>From: Matt Becker <[EMAIL PROTECTED]>
>>Reply-To: [EMAIL PROTECTED]
>>To: [EMAIL PROTECTED]
>>Subject: Re: getParameter() help
>>Date: Tue, 16 Jan 2001 14:07:56 -0800
>>
>>Hi, Ram!
>>
>>I tried changing the name "page" to "pg" but that didn't change that
>>getParameter() returns other part of the text that's not part of the "pg"
>>variable. I thought maybe I was doing something wrong with the URL in how
>>the parameters were being passed in the GET that's being executed when the
>>URL is clicked on. The first parameter "load" is always correct.
>>
>>The separation between values passed is the "&" symbol, right?
>>
>>I'm using Tomcat 3.2.1, JDK 1.3, and IE 5.5 on a Win98 machine.
>>
>>Thanks!
>>
>>Matt
>>
>>
>>At 01:58 PM 1/16/01, you wrote:
>>>It looks like the "page" could be a key-word and is pulling
>>>"mainservlet?cmd=load",try changing page to something like "pg" and see if
>>>u get the same error.
>>>
>>>Ram
>>>
>>>
>>>>From: Matt Becker <[EMAIL PROTECTED]>
>>>>Reply-To: [EMAIL PROTECTED]
>>>>To: [EMAIL PROTECTED]
>>>>Subject: getParameter() help
>>>>Date: Tue, 16 Jan 2001 12:50:28 -0800
>>>>
>>>>Hi, I have a servlet which dispatches out various jsp's. Some of the jsp's
>>>>resulting html contain links back to the servlet to fire off another page
>>>>like this:
>>>><A HREF="mainservlet?cmd=load&page=home">HOME</A>
>>>>When I do a request.getParameter("cmd") the string I get is "cmd" which is
>>>>right.
>>>>When I do request.getParameter("page") the string I get is
>>>>"mainservlet?cmd=load" which is not right.
>>>>Does anyone know if I'm doing something wrong with how I'm writing the link
>>>>back to the servlet?
>>>>Thanks!
>>>>
>>>>Matt Becker
>>>>
>>>>
>>>>
>>>>________________________
>>>>Mythicwave Productions, Inc.
>>>>21053 Devonshire, #201
>>>>Chatsworth, Ca. 91311
>>>>818-700-1998
>>>>[EMAIL PROTECTED]
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>For additional commands, email: [EMAIL PROTECTED]
>>>
>>>_________________________________________________________________
>>>Get your FREE download of MSN Explorer at http://explorer.msn.com
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, email: [EMAIL PROTECTED]
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, email: [EMAIL PROTECTED]
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to