Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem for all ..

 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a web-app directory struture like ..

In folder Folder02 you have a JSP page, let us say page01.jsp
Now that page01 wants to access a class MyClass which has a default package(i.e no package name).
Where you should put MyClass.class file so that page01 can access this class?
Himt : what will be the import attribute of page directive? (I got a way to around the problem)
so ... your times start NOW ..
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should put your classes in WEB-INF/classes. If you have any jars, they should be in WEB-INF/lib.
In your case, the page01.jsp should include the following line.
<%@ page import="MyClass" %>
then you can access MyClass, e.g.
<jsp:useBean id="myCls" class="MyClass" />
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the one and only winner is Wong .....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic