dcsimg
Netbeans won't let me import a javabean
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, July 24, 2003 10:58 PM

JSP Page I'm on windows 2k, using netbeans 3.5, j2se 1.4, tomcat 4. in my project, i have a web module and it has a index.jsp and a Alpha.java and Alpha.class files in the WEB-INF/classes directory. my index.jsp is: <%@page contentType="text/html" import="Alpha" %> my Alpha.class is: import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.Serializable; public class Alpha extends Object implements Serializable { private static final String PROP_SAMPLE_PROP   More>>
JSP Page

I'm on windows 2k, using netbeans 3.5, j2se 1.4, tomcat 4.


in my project, i have a web module and it has a index.jsp and a Alpha.java and Alpha.class files in the WEB-INF/classes directory.


my index.jsp is:
<%@page contentType="text/html" import="Alpha" %>






















my Alpha.class is:


import java.beans.PropertyChangeListener;


import java.beans.PropertyChangeSupport;


import java.io.Serializable;


public class Alpha extends Object implements Serializable {
private static final String PROP_SAMPLE_PROPERTY = "SampleProperty";


private String sampleProperty;


private PropertyChangeSupport propertySupport;


public Alpha() {


propertySupport = new PropertyChangeSupport( this );


}


public String getSampleProperty() {


return sampleProperty;


}


public void setSampleProperty(String value) {


String oldValue = sampleProperty;


sampleProperty = value;


propertySupport.firePropertyChange(PROP_SAMPLE_PROPERTY, oldValue, sampleProperty);


}


public void addPropertyChangeListener

(PropertyChangeListener listener) {


propertySupport.addPropertyChangeListener(listener);


}


public void removePropertyChangeListener

(PropertyChangeListener listener) {


propertySupport.removePropertyChangeListener(listener);


}


}




Alpha.java compiles fine. but when i try to compile index.jsp, i get:


work$jsp.java [3] '.' expected


import Alpha;


^


1 error


Errors compiling work.





Last week i was able to do something simple like this where i import the class name, and usebean:... was the same and it compiled fine. could it netbeans? i mounted the class directory to make sure it's in the classpath.

   <<Less

Re: Netbeans won't let me import a javabean

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, July 25, 2003 06:44 AM

Add an explicit package prefix e.g. "import mypkg.Alpha", and move the Alpha.java and Alpha.class under "mypkg/". Otherwise you are trying to play with the default implementation-dependent "unnamed package", and I hear this has never really been a good idea, but now newer versions of JDK and tools will explicitly not allow it at all anymore.

About | Sitemap | Contact