|
|
Index
| Recent Threads
| Who's Online
| User List
| Register
| Search
| Help
| |
![]() |
OpenCms Forum » List all forums » Forum: Questions about Template Development » Thread: cannot be resolved to a type |
|
Thread Status: Normal Total posts in this thread: 6 |
[Add To My Favorites] [Watch this Thread] |
| Author |
|
|
Stranger
|
Hello, I tried to work through the book "OpenCms 7 Development" which is about building a page with OpenCms 7RC2. Technicaly it is a Blog you build and after coding a template, a javaclass with logic for e.g. getting all blog entries of a month and a formular for the non-technical people working with this page you have to "connect" the template with your code by include the javaclass in the jsp-template. <%@ page session="true" import="com.deepthoughts.templates.*"%> After this import the jsp creates an instance of the class com.deepthoughts.templates.BlogJspTemplate. <% This is where the error occurs.
It seems that the import doesn't work at all. More than this is not described in this book an googleing around doesn't work either .The full message from the OpenCms log is:
It would be more than nice if someone could help me to solve my problem. Regards The_Mario |
|||||
|
|
Stranger
|
Hello Mario, do you solved the problem? I have the same... Regards JoeS |
||
|
|
Stranger
|
No, i still hope for some helpful tips. Regards The_Mario |
||
|
|
Stranger
|
You have to add the deepthoughts.jar into the lib folder of opencms (e.g. youre module). Then restart tomcat and it should work... Regards JoeS |
||
|
|
Stranger
|
At first thanks for the tip, but i already tried it and importing the BlogJspTemplate.class in the /system/modules/my.module.name/classes folder doesn't work either. |
||
|
|
Stranger
|
Hi Mario, Not sure how "java" you are so will assume little and apologise if incorrect :-) The problem here is that the jsp, when it is being compiled, cannot find the Java class that you are wanting to import. I am working through this book myself, just at the start, and find it isn't very clear on this. Like most java books, it leaves some stuff out. The import statement <%@ page session="true" import="com.deepthoughts.templates.*"%> suggests you have your class in a package com.deepthoughts.templates The first line in your java file should also read package com.deepthoughts.templates; and when you compile (if compiles to a jar) you should be able to open that jar file and see the following file structure <jarfile>/com/deepthoughts/templates/BlogJspTemplate.class If you are going to manually copy the class file into the classes directory it should also be in this file path. i.e. /system/modules/my.module.name/classes/com/deepthoughts/templates/BlogJspTemplate.class Note that if you do not have this package statement at the top of java class (you should btw) then the class can go into the classes directory but your import statement in the jsp would need to change to (i think this would work, not sure.. I always use package names!) <%@ page session="true"%> Hope this helps. Tomorrow, I should be able to get further into this book and perhaps up to where you seem to be stuck and might have some further tips if you need. Cheers, Troy |
||
|
| [Show Printable Version of Thread] |