JSP classpath or how can my xxx.class file be located and compile.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, March 27, 2003 06:45 PM

I am a newbie to JSP. How do or where I should put my non package class in in order to be get compile. There are so many WEB_INF folder under the tomcat directory. My tomcat version is 4.1.24. I get below msg.. org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: -1 in the jsp file: null Below are my simple jsp files involve. This file is in the D: omcatwebappsROOTgetname.jsp What's your name? What's your e-mail address? What's your age? Next file is D: omcatwebappsROOTsavename.jsp <%@ page import="UserData.cl   More>>

I am a newbie to JSP. How do or where I should put my non package class in in order to be get compile. There are so many WEB_INF folder under the tomcat directory. My tomcat version is 4.1.24.
I get below msg..


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


An error occurred at line: -1 in the jsp file: null


Below are my simple jsp files involve.
This file is in the D: omcatwebappsROOTgetname.jsp





What's your name?

What's your e-mail address?

What's your age?







Next file is D: omcatwebappsROOTsavename.jsp
<%@ page import="UserData.class" %>






Continue




Next file is D: omcatwebappsROOT
extpage.jsp

<%@ page import="UserData.class" %>




You entered

Name: <%= user.getUsername() %>

Email: <%= user.getEmail() %>

Age: <%= user.getAge() %>





Next file is the java file in D: omcatwebappsROOTWEB_INFUserData.java


public class UserData {
String username;
String email;
int age;

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 username; }

public String getEmail() { return email; }

public int getAge() { return age; }
}




I successfully compile the java file to get the UserData.class file that place in the same dir as the UserData.java .

Tell me what I can do. I only gone through JSP for a week time only. Thus I post my program out as I don't know how should I write my doubt in word. HELP ..*sob*    <<Less

Re: JSP classpath or how can my xxx.class file be located and compile.

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, March 28, 2003 06:33 AM

Put it in a package, because otherwise you have implicitly put it in the unnamed, "default package", which can cause you problems. Search/browse the FAQ's here for more.

About | Sitemap | Contact