Constants class or include

hey folks
I'm trying to make use of constants, but I'm not sure what the preferred way is.
is it possible to utilize includes in web dynpro (couldn't find a way to define include) or is the better approach to use an assistance class with static fields?
or any other way?
cheers
stefan

Web Dynpro or not, you really shouldn't use an include for such things anymore.  You should always use a class or interface for reusable constants. In WD as you have seen, it is even more enforced since you shouldn't use any kind of include.  If you constants are pretty well only used in this component, then I would use the assistanace class.  If you need them to be reusable in more than this one place, you might consider an interface of their own.

Similar Messages

  • Accessing Constant classes from jsps

    org.apache.struts.taglib.html.Constants is a java constant class with no getter/setter methods
    is this the only way (not using other form beans) to get the value of a constant within that class
    can we use pageContext or any other expression language to do things like this?
    <c:set var="tokenKey">
    <jsp:expression>
    org.apache.struts.taglib.html.Constants.TOKEN_KEY
    </jsp:expression>
    </c:set>
    thank you

    EL doesn't have any way to access constants.
    What you have there is pretty much the only method without using other beans.
    There are certain workarounds that have been proposed. Javaranch had an article on it a while ago:
    http://www.javaranch.com/journal/200601/Journal200601.jsp#a3
    A previous thread on this topic, with a proposed solution: http://forum.java.sun.com/thread.jspa?threadID=508847

  • Do we have INCLUDE=JAVA CLASS AND INCLUDE=JAVA SOURCE OPTION IN DATA PUMP

    Hi All ,
    Can any one please tell me ,
    how to import only java class and java source from datapump export file.
    Include=java class or include=java source is not working ..
    Thanks in advance,
    Sanjeev.

    Duplicate post.
    datapump include option.
    Lock this thread

  • Com.sap.portal.directory.Constants Class

    Hi,
    I can not find a jar file containing the Constants Class of com.sap.portal.directory.
    Does anybody know in what application and jar file it is contained?
    And if someone has the coresponding jar file to send it to: [email protected]
    Best Regards

    Hi
    I have sent the required jar file to ur emailid.
    Regards
    (Rewards points if it helps)

  • Xlf files Vs constant class

    Hi
    There are xlf files which we use for internationalization of application.
    All displayed text elements are kept in these xlf files and key values corresponding to text elements are used in jsp.
    Now, suppose we do not have need for internationalization, but still we can maintain these xlf files because they give us centralized location to keep all text constants.
    But, having said above statement what benefit this approach will give me, if I choose it ahead of maintaining a constant class in java ?
    Please comment.
    Thanking you in anticipation.

    Is there an extra overhead when you are using java classes because every time you make changes in them, they need to be compiled first and then deployed in server.
    But in case of xlf files no compilation is done !
    There has to be another good reason on when to use java class and when to use xlf file ?

  • Assign constant Class array numbers to position

    Hi,
    can anybody help me with this method,the method is suppose to take a name of an alien and its finishing position
    the finishingPosition takes its points from the constant class.What I need to do is assign the constant class points to the finishingPosition help would be most appreciated.
    private static final int[] SPACEPOINTS_FOR_PLACES = {10,8,6,5,4,3,2,1};
    public void addNavigatorResult(String alienName,int finishingPosition)
         Alien result = new Alien();
         for(int counter = 0; counter < SPACEPOINTS_FOR_PLACES.length; counter++ )
            System.out.println(counter + "|" + SPACEPOINTS_FOR_PLACES[counter]);
            if(finishingPosition == 1)
               result.addAlienResult(SPACEPOINTS_FOR_PLACES[counter]);               
      }The code prints out
    0|10
    1|8
    2|6
    3|5
    4|4
    5|3
    6|2
    7|1

    Hi
    I have 3 classes this is what I am uncertain about is where to add the points??
    Alien spec
    void addAlienResult(int powerPointsGained)
    int compareTo(Alien anotherAlienNavigator)
    boolean equals(Object obj)
    String getAlienName()
    String getAlienNationality()
    int getPowerPoints()
    void setAlienName(String newAlienName)
    void setNationality(String newAlienPlanet)
    String toString()
    AlienLeagueSpec_
    void addATeam(String teamName)
    void addNavigatorResult(String alienName, int finishingPosition)
    void addNavigatorToTeam(String alienName, String alienPlanet, String alienTeamName, int navigatorNumber)
    AlienSpaceTeam findTeam(String Name)
    void printAlienTeamResultsTable()
    void printNavigatorResultTable()
    AlienTeamSpec
    vvoid addNavigator(int navigatorNumber, String alienName, String alienPlanet)
    boolean equals(Object obj)
    String getAlienTeamName()
    Set<Alien> getAssignedNavigator()
    Alien getNavigator(int navigatorNumber)
    int getPowerPoints()
    int hashCode()
    String toString()

  • TYPES statement in abap class to include structure

    hi ,
    i have declared following in a abap class...
    TYPES:
          zts_alv_line TYPE zmat_pr_costest_alv.
         TYPES:BEGIN OF ts_alv_line,
                include type zts_alv_line,
                matkl type mara-matkl,
                t023t type t023t-wgbez,
                lvorm type mara-lvorm,
                end of ts_alv_line.
         TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
         DATA:
          alv_data TYPE tt_alv_data.
    now while refering to alv_data-matnr the sap is giving error that this component does not have matnr.
    please help.
    Edited by: Suhas Saha on Feb 3, 2012 1:11 PM

    TYPES: zts_alv_line TYPE zmat_pr_costest_alv.
    TYPES:BEGIN OF ts_alv_line,
                include type zts_alv_line,
                matkl type mara-matkl,
                t023t type t023t-wgbez,
                lvorm type mara-lvorm,
                end of ts_alv_line.
    Actually by defining this you've defined include as field of ts_alv_line. Actually ts_alv_line is a nested structure.
    I think you need to re-define the structure definition as:
    TYPES:BEGIN OF ts_alv_line.
          INCLUDE TYPE zts_alv_line.
    TYPES: matkl TYPE mara-matkl,
           t023t TYPE t023t-wgbez,
           lvorm TYPE mara-lvorm.
    TYPES: END OF ts_alv_line.
    BR,
    Suhas

  • SCCM 2012 Hardware Inventory - Custom Inventory Class ( to Include a registry information in to HW Inv)

    Hi,
     I am trying to include information from a registry into SCCM HW Inventory, I would need some help in extending the HW inventory.
    I have followed one of the blog which says that the change needs to be done on both Configuration.mof and also import the .mof in "Default Client Settings".
    In Microsoft documentation I see an option to just import a .mof file, I did follow the option of importing the .mof into HW inventory and it was imported without any error (I used a mofcomp -check to compile the code)
    Result:
    I see following errors in the InventoryAgent.log which are related to the class that I imported and the information or the fields are not yet available in the resource explorer
    =================================================
    Invalid Query for class abcd: 80041017, will retry to remove invalid properties
    Collection-Retry:Ignore invalid property DeviceType
    =================================================
    Reference I used :
    http://technet.microsoft.com/en-us/library/gg712290.aspx
    http://schadda.blogspot.com/2012/02/sccm-2012-customize-extend-hardware.html

    Just to add to John's comment, I did up a blog post on how to use Regkeytomof to.
    http://be.enhansoft.com/post/2014/02/13/How-to-Use-RegKeyToMof.aspx
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • WorkShop 3.2.0 - WEB-INF/classes not included in war file

    I've created the "Faces Example" project in Workshop Studio 3.2.0 and it's running fine. However, when I export the war file to run it on another server the class files located at "WEB-INF/classes" are not included with the war.
    Any suggestions on what I may be doing wrong would be greatly appreciated.
    thks!

    Unfortunately no, the issue with output folder being ignored occurs only with example apps bundled with Workshop product.
    You can try the following workaround:
    - In Workshop, Project > Properties - Java Build Path, switch to Source tab - "Remove the source folder listing" - Click OK and dismiss Properties window.
    - Project > Properties - Java Build Path > Source Tab, add the same source folder entry - Click OK
    - Export as WAR
    With this you should see the class files bundled under output directory structure (Ex: WEB-INF/classes).

  • How to avaoid java.lang.IllegalArgumentException: No enum const class

    HI ,
    Iam getting java.lang.IllegalArgumentException when iam using switch case through Enum contants.
    //Enum Constants declaration
    public enum USEOFPROCEEDSVALUES { U1,U2,U3, U4}
    //Using Enum in Java class
    Test.java
    USEOFPROCEEDSVALUES useOfProceedsVar =USEOFPROCEEDSVALUES.valueOf(useOfproceeds);
    switch (useOfProceedsVar) {   
                   case U1:
                   revenueSourceCode="REVENUE_SOURCE_CODE.POWER";
                        break;
                   case U2:
                        revenueSourceCode="REVENUE _SOURCE_CODE.WATER";
                   break;
                   case U3:
                        revenueSourceCode="REVENUE_SOURCE_CODE.POWER";
                        break;
                   case U4:
                             revenueSourceCode=REVENUE_SOURCE_CODE.POWER";
                        break;
    default:
                        revenueSourceCode=null;
    Exception raising if there is either of these not U1,U2,U3,U4 ara not avalabele. i.e is if useOfProceedsVar is A6 then exception raising
    How to avoid this exception
    Thanks for early reply

    user818909 wrote:
    HI ,
    Iam getting java.lang.IllegalArgumentException when iam using switch case through Enum contants.
    //Enum Constants declaration
    public enum USEOFPROCEEDSVALUES { U1,U2,U3, U4}
    //Using Enum in Java class
    Exception raising if there is either of these not U1,U2,U3,U4 ara not avalabele. i.e is if useOfProceedsVar is A6 then exception raisingActually useOfProceedsVar can never be A6, it can only take a value from the enum.
    The exception will be raised by valueOf, which (quite correctly) throws it if the String you pass to it doesn't match any of the enum constants.
    >
    How to avoid this exception
    Don't avoid it, process it. What do you want your code to do if the string doesn't match any of your enum constants? Whatever it is, stick it in a catch clause.

  • Need help with using selected class with includes...

    Hi guys,
    I'm using PHP includes for my site and in the header include I have my main navigation - so it's drawn in to whatever page the user goes to from header.php.
    I want to have a 'selected' <li> class for the navigation so the relevant button is highlighted depending on which page/section the user is on...
    How would I go about implementing it into header.php - is there a way I can put a bit of PHP in each of the pages to make the appropiate <li> in header.php use the 'selected' class?
    Thank you and I hope to hear from you.
    SM

    I'm sure there will be an easier way than this for PHP but if you give each menu item a class, you can then give each <body> a different id (or class) to determine where the user is.
    Eg:
    CSS
    nav li.menu_home a{style here} /* class is 'menu_home' for home menu item */
    #home nav li.menu_home a{style here} /* the id of 'home' is added to the body tag on the home page, <body id="home"> */
    HTML
    <body id="home">
    <!-- navigation include -->
    <nav>
    <ul>
    <li class="menu_home"><a href="">Home</a></li>
    </ul>
    </nav>
    <!-- end navigation include -->
    </body>
    Or you could try searching for a javascript method.

  • Deployment problem: Inner class not included

    Hi, All:
    I am trying to deploy my Java application using JDeveloper 3.2. I was be able to successfully deployed it when I first designed the project, even some of the files also have inner classes. Now I have added some new inner classes to a public class and tried to re-deploy it. However how hard I tried (I have tried to rebuild the project, redefine the depoyment profile, even tried to add these class files directly through the advanced tab), the newly added inner class will not be able to be added to the deployed Jar file. I have checked the class files under myclass directory, and found all the inner class files are there, and I can run the application in JDeveloper without any problem. I wonder if there is any tricks to solve this problem. (Other than use the jar command).
    Thanks,
    Peter

    Also, it's probably a good idea to name your packages different than your classesMoreover, common naming conventions dictate you should never even use capitals in your package names if I'm not mistaken. Whereas class names should always at least begin with a capital.
    This will help prevent a lot of confusion, both for the developer and the IDE. ;-)

  • Import a compiled .class or include a .jsp with a class code inside?

    which is better and faster, to import a class file or a jsp file that has a class code inside?

    I apologize but this is a clarification of this problem. We are having a problem dynamically reloading java classes that are referenced by jsp's and servlets. The problem DOES NOT exist when trying to reload jsps or servlets themselves. We would like to reload these classes without having to restart the processes. Any thoughts would be helpful. Thanks.

  • Externalising a class which includes reflection objects

    Hello,
    I'm writing some code which will externalize a message object.
    The message object, which implements Externalizable, contains another object as an instance variable. This inner object has, amongst others, an instance variable of type java.lang.reflect.Method.
    I can't get my head around what I'd need to do in the message object's writeExternal method in order to be able to read it back in again in the corresponding readExternal with respect to with the object of type Method.
    Previous uses of the Externalizable that I've coded have only used simple objects such as int primitives and Strings. Would I have to use ObjectOutput.writeObject and ObjectInput.readObject?
    Thanks in advance for any advice.

    EJP wrote:
    You just have to replicate the code that created the Method object originally, and serialize whatever information that code uses.that could potentially involve a lot of complicated logic. why recreate all the work when you already have the answer? the declaring class (Class), method name (String), and parameters (Class[]) are all Serializable objects.
    now granted, recreating the initial logic could make the code more future proof (if you expect that in the future you will want to be able to resolve a different method from the one originally found), but that's probably not necessary in most situations.

  • I check the box for remembering passwords and when I go back to see the status, it is unchecked. This is since downloading Comcast's "Constant Guard" which includes a Norton AV.

    I am using XP and Firefox 4.0.1

    Norton has its own password manager that turns of the Firefox password manager.

Maybe you are looking for

  • How to Print text in two main windows

    For printing label have created two main windows on a page. calling function write_form In ABAP Program under do loop for two times.  but program prints only one window. why is it so? how can i print text on two windows. do 2 times.   COUNT = COUNT +

  • Why do we need to republish workflows in case of Sharepoint migration?

    Hi, Why do we need to republish the designer workflows when we migrate ?I searched and found that "association id" for workflow is changed during migration which may be the reason . 

  • ITunes page is pink..words Library, Store, and Playlists all blurry

    recently all my music on itunes was deleted but i was able to load all of my music back onto the itunes itself, being that it was still saved on my hard drive, but the itunes page is pink...then i maximize and it turns white (normal), but then i rest

  • Create sql view from linked server ?

    server1.database1.dbo.table1 Table1 contains columns Name, Author, Date, Quantity server2.database2.dbo.table2 Table2 contains columns Id, Author How can I create a view on server2 that cointains all data from server1.database1.dbo.table1, but instea

  • Can sold to party can be changed in billing

    hi can sold to party can be changed in billing doc . how? thanks&regards.