Hello, This is the first time I'm attempting to instantiate a java class inside of a jsp page. My java class compiles without errors. At the top of the class I do have a package statement and I do import the class implicitly into the jsp page, but when I try to do
MyClass myclass = new MyClass();
inside of my jsp page, I get an error "MyClass cannot be resolved to a type". I have no idea what's wrong, but it sounds like could be something very basic. Could anybody please give me some pointers for this error? Thanks in advance.
I decided to create a java bean and attempt to import the EpisDBUtil class into the bean instead of a jsp file. Both, the bean and the EpisDBUtil (java and class files) are in the same folder "beans". Both java files contain the same package statement. When I compile the EpisSelectBean, I get the same error I was getting earlier:"EpisSelectBean cannot be resolved to a type". Please Help! Here is how my EpisSelectBean bean:
Here is how my EpisSelectBean bean:
package jsps.beans;
import jsps.*; import java.util.*; public class EpisSelectBean implements java.io.Serializable{ private EpisDBUtil episdb;
I asked you to do two thing, neither of which you did.
First, please show us the relevant JSP code. The bean code is rather less helpful.
Secondly, when posting code on the Ranch, please use the UBB code tags to preserve formatting. It is incredibly hard to read unformatted code and many people will not bother. Please read this. You have been posting on the Ranch long enough to learn how to use it effectively. [ November 06, 2006: Message edited by: Bear Bibeault ]
liliya woland
Ranch Hand
Joined: Apr 11, 2006
Posts: 134
posted
0
I'm not sure what UBB tags are, but the jsp code is very basic:
I store my files in webapps/myjsps. I was able to fix the errors in jsp file (what's above works fine), but but still get same errors in java files. I think the errors have to do with configuration files...
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1002
posted
0
On UBB code, its simple enough. When you are editing a message you will see a bunch of buttons underneath the editor in a section labelled "Instant UBB Code" One of those buttons is "CODE" Simply select the text in the textarea, and push the "CODE" button. (Works on IE, don't know about firefox) Or you can just manually write [ CODE] and [ /CODE] around the bits you want to do as "code" (remove the space to so that it renders correctly)
It should end up looking something like this:
Note also I added an import statement for the package where your bean was. Also your beans should be deployed under the WEB-INF/classes directory
ie the class EpisSelectBean should be compiled to the file [webappname]/WEB-INF/classes/jsps/beans/EpisSelectBean.class