Results 1 to 7 of 7

Thread: ${xyz}

  1. #1
    wilsonshamim is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default ${xyz}

    Can any one help me understanding about ${ some txt here} What does this mean. Why do we use it. I have seen this at many places in the code


    Regards,
    Shamim
    shamim.797@gmail.com

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Would you mind showing an example of it in code?

  3. #3
    wilsonshamim is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default

    Ok
    here is the code

    <property file="build.properties"/>
    <property file="../build.properties"/>
    <property file="../../build.properties"/>
    <property file="${user.home}/build.properties"/>

    <property name="build.compiler" value="modern"/>
    <property name="webapps.build" value="../build"/>
    <property name="webapps.dist" value="../dist"/>
    <property name="webapp.name" value="ROOT"/>


    <!-- =================== BUILD: Create Directories ====================== -->
    <target name="build-prepare">
    <mkdir dir="${webapps.build}"/>
    <mkdir dir="${webapps.build}/${webapp.name}"/>
    </target>


    This code you can find in the xml file. have you installed apche tomcat . this is the build file in the apche tomcat -> webapps ->root-> build.xml file.
    Also I have such at different other places.

  4. #4
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

    Default

    That is the equivalent of Java variables in XML. See those "<property name=..." lines? Those are "variable declarations" and using ${...} is referencing those variables. Useful when you need globals so if you need to change them, you just change the original declaration instead of each one.

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    If that's an ANT script the syntax is described in the manual.

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,651
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by pbrockway2 View Post
    If that's an ANT script the syntax is described in the manual.
    I implemented that feature once (naively, before I had my espresso) until I stumbled on this:

    Java Code:
    B = ${A}
    A = ${B}
    I had to change my entire replacement method ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    wilsonshamim is offline Member
    Join Date
    Dec 2010
    Posts
    4
    Rep Power
    0

    Default

    Thanks a lot for all your replies ... well understood about it. :)
    will try to implement .

    Regards,
    Shamim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •