JSP import Statement importing a Class File giving ERROR
Hey guys,
There is a problem to which I dont know the reason,
Consider the code below:
<%@ import Converter, ConverterHome %>
It gives me a Compile Time error of this type:
'.' Required in import Converter ;
but when i put these classes in a package suppose "converter"
and the above import statement like this :
<%@ import converter.Converter,converter.ConverterHome%>
It gives me no error
So whats the reason behind this? Cant I compile a JSP program by refrencing classes without in any package?
please Reply
Thanks in advance..
So whats the reason behind this?
Cant I compile a JSP program by refrencing classes without in any package?No, I do not beleive you can, is you are using Java 1.4. In 1.4, you can only reference classes in the Default Package (none) from other classes in the default package. If you are in a package, then you can not import from the default package. And this is for ALL java classes, not just JSP and Serlets. Since the JSP servlet would be part of a package (which depends on the server you are using) you will need to put your classes into packages to import them...
Similar Messages
-
Whether to import the class file put in JAVA_TOP
I have put the java class file in JAVA_TOP. Now i want to access the method in that class from jsp, is it necessary to import the class file path in jsp. Without importing the class file path how can i access the method.
JSP Coding
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>
Hello World
</title>
</head>
<body>
<%
sample objsample = new sample();
%>
<b>
NAME : </b><input type="text" value="<%=objsample.getName()%>">
</body>
</html>
Class file
public class sample
public sample()
String name = "JOHN";
public String getName()
return name;
Pls help meHi,
For sys outs check the following log files:
<ORACLE_SOA_HOME>/opmn/logs/default_group~home~default_group~1.log
or
<ORACLE_SOA_HOME>/j2ee/home/log/home_default_group_1/system_*.log
Here server instance name is home, change it with your server instance name.
Dharmendra
http://soa-howto.blogspot.com -
Importing a .class file into my package?
Hi. I'm making a java program but I need to use an external .class file to get variables and use methods from. Is it possible to "import" a class file into my package to be able to do so?
ThanksBasically, for our last project we created a class
that held the information about a year: how many days
were in a month, how many months were in a year, etc.
etc. For this project, we'll be having to use that
same class to make a GUI calendar. Our teacher
provided a class which he compiled for us to use in
our projects incase our previous class had some flaws
in it, which mine did. Unfortunately, it's in .class
format and I don't know how to use it in my package!That's going to be a problem then. I would assume that it is going to have an API like your old one did. Same name and same methods etc. So do you know what the name and method signatures of your class were supposed to be? -
Importing my class files from another folder
hello everybody ,im creating a software package for a new company and want to organise my class files into different folders so that it would be easier for someone to navigate through them and update if necessary ,how do i import an instance of a class in a file that is in a subfolder of the folder that contains the class that is calling it.(sorry for being a bit long winded) iv tried diff things and they didn't work.
At the moment i have all the files in the one folder,but as i said above want to put them into appropriate folders.
I would be very gratefull if someone could give me some examples and if not some appropriate links,thanks iv tried looking for this on the net but could not find anything.What you should probably do is to organise your classes into a heirarchy of packages not merely folders. Java expects the package structure to be reflected in the directory structure holding both the source and class files. If it's looking for a class called, say, com.mycompany.widgets.MainWidget it expects to find it in a directory com//mycompany/widgets relative the the directory on the class path.
Use the package directive in each source file to indicate the package path. -
My JSP can't find a class file
Hi
I am trying to view a JSP but I get ClassNotFoundException. I know that it means that it can't find the class but I can't understand why.
my directory structure:
Intranet->source
->jsp
->WEB-INF->classes->source-><class file here>
first line of .java file:
package source;
JSP code:
<%@page import="java.sql.*, source.*, java.util.*;" %>
<jsp:useBean id="dbConnect" scope="session" class="source.DBConnect">
<jsp:getProperty name="dbConnect" property="jdbc:odbc:Auto_Intranet" />
</jsp:useBean>
Must I create an environment variable for 'Windows': with classpath " .....\WEB-INF\classes"
The Windows environment variable doesn't exist----using XP ProLooks right to me.
You don't need a classpath variable. Web containers ignore it anyway.
Which class is not found? source.DBConnect?
Is DBConnect in a package called source?
Is your database driver in the web-inf/lib directory?
Please post the full error message with stack trace - it will be easier to sort out.
Good luck,
evnafets -
Importing a class file to change the Texture colour of a JFrame and JMenu?
Well, my friend told me its possible, he has it on his Jframe, this is the code he uses;
package theme;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.metal.OceanTheme;
public class BlackTheme extends OceanTheme
public BlackTheme()
public String getName()
return "Black";
protected ColorUIResource getPrimary1()
return primary1;
protected ColorUIResource getPrimary2()
return primary2;
protected ColorUIResource getPrimary3()
return primary3;
protected ColorUIResource getSecondary1()
return secondary1;
protected ColorUIResource getSecondary2()
return secondary2;
protected ColorUIResource getSecondary3()
return secondary3;
protected ColorUIResource getBlack()
return black;
protected ColorUIResource getWhite()
return white;
private final ColorUIResource primary1 = new ColorUIResource(33, 33, 33);
private final ColorUIResource primary2 = new ColorUIResource(160, 160, 160);
private final ColorUIResource primary3 = new ColorUIResource(77, 77, 77);
private final ColorUIResource secondary1 = new ColorUIResource(0, 0, 0);
private final ColorUIResource secondary2 = new ColorUIResource(51, 51, 51);
private final ColorUIResource secondary3 = new ColorUIResource(100, 100, 100);
private final ColorUIResource black = new ColorUIResource(20, 20, 20);
private final ColorUIResource white = new ColorUIResource(125, 125, 125);
}So how would i make it use that as the JFrame etc, because i tried like
import theme.BlackTheme;and
MetalLookAndFeel.setCurrentTheme(new BlackTheme()); but it dosn't re-colour it, am i doing something wrong? It only re-colours the actuall outside frame, not the main bits or menu bar as it is suppose to.
ThanksHere are pictures of how the bar should look and what mine looks like.
THIS IS WHAT MINE LOOKS LIKE
[http://i166.photobucket.com/albums/u116/the_owner2007/menubaretc.jpg]
This is how it should look correct...
[http://i166.photobucket.com/albums/u116/the_owner2007/menubaretcblack.jpg]
Edited by: i_own_pking on Apr 5, 2008 4:07 AM -
NWDI import of sca files repository error
Hi,
When I am importing SCA files. I am getting following message.Please help me.
SAP_JTECHS
20081202184915 Info :Starting Step Repository-import at 2008-12-02 18:49:15.0396 -5:00
20081202184915 Info :Component:sap.com/SAP_JTECHS
20081202184915 Info :Version :SAP AG.20080216073957
20081202184915 Info :1. propagation request is of type TCSSoftwareComponent
20081202184915 Info :Sources will not be imported for this SC
20081202184915 Info :Step Repository-import ended with result 'not needed' at 2008-12-02 18:49:15.0396 -5:00
SAP_BUILDT
20081202184221 Info :Starting Step Repository-import at 2008-12-02 18:42:21.0146 -5:00
20081202184221 Info :Component:sap.com/SAP_BUILDT
20081202184221 Info :Version :SAP AG.20080216005300
20081202184221 Info :1. propagation request is of type TCSSoftwareComponent
20081202184221 Info :Sources will not be imported for this SC
20081202184221 Info :Step Repository-import ended with result 'not needed' at 2008-12-02 18:42:21.0146 -5:00
SAPPCUI_GP
20081202185133 Info :Starting Step Repository-import at 2008-12-02 18:51:33.0735 -5:00
20081202185133 Info :Component:sap.com/SAPPCUI_GP
20081202185133 Info :Version :MAIN_ERP53PAT_C.20080709102623
20081202185133 Info :1. propagation request is of type TCSSoftwareComponent
20081202185133 Info :Sources will not be imported for this SC
20081202185133 Info :Step Repository-import ended with result 'not needed' at 2008-12-02 18:51:33.0750 -5:00
SAP_ESS
20081202185713 Info :Starting Step Repository-import at 2008-12-02 18:57:13.0511 -5:00
20081202185713 Info :Component:sap.com/SAP_ESS
20081202185713 Info :Version :MAIN_ERP53VAL_C.20080605130151
20081202185713 Info :1. propagation request is of type TCSSoftwareComponent
20081202185825 Info :Propagatable:<a href="http://SAP-PORTALDEV:50000/dtr/system-tools/reports/ResourceDetails?resourceID=ac445ae8331a11ddbdec0030057116fe&path=&command=Show" target="_blank">ac445ae8331a11ddbdec0030057116fe</a> exists allready in the repository. No import necessary.Looks OK. This is not the first time you importing these SCs, correct?
Slava -
Importing .class file into jsp file
i am unable to import a .class file into my .jsp file
please give me the correct method to import and also tell me where to deploy the .class filei am unable to import a .class file into my .jsp
file
please give me the correct method to import and also
tell me where to deploy the .class filehttp://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html#Section5 -
Import class file in default package (netbeans) into my jsp
Hello all I have created a class file in the default package under Source Files in the netbeans 5 ide.
I am having a problem importing that class file into my jsp(which resides in the Web Pages directory .
I tried the following:
<jsp:useBean id="dial" class="Test" scope="session" />
my class file is Test.java
Any help or explanation would be greatly appreciated.
TIA!Will not work. Classes have to be defined in a package, the default package just wont do.
ram. -
Error wile importing class file
hi,
i am trying to import a class file(exp) in jsp, but it gives error mesg like unable to find the class file. the code is
class file is plcaced in "C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\WEB-INF\classes"
<%@ page language="java" import="exp" %>
<html>
<body>
<%! test t = new test(); %>
Length of Sabarish is <%= t.strLength("Sabarish") %>
</body>
</html>kindly helphai,
try placing ur class in a package and provide fully qualified class name in jsp import
hope this will help
regards,
varma. -
How to import class files in Rhino shell
Hi,
i want to test some methods of ScriptEngineContext class in
Microsoft_Active-Directory-and-Windows_2011.1r3 collector, so i import
some class files in Rhino shell, but some errors apeared, detail steps
are following:
1. steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors> cd
Microsoft_Active-Directory-and-Windows_2011.1r3, it will apear some
important jar packages(red fonts)
accountImpl.js commons-codec-1.3.jar dataobject.js
event.js joda-time-2.1.jar protoEvt.map sha1.lic
trust.js
account.js commons-io-2.4.jar date.js
eventsource.js js.jar Rec2Evt.map sqlquery.js
trusttype.js
agent.nfo commons-logging-1.1.jar docs
eventsourceserver.js LegacyEvtNames.map record.js sysEvents.map
utils.js
asset.js commons-logging-adapters-1.1.jar error_codes.map
Evt2EvtData.map logon_types.map release.js
syslog_facility.map vuln.js
bsf-240.jar commons-logging-api-1.1.jar EULAs
file.js main.js session.js taxonomy.map
window-field.map
collector.js connector.js
eventcode_parsing.js identityImpl.js master.jar
severity.map tenant.js xdas_out.map
collectorutil.jar data event_codes.map
identity.js package.xml sha1.js trustImpl.js
xdas_tax.map
2.
steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors/Microsoft_Active-Directory-and-Windows_2011.1r3>
java -classpath ./js.jar org.mozilla.javascript.tools.shell.Main
Rhino 1.7 release 3 2011 05 09
js>
3. js> JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
js: "<stdin>", line 3: missing ; before statement
js: JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
js: .....................^
4. js> loadClass(JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
js: "<stdin>", line 4: missing ) after argument list
js: loadClass(JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
js: ...............................^
js>
when i run JavaPackage or loadClass shell, js: "<stdin>" error apears,
why? does anyone can help me? thanks!
BR
Steve zeng
steve_zeng
steve_zeng's Profile: https://forums.netiq.com/member.php?userid=3875
View this thread: https://forums.netiq.com/showthread.php?t=49805steve_zeng;239719 Wrote:
> Hi,
> i want to test some methods of ScriptEngineContext class in
> Microsoft_Active-Directory-and-Windows_2011.1r3 collector, so i import
> some class files in Rhino shell, but some errors apeared, detail steps
> are following:
>
> 1. steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors> cd
> Microsoft_Active-Directory-and-Windows_2011.1r3, it will apear some
> important jar packages(red fonts)
>
> accountImpl.js commons-codec-1.3.jar dataobject.js
> event.js joda-time-2.1.jar protoEvt.map sha1.lic
> trust.js
> account.js commons-io-2.4.jar date.js
> eventsource.js js.jar Rec2Evt.map sqlquery.js
> trusttype.js
> agent.nfo commons-logging-1.1.jar docs
> eventsourceserver.js LegacyEvtNames.map record.js sysEvents.map
> utils.js
> asset.js commons-logging-adapters-1.1.jar error_codes.map
> Evt2EvtData.map logon_types.map release.js
> syslog_facility.map vuln.js
> bsf-240.jar commons-logging-api-1.1.jar EULAs
> file.js main.js session.js taxonomy.map
> window-field.map
> collector.js connector.js
> eventcode_parsing.js identityImpl.js master.jar
> severity.map tenant.js xdas_out.map
> collectorutil.jar data event_codes.map
> identity.js package.xml sha1.js trustImpl.js
> xdas_tax.map
>
>
> 2.
> steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors/Microsoft_Active-Directory-and-Windows_2011.1r3>
> java -classpath ./js.jar org.mozilla.javascript.tools.shell.Main
> Rhino 1.7 release 3 2011 05 09
> js>
>
> 3. js> JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
> js: "<stdin>", line 3: missing ; before statement
> js: JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
> js: .....................^
>
> 4. js> loadClass(JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
> js: "<stdin>", line 4: missing ) after argument list
> js: loadClass(JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
> js: ...............................^
> js>
>
>
> when i run JavaPackage or loadClass shell, js: "<stdin>" error apears,
> why? does anyone can help me? thanks!
>
>
> BR
> Steve zeng
Can you explain a little more about what you're trying to accomplish by
this? The script engine is not really designed around facilitating
shell-based access right now,I'd be interested to know what you can't do
in the Debugger that you are trying to accomplish in the shell.
brandon.langley
brandon.langley's Profile: https://forums.netiq.com/member.php?userid=350
View this thread: https://forums.netiq.com/showthread.php?t=49805 -
Error while importing java class into oracle forms 10g
Hi
I have generated a web service client using jdeveloper 10g. It consists of complex type methods. I am trying to import the class files using java importer in oracle form 10g. I am able import all of them successfully except one. That one is the main method. Please see the error and suggest me how to overcome this error.
Exception occurred: java.lang.NoClassDefFoundError: oracle/jdeveloper/webservices/runtime/WrappedDocLiteralStub
Thanks in advanceDo you see oracle/jdeveloper listed in "Import Java Classes" when you try to import?
If not, make sure you add C:\DevSuiteHome_1\jdev\lib\jdev.jar to FORMS_BUILDER_CLASSPATH in registry
Also excetion indicates: oracle/jdeveloper/webservices/runtime/WrappedDocLiteralStub
If you typing it - type: oracle.jdeveloper.webservices.runtime.WrappedDocLiteralStub -
Importing WebService class into Forms10g
Hi ,
I want to import webservice from Jdeveloper in Forms10g.I am using Jdeveloper 10.1.3.4 complaint with JDK 1.4. When I import the class in Forms10g from Jdeveloper it gave me error:
Importing Class Proxy.classes.oracle.srtutorial.datamodel.proxy.SendServiceSoapClient...
Exception occurred: java.lang.UnsupportedClassVersionError: Proxy/classes/oracle/srtutorial/datamodel/proxy/SendServiceSoapClient (Unsupported major.minor version 49.0)
I figured out that this error is due to different versions of JDK used in Oracle Forms10g(JDK 1.3) and Jdeveloper 10.1.3.4(JDK 1.4). So I changed the compile properties in Jdev to 1.3.
After changing this to 1.3 when I import the class the previous error is resolved but I get another error :
Importing Class Proxy.classes.oracle.srtutorial.datamodel.proxy.SendServiceSoapClient...
Exception occurred: java.lang.NoClassDefFoundError: Proxy/classes/oracle/srtutorial/datamodel/proxy/SendServiceSoapClient (wrong name: oracle/srtutorial/datamodel/proxy/SendServiceSoapClient)
Please help how to resolve this.
Regards,
Noman
Edited by: user773433 on Aug 11, 2009 4:33 AMHi,
I have tried. The problem is when I make the JAR file in Jdeveloper and Change the class path in Windows. The Jar doesnt shows up in Formgs10g when we import the class. I have tried several times by adding the path of JAR file in windows environment but still it doesnt shows up..
Regards,
Edited by: user773433 on Aug 12, 2009 10:54 AM -
Importing Java Classes for Bussiness Logic in Forms6i
I have created a Java Class with some bussiness logic in it and i m able to impotr it in Forms 6i BUT when it converts my java method into program unit it automatically changes the name of the method with some code ..like method name is "increment" it will make it as "increment_3137" and also one parameter of Ora_java.object type will be added ....WHY is THAT ???and how to work for hat ...even when i m executing the method with the parameter it gives some Exception that Non-Oracle Exception ...and my class individually runs perfectly fine ...CAN U HELP ME ASAP ...Please as its urgent
Thanx..Once you have imported java class files on forms throgh java import class option..
it creates a pl/sql for the java class that you have imported.
names for the procedures are assigned by machine code, so dont worry about it..
for eg. if the name of a method in java class is Increment and after loading java class file the name of ur pl/sql is increment_1254.
when u call increment_1254 and pass parameter to the procedure ur class incerement will be called and desired operation will be performed.
ora_java.object is the objec that will be used to access the the class file.
as java is object oriented it requires a object to execute method of class.
so u have to initialize the object..
e.g. increment_1234 (ora_java.object,a,b) is ur procedure
to call this procedure do the following
declare
PASS ORA_JAVA.JOBJECT;
a,b integer;
begin
pass := <classname>.new; --new will be created if ur class is public or u got public constructor in ur class.
increment_1234 (pass,a,b) ; -- increment_1234 (ora_java.object,a,b) ;
end; -
Importing Java class problem!
Hello
I have problem by Importing java class into form. When I select in Forms Builder from menu: Programs/Import Java Classes it returns error: PDE-UJI001 JVM not able to create!
Can someone know what I must do to fix that problem?
Thanks, ChrityIt is a shame because it, probably, contains no special 1.5 new instruction at all.
Maybe it would be possible to try replacing the current JDK/JRE of your <ORACLE_HOME>/jdk installation after a safe backup of course.
You probably have a very little chance that it works, and it also won't be supported.
Francois
Maybe you are looking for
-
Help needed with delay timer in my program
In my program i want to delay the program for a certain time and then carry on. Below is what i have done. long instant; for(int i=0;i<length;i++){ instant=testarray; On(); startTime = System.currentTimeMillis(); do{ endTime = System.currentTimeMilli
-
Hi, I want to embedded a ComboBox in a Datagrid. The data displays in the Combox with the code in the ComboBoxCellRenderer.as: public function set data(value:Object):void { _data = value; var dp:DataProvider = new DataProvider(value.plaats); dataProv
-
Why nokia is not implementing VOIP in Nseries..?
hi, i think nseries is a very good option for all mob lovers and users. but stil nokia is doing the old and tricky marketing. they anounced only a few phones with camera wit above 3 mp. and they did nt release any Nseries wit VOIP. Whats your opinion
-
I have a 2010 2.8GHz Quad core all stock no upgrades. It is currently connected to a VGA monitor with a dual link DVI to VGA adaptor through a KVM switch and all works great. I am trying to connect a Vizio TV via mini displayport to HDMI then cat6 HD
-
Hi, My Mac was stolen and I just bought a replacement MacBook Pro. When I enter the Aperture license number it says that the trial has expired (I did however buy the full version a year ago, following a trial run). I have followed one of the support