Please have a look at the problem below:
> -----Original Message-----
> From: Legros, Bertrand
> Sent: Monday, December 06, 1999 10:28 AM
> To: '[EMAIL PROTECTED]'
> Subject: Forward Problem
>
> Hi all,
>
> Hope someone will be able to help me.
>
> I have a default html page with a login. When submitted, the following
> servlet doPost is in charge of
> 1) generating the Bean which will create the needed results for JSP
> 2) forward to the appropriate JSP Page.
>
> I am running on NT, Java 2 and JSWDK 1.01
>
> The problem is :
> When doPost is called, the system crashed (Dr Watson) when it reaches
> rd.forward(req,res).
> All the code linked to the HelperBean has been tested separately and is
> ok.
> The target page ("home.jsp") is in examples/jsp/BugTrackerJSP/home.jsp
> and the url used for the request dispatcher is :
> /jsp/BugTrackerJSP/home.jsp
>
> Can someone help with this forward problem?
> Thanks for replying directly to my email address.
>
> Bertrand
>
> --------------------------------------------------------
> Here is some code from my servlet.
>
> public synchronized void doPost (HttpServletRequest
> req,HttpServletResponse res) throws ServletException,IOException {
>
> res.setContentType("text/html");
>
> String command = req.getQueryString();
> Hashtable parms = new Hashtable(20);
> String parmName;
> String parmValue;
> session = req.getSession(true);
> HelperBean hb;
> Hashtable results;
>
> // get the parameters
> for (Enumeration e =
> req.getParameterNames();e.hasMoreElements();) {
> parmName = (String) e.nextElement();
> parmValue = req.getParameter(parmName);
> parms.put(parmName,parmValue);
> }
>
> //determine the command
> if (parms.get("Transaction")!=null) {
> command = (String)parms.get("Transaction");
> }
>
> //get the Helping JavaBeans
> // return the class to instantiate
> String helperBeanName =
> utilities.ResourcesManager.getResource(command);
>
> try {
> Class c = Class.forName(helperBeanName);
> hb = (HelperBean)c.newInstance();
> // send the parameter to HelperBean
> results = hb.execute(parms);
> // results should contain target(JSP) and Vector for
> target
> session.putValue("INResults",results);
> String url = (String)results.get("JSPTarget");
> System.out.println("Target received : "+url);
> ServletContext sc = getServletContext();
> System.out.println("Context get");
> RequestDispatcher rd = sc.getRequestDispatcher(url);
> System.out.println("dispatcher received");
> rd.forward(req,res);
> System.out.println("forward done");
> } catch (ClassNotFoundException cne) {
> error(cne.getMessage());
>
> } catch (InstantiationException ie) {
> error(ie.getMessage());
> } catch (IllegalAccessException iae) {
> error(iae.getMessage());
> }
> }
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html