How to import a java class in a JSP

Hi All,
I have a java class file called myTest.class (i made after compilation of myTest.java). I have a JSP page that uses this java class file.
These 2 files are in same folder called c:/test
and iam importing this java class file into my jsp file and that too at the start of this jsp file:
<%@page import="myTest" %>
BUt iam getting an error ..............when iam running this JSP page:
/opt/bea81sp2/user_projects/domains/wliDomain/./Managed2/.wlnotdelete/extract/Managed2_myTest_myTest/jsp_servlet/__test.java:20: '.' expected
probably occurred due to an error in /test.jsp line 5:
<%@page import="myTest" %>
Please advise how to solve this problem
-sangita

Don't bother with the import
when iam not importing this class file into my JSP, then on my JSP, the class file is not found.
Here is my code: and these 2 class file are in c:/test
import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.taskdefs.Property;
import org.apache.tools.ant.types.*;
import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.ExecTask;
import org.apache.tools.ant.types.Commandline;
import java.io.File;
* Creates an Ant project to run an Ant build
* @author myself
* @version 1.0
public class RunTest extends Ant {
    String applicationName;
    String buttonClicked;
    String boxName;
    String targetName;
    public void applicationName(String applicationName){
     this.applicationName = applicationName;
    public void boxName(String boxName){
     this.boxName = boxName;
    public void buttonClicked(String buttonClicked){
     this.buttonClicked = buttonClicked;
  public RunTest() {
public void goTest() {
     if(this.buttonClicked.equalsIgnoreCase("deploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
       this.targetName = "deploy-scsmail-testnet";
     if(this.buttonClicked.equalsIgnoreCase("undeploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
       this.targetName = "undeploy-scsmail-testnet";
    Project project = new Project();
    project.init();
    System.out.println("printing 1 ....");
    ExecTask exec = new ExecTask();
    exec.setProject(project);
    exec.setExecutable("/opt/bea/weblogic81/server/bin/ant.bat");
     exec.setDir(new java.io.File("/export/home/beamon/bin"));
     Commandline.Argument arg = exec.createArg();
     // arg.setLine("-f scsmail.xml test -listener org.apache.tools.ant.XmlLogger -logfile D:/antProject/src/log.xml");
     arg.setLine("-f build.xml "+ targetName + " -listener org.apache.tools.ant.XmlLogger -logfile /export/home/beamon/bin/log.xml");
     System.out.println("printing 2....");
    //exec.setOutput(new File("D:/antProject/logs/prob.txt"));
    exec.execute();
    System.out.println("printing 3....");
-----------------------the JSP page is called as test.jsp
<%@page contentType="text/html" %>
<%@page import="java.io.*" %>
<%@page import="java.util.*" %>
<%@page import="java.net.*" %>
<%@page import="RunTest" %>
<HTML>
<TITLE>TESTING ANT GUI</TITLE>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="3000" >
<meta http-equiv="Cache-Control" content="no-cache">
</HEAD>
<BODY BGCOLOR="silver" TEXT="333333">
<table border=0>
<tr align="left"><td align="left"><FONT SIZE="-1"><B>  Test Page <FONT SIZE="-1"><B></td></tr>
</table>
<hr></center>
<form action="./test.jsp" method="POST" name="testForm">
<table>
<tr>
<td>
<select name="appName" size=1>
<option value="">Select Application Name
<option value="scsmail">scsMail
<option value="clientmanager">ClientManager
</select>
</td>
<td>
<select name="boxName" size=1>
<option value="">Select Box Name
<option value="testnet">TestNet
<option value="production">Production
</select>
</td>
</table>
<table>
<input type="submit" name="deploy" value="deploy">
<input type="submit" name="undeploy" value="undeploy">
</table>
<%
   RunTest rt = new RunTest();
   rt.applicationName(request.getParameter("appName"));
    String deployButton = "";
    deployButton=request.getParameter("deploy");
    String undeployButton = "";
    undeployButton=request.getParameter("undeploy");
    if(!deployButton.equalsIgnoreCase("")){
        rt.buttonClicked(request.getParameter("deployButton"));
    if(!undeployButton.equalsIgnoreCase("")){
        rt.buttonClicked(request.getParameter("undeployButton"));
   rt.boxName(request.getParameter("boxName"));
    rt.goTest();
%>
</form>
</table>
</BODY>
</HTML>

Similar Messages

  • Unable to import a java class in a jsp file

    Hi,
    I am trying to import a java class in my jsp.
    ------------------jsp---------------
    <jsp:useBean id="form" class="com.company.portlets.searchApps.object.SearchOBJ" scope="request" />
    <jsp:setProperty name="form" property="*" />
    <input type="TEXT" name="projectID" value='<%= form.getProjectID() %>'>
    When I run the above JSP, it says that class 'com.company.portlets.searchApps.object.SearchOBJ' cannot be found.
    Why?
    My project structure looks like this:
    Project
    +Application Sources
    ++com.company.portlets.searchApps.object
    +++SearchOBJ.java
    +Web Content
    ++htdocs
    +++searchappsportlet
    ++++SearchAppsPortletShowPage.jsp
    ++WEB-INF
    +++index.jsp
    +Resources
    ++SearchApps.deploy
    Please advice...thanks!

    The way that JDeveloper organized the files was like this:
    C:\jdev1012\jdev\mywork\WksSearchApps\Project\classes\com\company\portlets\searchAPPS\object\SearchOBJ.class
    I am assuming that JDeveloper puts the file where they are suppose to be...if not, how do I change that?
    thanks,
    hussain

  • How to import a java class

    Hi
    I want to know how can i import some java classes to my application.
    I'm trying to write a little class as:
    package paco.view;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    public class ClobConverter implements Converter {
    public ClobConverter() {
    public Object getAsObject(FacesContext context,
    UIComponent component,
    String value) {
    if (context == null || component == null) {
    throw new NullPointerException("FacesContext and UIComponent can not be null");
    if (value == null) {
    return null;
    try {
    return new ClobDomain(value);
    } catch (Exception ex) {
    final String message =
    String.format("Unable to convert boolean value \"%s\" into a oracle.jbo.domain.Number",
    value);
    throw new ConverterException(message, ex);
    public String getAsString(FacesContext context,
    UIComponent component,
    Object value) {
    if (context == null || component == null) {
    throw new NullPointerException("FacesContext and UIComponent can not be null");
    return value.toString();
    but I'got this message:
    Error(3,8): class javax.faces.component.UIComponent not found
    Error(4,8): class javax.faces.context.FacesContext not found
    Error(5,8): class javax.faces.convert.Converter not found
    Error(6,8): class javax.faces.convert.ConverterException not found
    What should I do?
    Thanks in advance
    FRANCISCO

    You need to add the faces library to you project. To do this, select the project properties, go to libraries and class path and select the faces library.
    Using JDev you can also choose one or more project technologies (project properties->technology scope) which will add the needed libraries to the project.
    Timo

  • ADF : How to import a java class in jspx page

    Hi All,
    In jsp we have page directive to import a java class. Do we have anything similar to that in a jspx page?

    Hello,
    If you create a new jspx file in jdeveloper, the untitled file generated will be this:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=UTF-8" import="java.util.*"/>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>untitled1</title>
    </head>
    <body></body>
    </html>
    </jsp:root>
    You can see the page directive there!

  • How can i call java class file in jsp page

    Hai,
    i wants to call .class file in jsp page.
    my class file is in C:\jsdk\bin.
    Thanks

    I'm not entirely sure what you mean by "calling a class file", but I'm going to assume that you want to do something like the following in your page:
    <%
    MyClass myClass = new MyClass();
    myClass.someMethod();
    %>etc
    If that's the case, then all you have to do is make sure that the class is in the servlet engine's classpath. You'll probably also need to include an appropriate import statement at the top of the page.
    Hope that helps.

  • How to import a Java class using Rule Author ?

    I want to recreate the following ruleset using the Oracle Rule author
    RL> ruleset parse {
    import java.lang.Integer;
    rule A {
    String total = "12";
    int t = Integer.parseInt(total);
    if (t == 12) {
    println("Total=" + t);
    Does anyone know how to create the RL line "import java.lang.Integer;" using Rule Author ?

    The line "import java.lang.Integer" isn't necessary if you fully qualify the reference to Integer.

  • How to include a java-class in a JSP.

    I have the following code in a jsp:
    <jsp:include page = "http://test1.testing.com:81/TestClass" />
    I throws the following error:
    Servlet failed with Exception
    java.io.IOException: Nested 404 error
    If I copy paste the url (http://test1.testing.com:81/TestClass) directly on the browser address, it successfully runs the class.

    Copy the servlet class file in the servletclasses folder in the weblogic server then give the code like this
    <jsp:include page="servlet/servletclassfiles" flush="true" />
    this will include the class file to your jsp page
    what ever server better put the servlet class file in the servlet class invoking area

  • How to use a java class in difference project under a same workspace!

    Hi, there:
    I have a problem. I want to reuse a java class which is located in another project of the same workspace. I do not know how to set the two project setting or how to import the java class. I deeply appreciate.
    Sheng-He

    include it as a library
    open project settings goto libraries and simply add your class

  • How to import custom java jar/class into oracle to be used in java proc ?

    Hi
    I would like to know how to import custom java jar/class files into oracle to be used in java stored procedure.
    I am developing a oracle pl/sql procedure to call java program. The java program will be created as procedure and will be published.
    But, my question is that I do have a other external jar/class file that need to be imported into this java program.
    example
    raise_sal.java
    import java.util.*;
    import oracle.sql.*;
    <<reference other java programs >>
    import cmpmsgsvc.xxxx.* ;
    import cmpmsgsvc.yyyy.* ;
    import cmpmsgsvc.zzzz.* ;
    how do I import the cmpmsgsvc jar/class file into oracle so that I don't have any
    compilation errros on raise_sal.java program ??
    what are the steps to import/compile and validate to do this?
    thanks for your help in advance.
    Thanks
    rrb.

    Kuassi
    Problem is that, I have 6 jar files that are needed to be included in the main java program. And, there are more than 50+ classes, propertiers in those 6 jar files.
    It might be not good idea to have all those 50+ classes in the production database.
    Is there anyway that I keep all those 6 jar files in unix box (our's is oracle erp installation with oracle being installed on unix box) and just refer them in the main java program. I mean database will be loaded with main java program and it should able to refer other 6 jar files from unix.
    if we create a directory and keep all jar files in there and include that directory in classpath variable, does this works? or what is other method?
    Please let me know.
    Thanks

  • How to import user defined class in UIX page?

    Does anyone know how to import user defined class in UIX page so that the class can be called in the javascript in the UIX ?
    Thks & Rgds,
    Benny

    what you are referring to is not javascript.
    it is JSP scriptlets. These are very different.
    In order to keep a strict separation between View and Controller, it is not possible to run arbitrary java code from within your UIX code.
    However, you can run java code from within a UIX event handler; see:
    http://otn.oracle.com/jdeveloper/help/topic?inOHW=true&linkHelp=false&file=jar%3Afile%3A/u01/app/oracle/product/IAS904/j2ee/OC4J_ohw/applications/jdeveloper904/jdeveloper/helpsets/jdeveloper/uixhelp.jar!/uixdevguide/introducingbaja.html
    event handler code is run before the page is rendered.

  • How to implement a java class

    dear friends
    i use forms6i server and oracle 9i server edition,under windows 2000 server
    i try to implement a java class for a bean area. i do the following :
    from the property palette i write the class name in implementaion class property . the class name is 'arc.class' and it is located in <oracle_home>/forms60/java
    but the fellowing error appears
    frm-13008 cannot find javabean with name 'arc.class'
    would any one help please

    Dear Grant Ronald
    thank you very much for helping me . now i undersatand how to implement a class. but i have another question ,and i wish you ccould help me .
    i try to import a java class, i do the following:
    From the program menue i choose Import Java Class
    but the following error appears
    (pde-uji001 faild to create JVM)
    by the way i use forms6i server and oracle 9i server under windows 2000 server
    thanks in advance
    tarek

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • How to call a Java class from another java class ??

    Hi ..... can somebody plz tell me
    How to call a Java Class from another Java Class assuming both in the same Package??
    I want to call the entire Java Class  (not any specific method only........I want all the functionalities of that class)
    Please provide me some slotuions!!
    Waiting for some fast replies!!
    Regards
    Smita Mohanty

    Hi Smita,
    you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
    e.g.
    you have developed A.java and B.java, both are in same package.
    in implementaion of B.java
    class B
                A obj = new A();
                 //to access A's methods
                 A.method();
                // to access A's variable
                //either
               A.variable= value.
               //or
               A.setvariable() or A.getvariable()

  • To Unable to Import Customize Java classes in Report Builder 10g

    Hi,
    In Report Builder 10g , I am trying to load image from Remote server
    URL:"http://imagecache5.art.com/p/LRG/15/1544/1ABDD00Z/muhammad-ali-vs-sonny-liston.jpg"
    Steps did in Report Builder 10g
    1.In Report Builder Created a Formula column with
    Datatype : Character
    Read from File: Yes
    File Format: Image
    In Formula columns trying to Unable to Import Customize Java classes.
    To read methods from Java classes.
    Please help on this.
    Ranga

    Hello,
    To import the Java classes:
    Add your jar in the REPORTS_CLASSPATH
    Launch Reports Builder.
    Note:
    You must launch Reports Builder now so that the new REPORTS_CLASSPATH is used.
    Choose Program > Import Java Classes to display the Import Java Classes dialog box.
    Regards

  • How to Generate a Java file for a JSP Page

    Hi ,
    I am using weblogic11 .
    I am working on a JSP page which nearly consists of 4000 lines of code.
    I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
    Please let me know how can i genertae Java file for the jsp pages ??

    JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.

Maybe you are looking for

  • 7.0.3 battery and startup problems on ipad

    Since I did the 7.0.3 update, two problems have arisen on my ipad 4. The first is that my battery drains fast when not in use.  It used to be that if my ipad were left alone, unplugged and on but not in use, the battery barely drained.  But now it dr

  • Catch problem for JSPs, can't i use Oracle9iAS for our  Application ?

    Hi, I have deployed .ear file by using OC4J. I am facing catch problem, in defferent situations. 1. We used pager tag library for search nagivation, it is not working proper. 2. 'Creation of new object(in my case enterprise,certificate,role etc.)' is

  • IDSM-2 inline between multible VLAN

    Hi, I have a coreswitch 6509 which is include IDSM-2 actully the core switch handle the traffice between the usres VLANs and the server Vlan (vlan 11) The users Vlan are (Vlan 2 , 3, 4, 5, 6 and 7). I need to configure the core switch and IDSM to be

  • Upload to Server/DB, Read, Write and Call a standard map application

    What resource can show me the best way to do the above in flash builder?

  • Need help for the query columns to rows

    Hi everyone, I have two tables TABLE1 and TABLE2; TABLE1 is Master table,TABLE2 is child table. The key for TABLE1 is C1 column The key for TABLE2 is C1,C_MONTH Columns The sample data is as follows TABLE1 ====== C1 C2 1 A 2 B 3 C 4 D TABLE2 ====== C