Jsp bean error

2004-01-07 Thread X V Jay
Hi,
I have been unable to use jsp beans.

Here are the code fragments

ControllerServlet.java
public class ControllerServlet extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
 .
 .
// instantiate the DbBean
DatabaseBean databaseBean = new DatabaseBean();
// intialise the bean's fields
databaseBean.setDbUrl(config.getInitParameter("dbUrl"));
databaseBean.setDbUserName(config.getInitParameter("dbUserName"));
databaseBean.setDbPassword(config.getInitParameter("dbPassword"));

// put the bean in the servlet context
context.setAttribute("theBean",databaseBean);
}
..
..
}

I am now trying to use the databaseBean in process.jsp

<%@ page import="java.util.*" %>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>



...
...

This is error reported by Tomcat.


exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 5 in the jsp file: /jsp/student/process.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\jakarta-tomcat-4.1.27
\work\Standalone\localhost\disa\jsp\student\process_jsp.java:47: cannot 
resolve symbol
symbol  : class DatabaseBean
location: class org.apache.jsp.process_jsp
  DatabaseBean theBean = null;
  ^
An error occurred at line: 5 in the jsp file: /jsp/student/process.jsp
Generated servlet error:
C:\jakarta-tomcat-4.1.27
\work\Standalone\localhost\disa\jsp\student\process_jsp.java:49: cannot 
resolve symbol
symbol  : class DatabaseBean
location: class org.apache.jsp.process_jsp
theBean = (DatabaseBean) pageContext.getAttribute("theBean", 
PageContext.APPLICATION_SCOPE);
   ^
An error occurred at line: 5 in the jsp file: /jsp/student/process.jsp
Generated servlet error:
C:\jakarta-tomcat-4.1.27
\work\Standalone\localhost\disa\jsp\student\process_jsp.java:52: cannot 
resolve symbol
symbol  : class DatabaseBean
location: class org.apache.jsp.process_jsp
theBean = (DatabaseBean) java.beans.Beans.instantiate
(this.getClass().getClassLoader(), "DatabaseBean");
   ^
3 errors


What's wrong? Please help.
Regards
Jay

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



Fw: Re: Can't run servlets

2003-12-26 Thread X V Jay
Hi,
I did what was told bt Antony. But the problem persists. Looking 
forward for help
Regards
X V Jay--- Begin Message ---
declarations. Like this

TestingServlet
TestingServlet



You have to declare the url mappings for servlets. Do this after all servlet
declarations. Like this

TestingServlet
TestingServlet



  TestingServlet
  /TestingServlet
 

Another way is using the invoker servlet provided by Tomcat. If using
invoker servlet no need of servlet mapping. But it have security bugs and is
disabled by default.

Antony Paul.

- Original Message -
From: "X V Jay" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 26, 2003 1:43 PM
Subject: Can't run servlets


> Hi,
> I have been unable to run servelets using my tomacat. I have put the
> class file in WEB-INF\classes. Please tell me where did I go wrong ?
> Thank you
> X V Jay
>
>
> Here is the source
> =
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.util.*;
>
> public class TestingServlet extends HttpServlet {
>
>   public void doGet(HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException, IOException {
>
> PrintWriter out = response.getWriter();
> out.println("");
> out.println("");
> out.println("Servlet Testing");
> out.println("");
> out.println("");
> out.println("Welcome to the Servlet Testing Center");
> out.println("");
> out.println("");
>   }
> }
> 
>
> Here is the web.xml
> =
> 
>
>  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
>
> 
> 
> TestingServlet
> TestingServlet
> 
> 
> ===
>
> Error message generated
> ==
>
> HTTP Status 404 - /myJspApps/servlet/TestingServlet
>
> --
> type Status report
>
> message /myJspApps/servlet/TestingServlet
>
> description The requested resource (/myJspApps/servlet/TestingServlet)
> is not available.
>
>
> ---
>
> Apache Tomcat/4.1.27
>
> =
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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


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

Can't run servlets

2003-12-26 Thread X V Jay
Hi,
I have been unable to run servelets using my tomacat. I have put the 
class file in WEB-INF\classes. Please tell me where did I go wrong ?
Thank you
X V Jay


Here is the source
=
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class TestingServlet extends HttpServlet {

  public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

PrintWriter out = response.getWriter();
out.println("");
out.println("");
out.println("Servlet Testing");
out.println("");
out.println("");
out.println("Welcome to the Servlet Testing Center");
out.println("");
out.println("");
  }
}


Here is the web.xml
=


http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>



TestingServlet
TestingServlet


===

Error message generated
==

HTTP Status 404 - /myJspApps/servlet/TestingServlet

--
type Status report

message /myJspApps/servlet/TestingServlet

description The requested resource (/myJspApps/servlet/TestingServlet) 
is not available.


---

Apache Tomcat/4.1.27

=

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



Re: Re: Can't run servlets

2003-11-07 Thread X V Jay
Thank you guys,
Its now working with servlet mapping.
Regards
X.V.Jay
 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Am Thursday 06 November 2003 09:48 schrieb Basavaraju P. Banakar:
> > Servlet mapping is not madatory..
> 
> Well, not from the viewpoint of the DTD, but if you dont use the 
invoker [Jay 
> indicates by mentioning  sepcifications], you'll need one 
(Otherwise 
> I'd really like to know why I have to use them with my Tomcat 4.1.24 
> installation ;-)
> 
> But if servlet mappings are still not enough, Jay has to check the 
errorlogs 
> of his server $TOMCAT_HOME/logs, there are a lot of possible other 
errors. 
> His servlet might have thrown an exception, some xml file might be 
malformed 
> (this would be my next guess).
> 
> Mit freundlichem Gruß / With kind regards
>   Holger Klawitter
> - --
> lists  klawitter  de
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.2.2 (GNU/Linux)
> 
> iD8DBQE/qhCr1Xdt0HKSwgYRAgkQAJ4ko9IJsGBFZbI/YlIREOxqigZOqACfRq2s
> yGRgQKyOGSNfEMPFx2n8op4=
> =AXDS
> -END PGP SIGNATURE-
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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



Re: Re: Can't run servlets

2003-11-06 Thread X V Jay
Even after adding a servlet-mapping after my servlet declarations the 
problem is persisting. 
With regards
X V Jay


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Am Thursday 06 November 2003 08:04 schrieb X V Jay:
> > Hi,
> > I am a newbie, I have been unable to run a servlet. These are the 
steps
> > I took...
> >
> > 1. I wrote a small test servlet.
> > 2. I created a 'test' directory under webapps.
> > 3. Created WEB-INF in 'test' and put the testweb.class in classes 
dir.
> > 4. Created a web.xml in WEB-INF
> >
> > 
> >  > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > "http://java.sun.com/dtd/web-app_2_3.dtd";>
> > 
> > 
> > abcd
> > testweb
> > 
> > 
> 
> You also need to add a servlet-mapping after your servlet 
declarations:
> 
> 
>   abcd
>   /servlet/abcd
> 
> 
> Mit freundlichem Gruß / With kind regards
>   Holger Klawitter
> - --
> lists  klawitter  de
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.2.2 (GNU/Linux)
> 
> iD8DBQE/qf5M1Xdt0HKSwgYRApeXAJwLtTsABkr4xJdoVA/MSGl6NQSrxACeLiyx
> SJwz9YUQmb7G3fLzGJScS2E=
> =eoEK
> -END PGP SIGNATURE-
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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



Can't run servlets

2003-11-06 Thread X V Jay
Hi,
I am a newbie, I have been unable to run a servlet. These are the steps 
I took...

1. I wrote a small test servlet.
2. I created a 'test' directory under webapps. 
3. Created WEB-INF in 'test' and put the testweb.class in classes dir.
4. Created a web.xml in WEB-INF


http://java.sun.com/dtd/web-app_2_3.dtd";>


abcd
testweb



5. Tried to run the servlet form http://localhost:8080/test/servlet/abcd

Error displayed: The requested resource (/test/servlet/abcd) is not 
available.

Is there anything which I have missed or done something wrong ?
Please help me.
Thank you

OS: XP Professional
Tomcat version: 4.1.27

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