Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Classes in application path  RSS feed

 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I have a class called .. childcare.components.staff
the classes file is in /WEB-INf/classes/childcare/components/Staff.class

Now do I have to declare this anywhere for my webapp to see the class file from the entire directory structure of the website. for example can a jsp file in /, /temp1, /temp2 can access the class file?

I am asking this cos, I dont seem to be able to get a JSP file with a sub dirctory to see the class file. And the my server hosting guys keep sending me emaiils saying I need to add full path of the class to my application.
Otherwise my application will not be able to detect the class
you are defining. I am not sure about this.. can someone knwo what this is about..
thank you .. .
[ August 29, 2008: Message edited by: Bear Bibeault ]
 
vk jain
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add a import directive on JSp page as
<%@ page import="childcare.components.Staff">

This will hopeflly solve your problem.
 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey cheers man.. sorry forgot to mention that is all there ..

I even declare,

<%
chilcare.balh.Staff staff = new childcare.blah.Staff ();
%>

in the JSP. I use the full path rather than importing the file to the page..

Any ideas ?

cheers

CJ
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP file with a sub dirctory


Exactly where is this JSP file located?
Exactly what happens when you address it?

Perhaps you should give us the complete directory layout of your web application...

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by cj jayamaha:
I have a class called .. childcare.components.staff
the classes file is in /WEB-INf/classes/childcare/components/Staff.class
Staff or staff? It can't be both.

I am asking this cos,
"cos" is not a word. Please use only real words when posting to the forums.
 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
classes,

WEB-INF/classes/childcare/users/Staff.class

jsp file accessing it

/childcare/index.jsp

error received..

http://www.silverhawksystems.com/childcare/test.jsp

how ever the same file on http://www.silverhawksystems.com/test.jsp works fine..

THANK YOU.. I am thinking this is something to do with the way tomcat6 is setup on the server.. any ideas?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:
Perhaps you should give us the complete directory layout of your web application...

If you are not going to answer the questions people who are trying to help you are asking, the amount of help you get will be limited.
[ August 29, 2008: Message edited by: Bear Bibeault ]
 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay okay .. I am sorry .. Here are the answer as asked for ..

Exactly where is this JSP file located?
Exactly what happens when you address it?

The jsp file is test.jsp and it is located in 2 places for testing purposes..
one under /test.jsp so accessed through http://www.silverhawksystems.com/test.jsp and the other /childcare/test.jsp accessed via http://www.silverhawksystems.com/childcare/test.jsp.

As you can the one placed under the / works fine. The one placed under /childcare does not.

The error I get when I do so, is

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

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

An error occurred at line: 8 in the jsp file: /test.jsp
childcare.users.Staff cannot be resolved to a type
5: String main_path = "http://www.silverhawksystems.com/childcare/";
6: String error_string = new String();
7: error_string = request.getParameter("error");
8: childcare.users.Staff staff = new childcare.users.Staff();
9: %>
10:
11:


An error occurred at line: 8 in the jsp file: /test.jsp
childcare.users.Staff cannot be resolved to a type
5: String main_path = "http://www.silverhawksystems.com/childcare/";
6: String error_string = new String();
7: error_string = request.getParameter("error");
8: childcare.users.Staff staff = new childcare.users.Staff();
9: %>
10:
11:


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

you can see this in real time form the link..

http://www.silverhawksystems.com/childcare/test.jsp
[ August 29, 2008: Message edited by: cj jayamaha ]
 
cj jayamaha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the class is Staff.class and not staff.class
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:

Perhaps you should give us the complete directory layout of your web application...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As an example of what you have not stated - exactly what is in the
"/childcare" directory?

Is there a WEB-INF subdirectory? Does it have a web.xml?
Is there a classes subdirectory? What is in it?

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, is there more than one WEB-INF? There should not be.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!