Packages inside packages

I am trying to learn servlets. I am trying to get this simple servlets to work with a little encryption package I wrote. The Encryption file is inside the history folder.
Here is the servlet:
package history;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import Encryption.*;
public class SignUp extends HttpServlet {
     public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         String title = "Reading Three Request Parameters";
              String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n";
         String name, pass1, pass2, encrypted;
         Encrypt encrypt = new Encrypt(); [red]//error is here[/red}
         name = request.getParameter("param1");
         pass1 = request.getParameter("param2");
         pass2 = request.getParameter("param3");
         if(!pass1.equals(pass2))
          out.println(docType + "<HTML>\n" +
                "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
                "<UL>\n" + "ERROR" + "</UL>\n" +
                "</BODY></HTML>");
         else
              encrypted = encrypt.encode(name, pass1);
              out.println(docType +
                "<HTML>\n" +
                "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +
                "<UL>\n" +
                "  <LI><B>param1</B>: "
                + request.getParameter("param1") + "\n" +
                "  <LI><B>param2</B>: "
                + request.getParameter("param2") + "\n" +
                "  <LI><B>param3</B>: "
                + request.getParameter("param3") + "\n" +
                + encrypted + "\n" +
                "</UL>\n" +
                "</BODY></HTML>");
}This is the error:
history/SignUp.java:6: package Encryption does not exist
import Encryption.*;
^
history/SignUp.java:26: cannot resolve symbol
symbol : class Encrypt
location: class history.SignUp
Encrypt encrypt = new Encrypt();
^
history/SignUp.java:26: cannot resolve symbol
symbol : class Encrypt
location: class history.SignUp
Encrypt encrypt = new Encrypt();
^
3 errors
I tried this:
import history.Ecryption.*;
But got a different error:
history/SignUp.java:26: cannot access history.Encryption.Encrypt
bad class file: .\history\Encryption\Encrypt.class
class file contains wrong class: Encryption.Encrypt
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
Encrypt encrypt = new Encrypt();
^
1 error
Any advice will be greatly appreciated.

My guess is that in the Encrypt class, you probably have this:
package Encryption;
If it's to be under "history", then it should be:
package history.Encryption;
There's no such thing as sub packages, or packages inside packages. The directories the files are stored in are within that directory structure cuz that's how directories are, but packages are not parent/subpackage relationships. "history" and "history.Encryption" would be totally separate packages. This is why you can't do "import history.*" and get all the classes in "history.Encryption" as wel.
Then your import in your servlet would be:
import history.Encryption.*;

Similar Messages

  • Can we call a package inside a package

    Dear Sir
    Can we create a package inside a package or can we call a a package inside a package?.If yes.How we can create and call a package inside a package?
    Regards
    Thakur Manoj

    [email protected] wrote:
    Dear Sir
    Can we create a package inside a package NO, you cant do that.
    or can we call a a package inside a package?.YES, you can do that. Just call it. <package_name>.<procedure_or_function_name>

  • How to disable spotlight searches inside packages

    Hi,
    I tagged all my files inside my document folder, now I'd like to create and save a smart folder searching for all the untagged files, just in case I create or move a file to that folder without tagging it first.
    The problem is that I have several files, which are packages with other files in them (created with Scrivener, Devonthink, OmniOutliner...). These other files aren't tagged (and I don't need nor want to tag them) so they are showed in my spotlight search.
    I can't exclude the folders containing these files in spotlight preference, since there are a lot of them and I often create new files of these kinds.
    I would like to tell spotlight not to search inside packages. Is that possible?
    thanks in advance,
    pietro

    You can't remove it so as it is fixed in the OS of the phone.

  • Getting the metadata of procedures defined inside packages...

    Dear All,
    i want to extract the metadata for procedures and functions in my db.
    i am using the DBMS_METADATA.GET_DDL(ObjectType,ObjectName) to get the metadata of certain objects (PROCEDURES,FUNCTIONS and PACKAGE_BODY)
    however this method is not quiet usefull when my target is to get the metadata for a single procedure/function defined inside package's body', where i dont need
    the whole package body to be returned only the specific Procedure/ Function defined in it...
    it seems that the Package Body is defined as one object regardless of how many Procedures / Functions are defined in it...
    isnt there any place/repository that stores the procedures and functions defined inside a package body along with their metadata explicitly one bye one , so i can
    extract them and search them one bye one...
    Thank you
    Basem Sayej...

    The whole point about defining procedures inside package bodies is that they are private. They are only exposed to those who have the necessary privileges to view the body's source code.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • How to import ADF JS packages inside another javascript

    Hi,
    I need to import the ADF Faces javascript packages inside another javascript,
    to be able, inside this javascript, to access the page components.
    How can I do this ?

    You can't embed one jspx inside other, you need to use jsf page fragments for this.
    Approach 1:
    - Create a page fragment for the second page(second.jsff)
    - Include this in first.jspx page using jsp:inpclude tag as in sample below:
    <!-- first.jspx -->
        <af:document id="d1">
          <af:form id="f1">
            <af:outputText value="First Page"/>
            <af:commandLink text="Include Second" id="includeLink" partialSubmit="true">
              <af:setActionListener from="true" to="#{requestScope.includeSecond}"/>
            </af:commandLink>     
            <af:panelGroupLayout visible="#{requestScope.includeSecond eq true}"
                                 partialTriggers="includeLink">
              <jsp:include page="/second.jsff"/>
            </af:panelGroupLayout>  
          </af:form>
        </af:document>Approach 2:
    - Create a bounded taskflow with page fragments and drop a view and generate second.jsff for this view
    - Drop this taskflow as region inside first.jspx and set the visible property as given above in sample code to show only on clicking commandImageLink
    Sireesha

  • Variable declaration in Package and package body

    Hi
    Kindly reply the difference in declaring a cursor inside a package vs package body
    eg:
    create or replace package shapak is
    cursor shacur is select * from sha;
    function shafun return number;
    end;
    i can declare the above cursor inside the package body withoout declaring in package specification. but what is the difference?
    reply appreciated
    thanks
    shajan

    In general..Items declared in the package spec are visible outside the package..so you can say public.where as items declared in the body are restricted to use within the package..such items are called private.

  • Ext.Set, Enh.Package, Sup.Package, Add-on terminology clarification

    Hello All.
    I need some ideas and examples to understand the differencies between the next objects and their relations.
    - Extension Set
    - Enhancement Package
    - Support Package
    And also their relation inside an add-on.
    Best regards.

    Thanks a lot for you answer Kossmann,
    But I still don't have a clear idea.
    You say that an Extension Set is some new functinality related to the base functionality that can be customized trough SPRO.
    You also mention that an Enhancement Package is an add-on for some modules and that they contain new functionality not contained inside standard base, so not accesible in the standard customizing.
    In both cases you say that is new functionality, but while an extension set requires additional licensing, doesn't require this for an enhancement package.
    Can I understand that an Enhancement package is the evolution of an extension set for netweaver environment ?
    About patching, I understand that is using support packages where we can path all the functionality, even if this come from an Extension Set, Enhancement package or none of them, but I'll like to understand if there is any relation between levels off all three elements...
    That is if we applie for example SP 1-20 thats equivalent to be in the extension set X...?
    Another question is how is an extension set licensed ?
    Best regards

  • Packages and packages

    Hi
    I was rereading Martin's principles of package architecture and was wondering how the concept of package in this context relates to the concept of a Java package
    after thinking a bit, I got the feeling these two concepts have nothing to do with each other
    I feel that Java packages deal with namespace and access control, while OO packages (the components of your program's binaries) would be, in the Java world, jar files containing classes from different packages (and not especially all classes from these (Java) packages), and constructed as much as possible in order to follow these supposedly good OO principles
    Am I right ? partially ? totally ? totally not ? I need some insight on this

    Kind of. But what would stop me to define the
    namespace on a per-component base? I used structures
    like com.mycompany.myapp.database (data tier),
    com.mycompany.myapp.web (presentation tier) and the
    likes. You could put classes (or packages) belonging
    to a certain subsystem into a package dedicated to it.I did it for a long time too, traditionaly with webapps :
    be.mycompany.myapp
    dataaccess
    business
    web
    and that worked fine... but that's not my concern
    actually, what concerns me is the business package itself... I'm writing a very simple peer2peer file sharing tool for both fun & education, and the packaging becomes trickier, since the app is naturally distributed :
    * file sharing client package
    * user manager client package
    * server package (handles login requests & user management requests)
    thing is, I reuse many classes among these three "kinds of endpoint", which makes me think about properly dividing my app into small reusable, well-organised components... when java packages come into play, things are getting less clear as of how I should do...
    how do you people do when it comes to structuring (packages AND deliverables of) your business layer ?

  • ORA-04042: procedure, function, package, or package body does not exist

    getting following error
    I have logged on as sys
    GRANT EXECUTE ON CTXSYS.CTX_DDL TO public
    ERROR at line 1:
    ORA-04042: procedure, function, package, or package body does not exist
    does it need Oracle text installed
    comp_name
    Oracle Database Catalog Views
    Oracle Database Packages and Types
    Oracle Workspace Manager
    JServer JAVA Virtual Machine
    Oracle XDK
    Oracle Database Java Packages
    Oracle Expression Filter
    Oracle XML Database
    Oracle Rules Manager
    Oracle Multimedia
    Oracle Real Application Clusters

    912919 wrote:
    getting following error
    I have logged on as sys
    GRANT EXECUTE ON CTXSYS.CTX_DDL TO public
    ERROR at line 1:
    ORA-04042: procedure, function, package, or package body does not exist
    does it need Oracle text installed
    comp_name
    Oracle Database Catalog Views
    Oracle Database Packages and Types
    Oracle Workspace Manager
    JServer JAVA Virtual Machine
    Oracle XDK
    Oracle Database Java Packages
    Oracle Expression Filter
    Oracle XML Database
    Oracle Rules Manager
    Oracle Multimedia
    Oracle Real Application Clustersit worked for me.
    09:10:19 SQL> GRANT EXECUTE ON CTXSYS.CTX_DDL TO public;
    Grant succeeded.
    09:10:23 SQL>

  • In a update rule, run two data packages ; package by package not secuencial

    HI, my data source is an ods i want to fill other ods.
    If i have two data packages, with 7000 and 5000 registers
    i want to run the two datapackages in a secuencial way not parallel.
    But the init delta doesn´t give me the option of run package by package.
    The options show me is initialization with transfer data (parallel) i want package by package.
    How i can do that??
    Reward points

    a

  • How to prevent downgrading of the app in meta package using package versioning feature of package maker tool?

    Hi,
    Created  an installer i.e, meta package using package maker tool. I want  to prevent downgrading of the application or package on the target/installed volume. 
    Problem is, if there is a newer version of app and when I try to install any older version, then it does not throw any error message to the end user and replaces the existing newer version with the older version of app, which should not happen. But, if I check the package version using version comparison of Package  maker tool, that works fine with flat packages i.e, with the .pkg files. So, I need the solution for metapackages(.mpkg) and want to prevent downgrading of app for metapackages. I am not getting any solutions for this. Can someone guide me on this?
    Thanks for the help provided.
     

    Hi,
    Created  an installer i.e, meta package using package maker tool. I want  to prevent downgrading of the application or package on the target/installed volume. 
    Problem is, if there is a newer version of app and when I try to install any older version, then it does not throw any error message to the end user and replaces the existing newer version with the older version of app, which should not happen. But, if I check the package version using version comparison of Package  maker tool, that works fine with flat packages i.e, with the .pkg files. So, I need the solution for metapackages(.mpkg) and want to prevent downgrading of app for metapackages. I am not getting any solutions for this. Can someone guide me on this?
    Thanks for the help provided.
     

  • Including packages in package hierarchy

    Hi,
    What is the purpose of including packages in package hierarchy?
    How can I define use access for them? what is the use?
    Please help me out in this.
    Thanks and regards,
    Lakshmi Reghuvaran

    Hello Lakshmi
    The <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/fd/f39de8ae6f11d596c000a0c94260a5/content.htm">SAP Online Help</a> says the following to this topic:
    <b>Goals of the Package Concept</b>
    When SAP created the package architecture in R/3 Enterprise, its goals were:
    To improve the structure of the software
    To encapsulate software functions more strictly
    To make well-defined interfaces available to all applications
    To clarify responsibilities
    The very same goals can be applied to your own packages, either if you are a professional software supplier for SAP or a customer.
    Regards
      Uwe

  • Package in package?

    Hi,
    is there any workaround to implement this?:
    CREATE OR REPLACE PACKAGE main_package AS
    PACKAGE package_a;
    PACKAGE package_b;
    PACKAGE package_c;
    END main_package;
    Thanks

    I cannot understand your requirement.
    But...
    Is this?
    <br>
    create or replace
    packeg aaa
    is
    procedure main; /* Public procedure */
    end;
    create or replace
    package body aaa
    is
    procedure aaa1 /* Private procedure */
    is
    begin
      null; -- any real procedual routine
      /* cannot refer aaa2 */
    end;
    procedure aaa2 /* Private procedure */
    is
    begin
      null; -- any real procedual routine
      /* can refer aaa1 */
    end;
    procedure main
    is
    begin
      aaa1;
      aaa2;
    end;
    -- initial package
    begin
      null;
    end;
    <br>
    <br>
    Or this
    create or replace
    procedure main
    is
    -- declare type,cursor,variable for main at here
      procedure sub1
      is
      begin
         null;
      end;
      procedure sub2
      is
      begin
         null;
      end;
    begin -- this is main
      sub1;
      sub2;
    end;
    /

  • Init delta package by package

    Is it posible a init delta running package by package( from ods to ods update rule) like in the datasource (Load in ods package by package)
    Thanks

    Hi,
    I'm not sure if I understand your question correctly.  You want to do the delta init with several InfoPackages with non-overlapping selections, correct?
    You cannot do this directly with ODS objects as DataSource, but you can do full loads and after these full loads you do a delta init without data transfer.
    You have to ensure that you load all data with your full loads and that no ODS activation is going on until the whole process has finished.
    Regards,
    Ralf

  • How will i configure packaging & returnable packaging

    how will i configure packaging & returnable packaging.........

    Hi,
    [Packaging Master Data|http://help.sap.com/erp2005_ehp_03/helpdata/EN/2b/274d3cd4250f3ae10000000a11402f/frameset.htm]
    [Returnable Packaging|http://help.sap.com/saphelp_47x200/helpdata/en/dd/560051545a11d1a7020000e829fd11/content.htm]
    Assign Points if helpful.
    Thanks and Regards,
    Naveen Dasari.

Maybe you are looking for

  • Entourage - I can no longer access my email.

    I get an error message that tells me my username or password is incorrect.  The only way I can get my email is via Google (gmail email address that I have heretofore accessed via Entourage).  I have shut down my compuetr and restarted, shut down Ento

  • How to manage a node with cardinality 0..n

    hi, i implemented a application with webdynpro which uses a sap babi. everything wents fine, except that i don't know which container i have to use for a cardinality 0..n. one node has this and so the attributes can entered as often as possible. but

  • SMS service setup

    Does anyone know how to set up SMS service from the JMS server? I am working on an application which require a SMS alerts. Thanks

  • Call webservice from ccb

    Hi i want to call a web service of another system from cc&b, how can i do this. thank you

  • Conform in unit of work broken when not enabling Read Subclasses On Query

    Any business application must use conform in unit of work to have expected ACID properties or modifications done during a unit of work are not visible when executing queries. So our application is always using conform in unit of work. We are using To