Re: JavaBeans
--- Anibal Constante Brito [EMAIL PROTECTED] wrote: I have the same problem of other, I read a some tutorial too and... public class UserData { String username; String email; int age; public void setUsername( String value ) {... I put in UserData.java and compiled and put in the same directory \WEB-INF\classes, and when call I find this and compiled and put in the same directory \WEB-INF\classes, and when call SaveName.jsp jsp:useBean id=user class=UserData scope=session/jsp:setProperty name=user property=*/ receive this error: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 1 in the jsp file: /SaveName.jsp Generated servlet error: C:\Program Files\Apache Tomcat 4.0\work\localhost\_\SaveName$jsp.java:56: Class org.apache.jsp.UserData not found. UserData user = null; ^ SNIP Did you include a package statement in your UserData.java file? Something like package org.apache.jsp; ? If so, then the compiled class file needs to be in /WEB-INF/classes/org/apache/jsp/ = [EMAIL PROTECTED] Hacking is a Good Thing! See http://www.tuxedo.org/~esr/faqs/hacker-howto.html __ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JavaBeans
Could this be a package issue as well (see Tomcat can't find my classes)? Classes places in the /classes folder must be in nested folders matching the package name. When you reference this class, you must use the package name, for instance: jsp:useBean id=user class=mypackage.userclasses.UserData scope=session/ Eric At 02:30 AM 5/24/2002, you wrote: I have the same problem of other, I read a some tutorial too and... public class UserData { String username; String email; int age; public void setUsername( String value ) {... I put in UserData.java and compiled and put in the same directory \WEB-INF\classes, and when call I find this and compiled and put in the same directory \WEB-INF\classes, and when call SaveName.jsp jsp:useBean id=user class=UserData scope=session/jsp:setProperty name=user property=*/ receive this error: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 1 in the jsp file: /SaveName.jsp Generated servlet error: C:\Program Files\Apache Tomcat 4.0\work\localhost\_\SaveName$jsp.java:56: Class org.apache.jsp.UserData not found. UserData user = null; ^ Why? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JavaBeans
On 5/24/02 7:39 AM, Eric Everman [EMAIL PROTECTED] wrote: Could this be a package issue as well (see Tomcat can't find my classes)? Classes places in the /classes folder must be in nested folders matching the package name. When you reference this class, you must use the package name, for instance: jsp:useBean id=user class=mypackage.userclasses.UserData scope=session/ I sent like three responses to this yesterday. I'll paste them in until people get sick of this, or this problem goes away. Eric fillup - From the error message, your class LogonData is part of the org.apache.jsp packages. If that is right, you will need to put the class file LogonData.class in c: \tomcat\webapps\ROOT\WEB_INF\classes\org\apache\jsp Sorry to be a pedant, but this is not true. Tomcat looks for classes that don't have a package home in the tomcat default jsp package -- which is org.apache.jsp . This is why you either need to explicitly import the classes before you use them or put them in your own packages to avoid this problem altogether. See my answer of about 5 minutes ago. cheers fillup -- you need to import the bean before you can use it - finally remembered this. it's been discussed a lot on this list. i think -- or maybe i'm remembering something else. try making a line at the top of your jsp that says: %@ page language=java contentType=text/html import=LogonData % If you put your classes in packages this doesn't happen, AFAIK. fillup On 5/24/02 7:39 AM, Eric Everman [EMAIL PROTECTED] wrote: Could this be a package issue as well (see Tomcat can't find my classes)? Classes places in the /classes folder must be in nested folders matching the package name. When you reference this class, you must use the package name, for instance: jsp:useBean id=user class=mypackage.userclasses.UserData scope=session/ Eric At 02:30 AM 5/24/2002, you wrote: I have the same problem of other, I read a some tutorial too and... public class UserData { String username; String email; int age; public void setUsername( String value ) {... I put in UserData.java and compiled and put in the same directory \WEB-INF\classes, and when call I find this and compiled and put in the same directory \WEB-INF\classes, and when call SaveName.jsp jsp:useBean id=user class=UserData scope=session/jsp:setProperty name=user property=*/ receive this error: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 1 in the jsp file: /SaveName.jsp Generated servlet error: C:\Program Files\Apache Tomcat 4.0\work\localhost\_\SaveName$jsp.java:56: Class org.apache.jsp.UserData not found. UserData user = null; ^ Why? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: javabeans with jsp
A good reference is http://java.sun.com/j2ee/tutorial/doc/JSPBeans.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 4:07 PM To: [EMAIL PROTECTED] Subject: javabeans with jsp I don't know where exactly the javabean class goes in order for a jsp script to find it. Lets say that I have a jsp script in: ~/examples/jsp/tester/tester.jsp and tester.jsp uses a bean class called UserBean.class. tester.jsp has this line in the beginning: jsp:useBean id=bean class=UserBean scope=session / My question is from this point where do I put the bean UserBean and do I have to touch the web.xml or server.xml at all to resolve this problem
Re: javabeans with jsp
You can put the bean at the WEB-INF/classes directory of your application ! Regards Daniel ___ Daniel de Almeida Alvares Santos - SP - Brasil [EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 20, 2001 8:07 PM Subject: javabeans with jsp I don't know where exactly the javabean class goes in order for a jsp script to find it. Lets say that I have a jsp script in: ~/examples/jsp/tester/tester.jsp and tester.jsp uses a bean class called UserBean.class. tester.jsp has this line in the beginning: jsp:useBean id=bean class=UserBean scope=session / My question is from this point where do I put the bean UserBean and do I have to touch the web.xml or server.xml at all to resolve this problem
RE: JavaBeans
Hi Kavi, JavaBeans must be placed in the Web-Inf/classes directory of your webapp as long as they don't belong to a package and you don't set a classpath. Else you must create a directory structure similar to your package name, i.e. package: yourpack.com -- web-inf/classes/com/yourpak. Hope this helps Thomas
RE: JavaBeans
Hi Place the bean class either in the Web-inf/classes directory (along with the package directory structure) or package it in a jar and place it in the Web-Inf/lib directory. regards -Original Message- From: Kavi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 7:13 AM To: [EMAIL PROTECTED] Subject: JavaBeans Hi everyone, I am trying to use my first javabean in a JSP using tomcat but where I must place the bean(or package??) I am getting error 500 - Unable to load class Please help!! __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ Important: Internet communications are not necessarily secure and may be intercepted or changed after they are sent. The Abbey National Group does not accept liability for any such changes. If you wish to confirm the origin or content of this communication, please contact the sender using an alternative means of communication. This communication does not create or modify any contract. If you are not the intended recipient of this communication you should destroy it without copying, disclosing or otherwise using its contents. Please notify the sender immediately of the error. The Abbey National Group comprises Abbey National plc and its subsidiary group of companies. Abbey National plc. Registered Office: Abbey House, Baker Street, London, NW1 6XL. Reg. No. 2294747. Registered in England.