I created a simple application for getting name,age and so on.Then By hitting submit will show the values entered in a session.So i created a Java file with getters and setters for Name, age and so on. <jsp:useBean id="user" class="UserData" scope="session"/> where i have to store this UserData.class file. scrathing my head for long time Thanks in Advance Srinivas
Genji B Srinivas<br />M.Tech (IT) Aus
Ramya Shetty
Greenhorn
Joined: May 04, 2004
Posts: 1
posted
0
Place the Class file for the bean in a folder under WEB-INF/classes.
Srinivas Genji
Ranch Hand
Joined: May 04, 2004
Posts: 37
posted
0
Thanks for Reply,i placed class file in web-inf/classes but still i`m getting these errors,org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
An error occurred at line: 6 in the jsp file: /JSP/Test.jsp
Generated servlet error: C:\Program Files\ApacheTomcat 4.0\work\localhost\_\JSP\Test$jsp.java:86: Class org.apache.jsp.UserData not found. UserData user = null; ^
An error occurred at line: 6 in the jsp file: /JSP/Test.jsp
Generated servlet error: C:\Program Files\ApacheTomcat 4.0\work\localhost\_\JSP\Test$jsp.java:89: Class org.apache.jsp.UserData not found. user= (UserData) ^
An error occurred at line: 6 in the jsp file: /JSP/Test.jsp
Generated servlet error: C:\Program Files\ApacheTomcat 4.0\work\localhost\_\JSP\Test$jsp.java:94: Class org.apache.jsp.UserData not found. user = (UserData) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "UserData"); ^ 3 errors, 1 warning
Do not use the default package. Create a package directory structure under WEB-INF/classes, and put the package specification at the beginning of all your JavaBean classes.
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Rishi Tandon
Greenhorn
Joined: Oct 23, 2002
Posts: 17
posted
0
Ya Nathan is rite .
U can follow this code :
Beans should always be associated with some package other than DEFAULT.
Rishi Tandon<br />SCJP 1.2<br />SCBCD
Srinivas Genji
Ranch Hand
Joined: May 04, 2004
Posts: 37
posted
0
Thanks Nathan and Rishi for helping me, Now its working fine. cheers mate Srinivas
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
Still i m getting the same error as the above my class file is placed my class file in (C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\classes) package user; public class UserData { String username; String email; int age; public UserData(){ } /*public void setUsername( String value ) { username = value; }
public void setEmail( String value ) { email = value; }
public void setAge( int value ) { age = value; }*/
public String getUsername() { return "jothi"; }
public String getEmail() { return "yahoo"; }
public int getAge() { return 10; } }
MY jsp page is <jsp:useBean id="user" class="user.UserData" scope="session"/> <jsp:getProperty name="user" property="*" /> <HTML> <BODY> You entered<BR> Name: <%= user.getUsername() %><BR> Email: <%= user.getEmail() %><BR> Age: <%= user.getAge() %><BR> </BODY> </HTML> error i got is that org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error: [javac] Since fork is true, ignoring compiler setting. [javac] Compiling 1 source file [javac] Since fork is true, ignoring compiler setting. [javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\SaveName_jsp.java:41: cannot resolve symbol [javac] symbol : class UserData [javac] location: class org.apache.jsp.SaveName_jsp [javac] UserData user = null; [javac] ^ [javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\SaveName_jsp.java:43: cannot resolve symbol [javac] symbol : class UserData [javac] location: class org.apache.jsp.SaveName_jsp [javac] user = (UserData) pageContext.getAttribute("user", PageContext.SESSION_SCOPE); [javac] ^ [javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\SaveName_jsp.java:46: cannot resolve symbol [javac] symbol : class UserData [javac] location: class org.apache.jsp.SaveName_jsp [javac] user = (UserData) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "UserData"); [javac] ^ [javac] 3 errors
Help is urgently needed thanks in advance
jothish
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
i have placed the class file in the path C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\WEB-INF\classes
hi Ben Souther , You mean to say it to be like this path... C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\WEB-INF\classes\user\UserData.class
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
I m using jasper reports to my project... here is my servlet class i m using .. i want to get the output from of the pdf file in client side... but i m not getting the stream of pdf in client side... even there is no errror showing in the tomcat server when i load nthis servlet using an html file ...... help is needed urgently
I hadn't noticed earlier that you tacked your question onto someone else's thread. This is called hi-jacking a thread and is considered rude. Your last post is completely unrelated. Please start a new thread with this new question.
Thank you -Ben [ January 05, 2006: Message edited by: Ben Souther ]
jothish chokkalingam
Ranch Hand
Joined: Jan 02, 2006
Posts: 50
posted
0
yes ben i have posted a new thread reg opening a pdf file created by jasper in client side can you please solve position
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: where to place Bean file(*.class)in Tomcat server