Use of Includes in classes

Hi,
I am wondering if it is possible to use existing Includes (e.g. constants) in global classes as well. I don't want to create the same constants again and have double maintenance.
Is there any trick to point e.g. new class-constants to the existing ones?  
Thanks,
Ralf

Hi Rich,
thanks for your answer.
wow, this seems to be a little more complex. I get an compiler error when adding the include directly into the Local Type Definition. So I created a local class like in your example and added the include there in the public section.
Now I can access the constants like LCL_CON=>CON_XXX in my global class. So at least I can use the constants there.
I also tried to have class constants which will have the value LCL_CON=>CON_XXX. This works, but with the restrictions that I only can have the visibility "Private" for my class constants... so no access e.g. from a Web Dynpro Component.
A web dynpro colleague told me that you will get a checkman error (Prio 1 or 2) so I finally cannot use it
The clean solution is to create a new interface with the constants and change the include so that the constants in the include points to the values of the interface.
Still, thanks a lot for your help !
Regards,
Ralf

Similar Messages

  • How to include a .class file in a jsp page

    hi everyone,
    i know the syntax as:
    <%@ include file = "filename.class" %>
    then at run time the server could not find the class file
    if i use,
    <%@ page import = "FileName.class" %>
    then also the same problem persists
    & if i use
    <jsp:include page = "Relative address"/>
    the problem still remains as it is...
    please help me out...i am working on developing an EJB application in which client interacts with server's Stateful session bean through a jsp page...it is necessary for me to include the home interface class file in my jsp page.
    P.S. do not suggest me to include the class file in a package & then use
    <%@ page import = "packageName.ClassFileName" %>
    i
    Edited by: Ankit_JIITU on 6 Jul, 2008 1:55 AM

    Ankit_JIITU wrote:
    i have already included the remote interface class file by <%@ page import = "University.RemoteInterfaceName" %>in my jsp page ...
    if i try to make a new package called test & then include my home interface in that package...i need to import University.*to generate the class file of my home interface ; but the class file generation is not taking place as i am getting the error..
    "package University does not exist".How can i overcome this problem. The package University, which you are trying to import, must be in the classpath. If you removed it then you will have to add it back.
    i have tried my best..but tell me if there's any possible way of including a class file in the jsp page without involving a package.No, there isn't.
    If not,then pls help me to generate the class file of my home interface within a package called test.Read the New To Java Tutorial and understand how packages work.
    >
    i am assuming that u have a deep knowledge of developing EJB applications.

  • Problem using jsp:include from inside a custom tag

    Hi, All !
              I have a problem using <jsp:include> from inside a custom tag. Exception is:
              "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              could not do this. Is it a bug, since in the 1.1 spec is said: "The
              BodyContent is a subclass of JspWriter that can be used to process body
              evaluations so they can retrieved later on."
              My code is:
              <wfmklist:items>
              <jsp:include page="item.jsp" flush="true"/>
              </wfmklist:items>
              

    This is an area of contention with WL. It is not so tolerant with regards to
              the spec. I spent several days recently trying to convince it to accept the
              specification in regards to bodies and includes and it appears to have
              successfully rebuffed my efforts.
              Frankly, this is very disappointing. It appears that some shortcuts were
              taken on the way to JSP 1.1 support, and the result is a very hard-coded,
              inflexible implementation. As I have not seen the implementation myself, I
              hate to assume this, however one could posit that the term "interface" was a
              foreign concept during the implementation, other than as some annoying
              intermediary reference requiring an immediate cast to a specific Weblogic
              class, which in turn is apparently required to be final or have many final
              methods, as if being optimized for a JDK 1.02 JIT.
              I am sorry that I don't have any positive suggestions other than to use a
              URL object to come back in an execute the necessary "include" directly. You
              lose all context (other than session) and that can cause its own problems.
              However, you can generally get the URL approach to work, and you will
              hopefully avoid further frustration.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              Tangosol: How Weblogic applications are customized
              "Denis" <[email protected]> wrote in message
              news:[email protected]...
              > Hi, All !
              > I have a problem using <jsp:include> from inside a custom tag. Exception
              is:
              > "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              >
              > Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              > could not do this. Is it a bug, since in the 1.1 spec is said: "The
              > BodyContent is a subclass of JspWriter that can be used to process body
              > evaluations so they can retrieved later on."
              >
              > My code is:
              > ...
              > <wfmklist:items>
              > <jsp:include page="item.jsp" flush="true"/>
              > </wfmklist:items>
              > ...
              

  • Using jsp:include in iPlanet6SP2

    I'm trying to include a common jsp file, say [proj_common]/common.jsp, from
    another jsp file, say [proj_parent]/parent.jsp, using <jsp:include>. After
    deployment both files sit under their respective folders (for example in
    c:\iplanet\ias6\ias\APPS\modules) as [proj_common]/common.jsp and
    [proj_parent]/parent.jsp. I've included a relative path from [proj_parent]
    to [proj_common], and here's the code I've added in
    [proj_parent]/parent.jsp:
    <jsp:include page="../[proj_common]/common.jsp">
    <jsp:param name="p1" value="v1"/>
    </jsp:include>
    I'm using only static HTML in common.jsp as a test. The following error then
    occured when I view [proj_parent]/parent.jsp :
    500 SC_INTERNAL_SERVER_ERROR
    Error: 500 SC_INTERNAL_SERVER_ERROR
    javac error:
    c:\iplanet\ias6\ias\APPS\modules\[proj_parent]\WEB-INF\compiled_jsp\jsp\APPS
    \[proj_parent]\..\[proj_common]\common.java:1: Identifier expected.
    package jsp.APPS.[proj_parent]....[proj_common];
    ^ (pointing under 2nd dot of ....)
    c:\iplanet\ias6\ias\APPS\modules\[proj_parent]\WEB-INF\compiled_jsp\jsp\APPS
    \[proj_parent]\..\[proj_common]\common.java:11: Superclass HttpServlet of
    class common not found.
    public class common extends HttpServlet {
    ^ (pointing under HttpServlet)
    2 errors
    I believe this is not a path error (since that error explicitly tells me the
    included file cannot be found). I have read other previous messages and
    learn that there is a problem with <jsp:include> and relative paths... Also
    a test when both files are in the same directory shows no problem at all. Is
    there a solution to this problem of parsing relative paths in SP2?
    Thanks and regards,
    Anthony Yuen

    Another strange thing happened:
    We have been including html and jsp files. From a certain point the system was
    not able to include html files. When we renamed html includes to jsp, it was
    working again.
    Has anyone experienced the same thing?
    Does anyone know the resolution?
    Regards,
    Gyorgy
    Anthony Yuen wrote:
    I'm trying to include a common jsp file, say [proj_common]/common.jsp, from
    another jsp file, say [proj_parent]/parent.jsp, using <jsp:include>. After
    deployment both files sit under their respective folders (for example in
    c:\iplanet\ias6\ias\APPS\modules) as [proj_common]/common.jsp and
    [proj_parent]/parent.jsp. I've included a relative path from [proj_parent]
    to [proj_common], and here's the code I've added in
    [proj_parent]/parent.jsp:
    <jsp:include page="../[proj_common]/common.jsp">
    <jsp:param name="p1" value="v1"/>
    </jsp:include>
    I'm using only static HTML in common.jsp as a test. The following error then
    occured when I view [proj_parent]/parent.jsp :
    500 SC_INTERNAL_SERVER_ERROR
    Error: 500 SC_INTERNAL_SERVER_ERROR
    javac error:
    c:\iplanet\ias6\ias\APPS\modules\[proj_parent]\WEB-INF\compiled_jsp\jsp\APPS
    \[proj_parent]\..\[proj_common]\common.java:1: Identifier expected.
    package jsp.APPS.[proj_parent]....[proj_common];
    ^ (pointing under 2nd dot of ....)
    c:\iplanet\ias6\ias\APPS\modules\[proj_parent]\WEB-INF\compiled_jsp\jsp\APPS
    \[proj_parent]\..\[proj_common]\common.java:11: Superclass HttpServlet of
    class common not found.
    public class common extends HttpServlet {
    ^ (pointing under HttpServlet)
    2 errors
    I believe this is not a path error (since that error explicitly tells me the
    included file cannot be found). I have read other previous messages and
    learn that there is a problem with <jsp:include> and relative paths... Also
    a test when both files are in the same directory shows no problem at all. Is
    there a solution to this problem of parsing relative paths in SP2?
    Thanks and regards,
    Anthony Yuen

  • Binding properties of a root node and using fx:include.

    I posted a downloadable example of this here:
    https://dl.dropboxusercontent.com/u/8788282/binding-test.zip
    I've noticed some understandable, but less than perfect behaviour with the way FXML initialization is done when using fx:include.  I find it's difficult to bind properties that belong to the root node of the included view without shooting yourself in the proverbial foot.  Here is an example of what I mean:
    sample.Main
    package sample;
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    public class Main extends Application {
        @Override
        public void start(Stage primaryStage) throws Exception {
            Parent root = FXMLLoader.load(getClass().getResource("MainView.fxml"));
            primaryStage.setTitle("Hello World");
            primaryStage.setScene(new Scene(root, 300, 275));
            primaryStage.show();
        public static void main(String[] args) {
            launch(args);
    sample.MainController
    package sample;
    import javafx.fxml.FXML;
    public class MainController {
        @FXML
        void initialize() {
            System.out.println("MainController initialized.");
    sample.MainView (FXML)
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.control.Label?>
    <?import javafx.scene.layout.*?>
    <AnchorPane prefHeight="200.0" prefWidth="200.0"
                xmlns:fx="http://javafx.com/fxml/1"
                xmlns="http://javafx.com/javafx/2.2"
                fx:controller="sample.MainController">
        <children>
            <VBox prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0"
                  AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
                  AnchorPane.topAnchor="0.0">
                <children>
                    <Label text="Main"/>
                    <StackPane prefHeight="150.0" prefWidth="200.0"/>
                    <fx:include fx:id="sub" source="SubView.fxml" visible="false"/>
                </children>
            </VBox>
        </children>
    </AnchorPane>
    sample.SubController
    package sample;
    import javafx.beans.binding.Bindings;
    import javafx.fxml.FXML;
    import javafx.scene.control.Label;
    import javafx.scene.layout.AnchorPane;
    public class SubController {
        @FXML
        private AnchorPane anchorPane;
        @FXML
        private Label label;
        @FXML
        void initialize() {
            label.visibleProperty().bind(Bindings.createBooleanBinding(() -> true));
            /* When used as part of an fx:include, this controller's initialize()
             * block is called and the below binding is performed.  After that, any
             * property values set via the containing view (MainView) are applied.
             * In this example, the MainView attempts to set the visible property
             * of this included view (fx:id="sub").  Since the visible property of
             * the root node (anchorPane) has already been bound, the error
             * "A bound value cannot be set." is given.
            anchorPane.visibleProperty().bind(Bindings.createBooleanBinding(() -> true));
            System.out.println("SubController initialized.");
    sample.SubView (FXML)
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.control.Label?>
    <?import javafx.scene.layout.*?>
    <AnchorPane id="AnchorPane" fx:id="anchorPane" maxHeight="-Infinity"
                maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
                prefHeight="400.0" prefWidth="600.0"
                xmlns:fx="http://javafx.com/fxml/1"
                xmlns="http://javafx.com/javafx/2.2"
                fx:controller="sample.SubController">
        <children>
            <VBox prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0"
                  AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
                  AnchorPane.topAnchor="0.0">
                <children>
                    <Label fx:id="label" text="sub view"/>
                </children>
            </VBox>
        </children>
    </AnchorPane>
    The comments in the initialize method of SubController explain what's happening.  I found it a bit confusing until I figured out what was going on.  Should FXMLLoader be checking to see if a property is already bound before trying to set it, at least for nodes declared via fx:include?

    Hi Gaurave,
    We need to show the report like this to some users, thats what the requirement is. Using the Posted nodes option does not help.
    Thanks.

  • Shall we use SRDemo Framework Extension Classes in 11G R1?

    Hi,
    I just installed 11G R1 and reading developer guides. For development with 10.1.3.3 release I was using the Framework extension classes from SRDemo to base BC's on. Those methods includes many base functionality such as setManagerowsByKey, case-insensitive search, some bind variables initialized, and so on. Shall we continue to use them for 11G R1? To keep currency of viewobjects after rollback, I use the method proposed by Steeve Muench's blog entry which contains beforeRollback and afterRollBack methods on the base viewobject and exposing row state to client . shall I continue to use it?
    Best Regards,

    Salim,
    If those methods provide functionality that you like - I don't see why you shouldn't continue to use them.
    John

  • Xalan XML thru Web Start - how to include other classes

    Hello developers,
    I have an JAVA Swing application which needs an xml output, it creates an XML file which has to be stored in the clients hard drive. Though i have finished it, the application runs perfectly in the swing, if i deploy it using Java Webstart, the classes are not found,
    The classes for xercers and xalan or not understood by webstart, how do i include these classes too. Could any1 throw some light on how to use other classes too in webstart applications.
    thanks,
    Prashant.

    Depends on the version of the JRE you are supporting. If you are using 1.4 you should be able to get it to work with the classes shipped with it.
    If you really want to use the Xerces parser you will have to include the following in your .jnlp file.
    <jar href="xerces.jar" download="eager"/>
    <property name="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
    This forces the runtime to use Xerces instead of a locally available XML parser.

  • Including a class I made in all my projects

    Hi;
    I have developed several classes that I want to use in future developments and I can't find a way to set this classes the same way as the standard Java classes. For example I what to have a folder of all the classes developed by myself and add it to the standard Java classes, so that, for example, in any program I can make a call like this;
    include Utilities.MyClass1;
    include Utilities.MyClass2;
    etc...
    Thanks in advance

    you can include a class by
    import yourclasspath.class1;
    ect
    first you must set your compail & run classpath
    for example :
    classpath = d:\myclasses\test.jar;.;
    in test.jar ,store the class you have writen

  • Using Timer and TimerTask classes in EJB's(J2EE)

    Does J2EE allow us to use Timer and TimerTask classes from java.util package in SessionBean EJB's ( Statless or Statefull )?.
    If J2EE does allow, I am not sure how things work in practical, Lets take simple example where a stateless SessionBean creates a Timer class
    and schedules a task to be executed after 5 hours and returns. Assuming
    GC kicks in many times in 5 hours, I wonder if the Timer object created by survives the GC run's so that it can execute the scheduled tasks.
    My gut feeling says that the Timer Object will not survive.. Just
    want to confirm that.
    I will be interested to know If there are any techiniques that can make
    the usage of Timer and TimeTask classes in EJB's possible as well as reliable with minmum impact on over all performance.

    Have a look at J2EE 1.4. I think they add a timer service for EJBs there...
    Kai

  • How to use the Include Statement in the BADI

    Dear All,
            I am trying to implement the BADI. So i need to use the Include in the BADI.
    How to use the Include statement in the BADI. I cant able to use it in the Public, Private and protected statement.
    Where should i mention that,,,,
    Thanks
    Yogesh

    Hi Sharat,
      Thanks for your reply.
    I need to use the BADI HRWPC_PCR_APPR_FORM. In which the values are available in the Container. So if i need to use the container values then i need to use that include <cntain>.
    Is there any possible ways to make it.
    Thanks
    Yogesh

  • Create jar file using eclipse including the addition of a dll

    hy ..
         i have developed an application using eclipse.Having problems exporting the file as an executable jar.Even after providing the main class name in the manifest file, the jar file is giving the following error on a double click - "Could not find main class.Program will exit" .
         i have used an external jar file for displaying a tray icon on the system tray.This inturns uses a dll file which i have on my classpath.How do i get these into the jar and get it running..
    thanx in advance

    hy ..
    i have developed an application using eclipse.Having
    g problems exporting the file as an executable
    jar.Even after providing the main class name in the
    manifest file, the jar file is giving the following
    error on a double click - "Could not find main
    class.Program will exit" .Guessing, you don't specify the package part of the classname.
    i have used an external jar file for displaying a
    a tray icon on the system tray.This inturns uses a
    dll file which i have on my classpath.How do i get
    these into the jar and get it running..You can't run a dll from inside of a jar.
    If you're trying to use the JDIC tray classes, I don't believe they will run from a jar, but you might find otherwise. See https://jdic.dev.java.net/
    >
    thanx in advance

  • Error in using TCPIP/Inst​r class to open a VISA session

    I use the TCPIP/Instr class session to open a VISA session to Agilent 86140B Optical spectrum Analyser and I get an Error - VISA open in Appln.vi.Help me to fix this problem.
    I am able to access the instrument on LAN through a Telnet session.
    Vijayalakshmi.
    Attachments:
    OSA_Close.vi ‏28 KB
    OSA_Reset.vi ‏27 KB
    OSA_Initialize.vi ‏63 KB

    Thanx for the reply.The instrument is VXI-11 compliant.The error I am getting is Instrument timeout -1073807339 (BFFF0015) and I am using LabVIEW on Linux.
    I have another problem.I am able to see the instrument using a Telnet session but not using http//192.168.10.2 on a web browser.It is giving an error that the host may be down and try some time later.

  • Facing problem to Use a custom Java class in UCCX

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin-top:0in;
    mso-para-margin-right:0in;
    mso-para-margin-bottom:10.0pt;
    mso-para-margin-left:0in;
    line-height:115%;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}
    Hi,
    We are using Communication manager 7.0.1 and UCCX version 7.0.1(Cisco Unified CCX Premium).  We are trying to call a Custom Java class file from UCCX scripting. We have followed the steps mentioned in the guide (How-To: Using a custom Java class in UCCX 5.x (SOAP Example)). See below link.
    http://www.avholloway.com/vtools/ipcc/custom-java/soap/
    After completed all the steps we have got the variable type SimpleSOAP at script but we did not found it to object constructors or object attributes (plz find the attached screenshots). We will appreciate if you plz guide us to solve the issue.
    Thanks
    Fakhrul
    LEADS Corporation Ltd.

    Hello, Fakhrul.
    I'm sorry to see you were not able to find the information or help you were looking for here in the Contact Center community forum.
    You may be able to find more help through the Cisco Developer Network.
    Also, you might want to consider engaging Cisco Advanced Services via your account team to assist with UCCX custom scripting.
    Thank you, and good luck.
    -Paulo

  • What are the uses of declaring a class "final"?

    Can any one please tell me the uses of declaring a class "final"?
    I know that final classes cannot be extended. Other than this,
    Is there any thing that will improve the compiler time for the final classes?

    compiler performance is utterly unimportant anyway...
    If the compiler takes too long, just get a faster build system :)

  • Is there any way to an index that can be used to include the "OR condition "?

    Hello I have some questions.
    The test was conducted in the following procedure .
    create table test
    c1 varchar2(10),
    c2 varchar2(10),
    primary key(c1)
    create index test_idx1 on test(c2);
    Command> explain select * from test where c1 = 'AAAAAAAAAA' or c2 = 'AAAAAAAAAA';
    Query Optimizer Plan:
      STEP:                1
      LEVEL:               1
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST
      INDEXED CONDITION:   <NULL>
      NOT INDEXED:         TEST.C2 = 'AAAAAAAAAA' OR TEST.C1 = 'AAAAAAAAAA'
    Command>
    Command> explain select * from test where c1 = 'AAAAAAAAAA' and c2 = 'AAAAAAAAAA'
    Query Optimizer Plan:
      STEP:                1
      LEVEL:               1
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST
      INDEXED CONDITION:   TEST.C1 = 'AAAAAAAAAA'
      NOT INDEXED:         TEST.C2 = 'AAAAAAAAAA'
    Command>
    By including the "OR condition " in this test does not use the index.
    Is there any way to an index that can be used to include the "OR condition "?
    Thanks.
    GooGyum.

    A database cannot in general use indexes in this way for an 'or' involving two different columns. However, for this specific example one can easily rewrite the query using 'UNION' to use the relevant indexes while still giving the same (correct) result:
    Command> explain select * from test t1 where t1.c1 = 'AAAAAAAAAA' union select * from test t2 where t2.c2 = 'AAAAAAAAAA';
    Query Optimizer Plan:
      STEP:                1
      LEVEL:               1
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST
      INDEXED CONDITION:   T1.C1 = 'AAAAAAAAAA'
      NOT INDEXED:         <NULL>
      STEP:                2
      LEVEL:               2
      OPERATION:           RowLkRangeScan
      TBLNAME:             TEST
      IXNAME:              TEST_IDX2
      INDEXED CONDITION:   T2.C2 = 'AAAAAAAAAA'
      NOT INDEXED:         <NULL>
      STEP:                3
      LEVEL:               1
      OPERATION:           OrderBy
      TBLNAME:             <NULL>
      IXNAME:              <NULL>
      INDEXED CONDITION:   <NULL>
      NOT INDEXED:         <NULL>
      STEP:                4
      LEVEL:               2
      OPERATION:           UnionMergeSort
      TBLNAME:             <NULL>
      IXNAME:              <NULL>
      INDEXED CONDITION:   <NULL>
      NOT INDEXED:         <NULL>
    Maybe you can apply a similar trick? If you know there is no possibility of duplicate rows then you can further optimise this (in terms of performance) by using UNION ALL.
    Chris

Maybe you are looking for