• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP page import - Directory setup

 
Nigel King
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My host requires that I do page imports, not from WEB-INF/classes, but from WEB-INF/classes/ek. So, at home, while my jsp may look like
<%@ page import = "MyClassFile" %>
I have to change this to
<%@ page import = "ek.MyClassFile" %>
when I upload it to my site. And put my class files into the ek directory.
This is causing problems with testing my site before upload - usually because I forget to change to ek somewhere and the site fails!
Is there any way I can mimic this directory set-up at home without packaging anything? Otherwise I'll need different .java files for home site and internet site too.

Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nigel King:
Is there any way I can mimic this directory set-up at home without packaging anything?


All Java classes should be in a package. What's your beef with that?
 
Nigel King
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
Let me ask the question differently ...
is there a difference in the bytecode between MyClass.class when it is within a package? Or is it exactly the same bytecode as the non-packaged class but just in a subdirectory?
If the latter, then I understand what I need to do.
If the former, I just shift the problem : instead of needing different jsp files between my local and uploaded site, I'd need different .java files.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're just asking for trouble by not making the structure of the app the same in development as in deployment. So I ask again: what's your beef with just putting your Java classes into a package as they should be in the first place?
 
Nigel King
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you're right. And I'm starting to realise the importance of that.
As I said, for some reason, my host requires that page imports come from the WEB-INF/classes/ek subdirectory. However, normal class files can and do exist in WEB-INF/classes.
As you might expect, some JSP files access the same classes as my servlets. So, at the moment, I am having to have two copies of these class files : one to exist in WEB-INF/classes and one to exist in WEB-INF/classes/ek. (These are just *copies* of the class files).
If I were to package everything, say into "nigel", then I would have class files in WEB-INF/classes/nigel and class-files-for-imports in WEB-INF/classes/ek/nigel. This doesn't solve my problem. It just moves the problem down a subdirectory!
I hope I have explained this well enough.
And thanks for your questions.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the host requires package ek (which seems a bit odd to me) why not just start your package hierarchy at ek? I'm not sure I'm really seeing the problem here.
 
Nigel King
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did as you suggested, Bear, and repackaged everything as "ek". I now have a local site which is a true counterpart of the one on the web.
Thank-you for your suggestions.
 
Peter Sin
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nigel King:
I did as you suggested, Bear, and repackaged everything as "ek". I now have a local site which is a true counterpart of the one on the web.
Thank-you for your suggestions.


it sounds you are using myjavaserver.com web hosting.
 
Nigel King
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand what you mean!
I tried to develop a site there and it quickly convinced me to take the plunge, get a domain, and a host, and do it properly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!