tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Reynolds" <...@DISC.com>
Subject FW: servlets and jsp with Tomcat 5.0 (more)
Date Mon, 26 Jul 2004 23:27:01 GMT
More info, the error that occurs is a 404:

HTTP Status 404 - /Household.jsp

------------------------------------------------------------------------
--------

type Status report

message /Household.jsp

description The requested resource (/Household.jsp) is not available.


------------------------------------------------------------------------
--------

Apache Tomcat/5.0.27


-----Original Message-----
From: Bill Reynolds 
Sent: Monday, July 26, 2004 5:22 PM
To: tomcat-user@jakarta.apache.org
Subject: servlets and jsp with Tomcat 5.0

I am trying to get an older demo that was written 2-3 years ago (by
someone else of course) working with Tomcat 5.0.
 
   My current problem is when my service routine is called in the
servlet for a new user, after doing the appropriate initialization of
attaining a database connection from my connection pool, it calls
returnToForm.
 
   My context is called Household.
 
   Here is the code snipet:
 
    /*returnToForm(HttpServletResponse res, String page)
     *Encodes and redirects the program to the specified page.
     */
    private void returnToForm(HttpServletResponse res, String page) {
            try {
                String sURL = res.encodeRedirectURL(page);
                res.sendRedirect(sURL);
            }catch(Exception e) {
                writeToLog("returnToForm error: " + e);
            }
 
 
    /*service(HttpServletRequest req, HttpServletResponse res)
     *This method is called for each client request. This method
controls the flow
     *of the program.
     */
    public void service(HttpServletRequest req, HttpServletResponse res)
throws IOException { 
        //Each client request has its own HttpSession object.
        HttpSession session = req.getSession(true);
        
        //The "command" parameter is an html <input> form object that
informs the servlet
        //what the client is requesting. Each "command" object has a
"value" that is passed
        //with the request.
        String command = req.getParameter("command");
        
        //If the "command" parameter value is null then this is a new
client. 
        if(command==null){
            newClient(req, res);
            returnToForm(res,"/Household.jsp");
            
        //If the "command" parameter value is "Query", then the client
is 
        //requesting that the query be run using the selected criteria.
        }else if(command.equals("Query")){
            writeToLog("Getting counts");
            boolean samelist = processForm(req);
            samelist = false;
            runQueries(req, samelist);
            writeToLog("finished running queries. selecting qualified");
            writeToLog("Selecting qualified");
            selectQualified(req);
            
            returnToForm(res,"/Household.jsp");
            
        //If the "command" parameter value is "Next", then the client is

        //requesting to view the next set of qualified records (next
page). The records
        //are displayed 10 rows at a time.
        }else if(command.equals("Next")){
            writeToLog("Getting next 10 rows");
            getNext(req);
            returnToForm(res,"/Household.jsp");
            
        //If the "command" parameter value is "Previous", then the
client is 
        //requesting to view the previous page. 
        }else if(command.equals("Previous")){
            writeToLog("Getting previous 10 rows");
            getPrevious(req);
            returnToForm(res,"/Household.jsp");
            
        //If the "command" parameter value is "Reset", then the client
is 
        //requesting that everything be reset so they can begin again.
        }else if(command.equals("Reset")){
            writeToLog("Resetting form.");
            clearAll(req);
            returnToForm(res,"/Household.jsp");
            
        //Any other value for the "command" parameter is invalid.
        }else{
            writeToLog("Something went wrong: " + command);
        }
    }
 
 
   Thanks in advance for any help...
   Bill Reynolds
   bfr@disc.com
 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message