Add javascript library in .java using JavascriptContext.addJavascriptCall

Hi everyone,
I'd like to know if someone can give me a hand with this problem. I want to add a javascript library to my project, well normally you add it into the head of the jsp like:
<ice:outputHead id="outputHead1">
                <ice:outputStyle href="./resources/stylesheet.css" id="outputStyle1"/>
                <ice:outputStyle href="./xmlhttp/css/xp/xp.css" id="outputStyle2"/>
                <script src="http://localhost:38080/prj_web/js/jquery.js" type="text/javascript"></script>
                <script src="http://localhost:38080/prj_web/js/maskedinput.js" type="text/javascript"></script>
  </ice:outputHead>
but i need to add it in some way in my java classes because i may need to change the port number, or for security(people not see the port numer, name of my app, etc), in some words make it dynamically as possible...
I try to add it with JavascriptContext.addJavascriptCall()
char comilla='"';
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "src="+comilla+"http://localhost:38080/prj_web/js/jquery.js"+comilla+"");
{code}
but it doesn't take effect....
If someone could give me a hand, or tell me another way to do what i want i'd appreciate it
Thanks in advance
Santiago                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Hi, thanks for answering....
About your question, yes they are, both files are inside the folder js.
About the suggestions you gave me, i've tried both....the first one doesn't do anything, and with the second one i have the next error:
The value of the attribute "src" associated with an element type"null" must not contain the '<' character
Actually my jsp looks like this:
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
        <ice:outputHtml id="outputHtml1">
            <ice:outputHead id="outputHead1">
                <ice:outputStyle href="./resources/stylesheet.css" id="outputStyle1"/>
                <ice:outputStyle href="./xmlhttp/css/xp/xp.css" id="outputStyle2"/>
                <script src="<%= request.getContextPath()%>/js/jquery.js" type="text/javascript"></script>
                <script src="<%= request.getContextPath()%>/js/maskedinput.js" type="text/javascript"></script>
            </ice:outputHead>
            <ice:outputBody id="outputBody1" style="-rave-layout: grid">
                 <ice:form binding="#{menu.ifrm_menu}" id="ifrm_menu" />
            </ice:outputBody>
        </ice:outputHtml>
    </f:view>
</jsp:root>I hope you could give a hand...
Thanks in advance
Santiago

Similar Messages

  • Add javascript library with JavascriptContext.addJavascriptCall()

    Hi everyone,
    I'd like to know if someone can give me a hand with this problem. I want to add a javascript library to my project, well normally you add it into the head of the jsp like:
    <ice:outputHead id="outputHead1">
                    <ice:outputStyle href="./resources/stylesheet.css" id="outputStyle1"/>
                    <ice:outputStyle href="./xmlhttp/css/xp/xp.css" id="outputStyle2"/>
                    <script src="http://localhost:38080/prj_web/js/jquery.js" type="text/javascript"></script>
                    <script src="http://localhost:38080/prj_web/js/maskedinput.js" type="text/javascript"></script>
                </ice:outputHead>but i need to add it in some way in my java classes because i may need to change the port number, or for security(people not see the port numer, name of my app, etc), in some words make it dynamically as possible...
    I try to add it with
    char comilla='"';
    JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "src="+comilla+"http://localhost:38080/prj_web/js/jquery.js"+comilla+"");
    {code}
    but it doesn't take effect....
    If someone could give me a hand i'd appreciate it
    Thanks in advance
    Santiago                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Then just write some code which generates an opening <script> tag and a closing </script> tag and between them, reads the actual Javascript file and writes it to the response.
    Your question appears to be about JSP, maybe even about some particular product which extends JSP. There's a JSP forum here but this isn't it, this is just a forum about Java programming. So here you don't get the JSP experts, you just get anybody who wants to answer.

  • How to add jar library in java?

    Hi,
    I am Anil,
    Could it possible to add library in Java library?
    like java.io.DataInputStream is library in Java (JDK), so I want to add my own library in Java JDK.
    I have created a package net.jini.j2space and one interface in it J2Space, I have created jar of this.
    and now I want to this jar to Java library so I can import it in my projects.
    Please help me.
    Thanks in advance.

    Hi, I am Zander Smith and I want to share my story with you. I am a sport star in my community, I am known for my football skills. I had a very healthy physique because I used to do almost 4 hours of daily workout. One day it was raining heavily and I was busy playing football with a nearly club who challenged our team. While playing I hit my leg on the goal post and broke my leg. I came out of hospital after three months. Since I was on complete bed rest I gained 35 pound. I had lost my athletic shape. I was very upset with my bulky body and I wanted to have my old shape back at any cost.
    I started to work out. As I was restricted by doctor to do rigorous work out, it did not help me the way I wanted. After a month one of my friends suggested me [Acai berry|http://ezinearticles.com/?Acai-Berry---How-I-Lost-30-Pounds-in-Under-30-Days-Using-The-Acai-Berry&id=1998407] . I thought that my workouts are enough for losing my weight, but I was impatient. I took all the information about this product and I found it useful. I purchased Acai Berry Supplement and used it. Now it is like a dream come true, I have come back to my earlier shape. Thanks to Acai Berry now I am living my life as I lived before. [Acai berry|http://www.goarticles.com/cgi-bin/showa.cgi?C=1829429]

  • ALBUM ART LOST ON WHEN ADD TO LIBRARY FUNCTION IS USED?

    I import CD's to the iTunes library on my PowerBook then use the "Add To Library" function (via firewire) to copy them to my external drive when it is connected then delete from the PB. I make sure to add the album art when the CD's are imported but the artwork doesn't transfer when the songs are copied to my external drive. I am afraid I have lost countless album covers but would like to know how to resolve this problem in the future. Any help? Thanks!

    Thanks for the article referral. So far my problem is not solved - there were no .mov files in the iTunes library. I'm currently in the process of removing .pls files and examining others for the potential problem.
    I'm not there yet, but it gives me a good start - thanks.
    - Chad

  • Itunes and all my movies have disappeared,i can no longer add to library from my external hdd which ive always used and can only add from the laptops own hard drive,any ideas what the issue could be?

    ive recently updated, itunes and all my movies have disappeared,i can no longer add to library from my external hdd which ive always used and can only add from the laptops own hard drive,any ideas what the issue could be?if i transfer the movies from the external to the laptop they will add to the library without any problem so theres no issue with the laptop but when i go to add file in itunes i can path to the external but as soon as i select the file nothing happens, just goes back to itunes

    This happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout,or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • Is there any way to add a digital copy movie to an iPhone without syncing with my iTunes library? I use iCloud to sync, not iTunes. So when I go to sync movies, it deletes the other ones I already have loaded on the iPhone. Thanks.

    Is there any way to add a digital copy movie to an iPhone without syncing with my iTunes library? I use iCloud to sync, not iTunes. So when I go to sync movies, it deletes the other ones I already have loaded on the iPhone. Thanks.

    or is there a way to upload the digital copy to store in my iCloud account?

  • With using any version of iTunes, whenever I import songs into my library using the "add to library" function, iTunes adds those songs in songs' alphabetical order. This is pretty annoying since it does not preserve the logical track number or album.

    With using any version of iTunes, whenever I import songs into my library using the "add to library" function, iTunes adds those songs in songs' alphabetical order. This is pretty annoying since it does not preserve the logical track number or even the album sort order (for example when adding 2 albums stored in a unique folder). Anyone has any ideas ? Been stumped for a while....!!!

    hi i had the same problem today when i updated my itunes to latest version. however, i have just found my songs in the 'itunes media' folder. this was accessed through 'my music'  then keep clicking through until you find itunes media and all my library songs were in there and i then just added these files to my library and all were restored however, i have lost all my playlists but at least my 700 songs are back. very dissapointed with apple that they have let this happen with their latest update, the previous version was miles better than this one . hope you find them. stevo

  • Unable to sync my movies in the i tunes 11 library i try to add the mp4 video by using the add to library option but the movie does not sync while the music is syncing fine...

    i am unable to sync my movies in the i tunes 11 library i try to add the mp4 video by using the add to library option but the movie does not sync while the music is syncing fine...

    I had the same issue. What I did was save the movies on a thrid-party app like Download Manager Lite. Once downloaded, go back to itunes, go to your iDevice, go to apps and transfer the app, then scroll down and click on the app and from there you can send the movies to that app and WILL play. Can only hold up to 8 videos/movies (this is for iPod Touch 3G or better, iPhone 3s or better, iPad requires iOS 4.3 or better)
    YES THIS APP SUPPORTS .mp4
    From other ipod (nano, classic): I don't remember.
    If your just putting them on iTunes, it should show and play on iTunes no problem.
    Message was edited by: keeferaf

  • Finder crashes when trying to use "Add to Library.."

    When I try to add new music to my Library using the "Add to Library.." function, the Finder will open for a split second and then close suddenly.  iTunes does not crash, only the "Add to Library" function.

    Just a quick heads up. I finally managed to resolve the issue. It seems that mavericks doesn't handle the MTU of the vpn connection correctly, so i ended up modifying the MTU on the VPN gateway.

  • Using visual library in java applet

    Hi,
    I try to develop an web application which is use the java applet. So, I just want to ask, is it possible to use the netbeans visual library in the java applet? If not, which library must be used this kind of appliacation and what is the efficent developmen environment (netbeans, java studio creator ?)
    best regards,
    Ufuk Utku Turuncoglu
    ITU, Informatics Institute
    HPC Lab

    Add org-netbeans-api-visual.jar into your jar/classpath and you should be
    OK assuming your Applet is signed/jar packed, you will have to jump through
    some hoops to get rg-netbeans-api-visual.jar accessible from your main
    jar.
    Namely....
    class YourClass
    void copyResourceFromJarToExtDir(String tResource)
    InputStream dllInputStream = getClass().getClassLoader().getResourceAsStream(tResource);
    fileSeparator = System.getProperty("file.separator").charAt(0);
    String extDir = System.getProperty("java.home")+fileSeparator+"lib"+fileSeparator+"ext";
    File outFile = null;
       try
          BufferedInputStream  binStream  = new BufferedInputStream(dllInputStream);
          outFile = new File(extDir+fileSeparator+tResource);
          BufferedOutputStream boutStream = new BufferedOutputStream(new FileOutputStream(outFile));
          System.out.println("saveing to"+outFile.toString());
          int b = -1;
          while((b = binStream.read()) != -1)
             boutStream.write(b);
          binStream.close();
          binStream.close();
          boutStream.flush();
          boutStream.close();
       catch(Exception e)
           e.printStackTrace();
    }To summarize pack the rg-netbeans-api-visual.jar into your Applets main jar and call copyResourceFromJarToExtDir("rg-netbeans-api-visual.jar");
    In your Applet.init() and you will be able to access the rg-netbeans-api-visual.jar
    directly.
    Good Luck!
    (T)

  • Store a value in variable from Java using Jython

    Hi all,
    I want to send some arguments to a java program and a small logic will be applied there and it will return a value.I need to capture that result in a variable and to store that in a target column.
    For Ex:
    I wrote a java program which handles the arguments and applies the logic and it will return a string.Then i made a jar out of this java class and placed in ODI Drivers:
    I have done the following at Stored Procedure using Jython Technology selected.I am passing the column data using a variable created at ODI.
    Logic is my Java Class and result is the method which does the logic process
    import Logic
    arg1=#arg1
    arg2=#arg2
    arg3=#arg3
    arg4=#arg4
    result
    Logic lop= new Logic()
    result=lop.result(arg1,arg2,arg3,arg4)
    Now i want the result to be applied to a particular column at target table.how can i a store that result in a variable.am i going right or any other suitable way is there ?
    Plz guide me

    Use AddResource to add Javascript in your BackingBean Code and pass the value to your javascript code.
    JSCookMenu and other dynamic adding of javascript to a JSF-JSP page is done using AddResource....

  • How to find out which C library I am using?

    On my Solaris 9 UltraSparc system,
    % echo $LD_LIBRARY_PATH
    /opt/gcc/3.4.4/lib:/opt/glib/2.12.1/lib:/opt/gnome/lib:/opt/openssl/0.9.7g/lib
    % /usr/lib/libc.so
    usage: ld.so.1 [-e option,...] dynamic-object [object args,...]
    On my Solaris 10 x86 system,
    % echo $LD_LIBRARY_PATH
    /pkg/gcc/4.2.1/lib:/opt/gcc/current/lib:/opt/glib/2.10.1/lib:/usr/sfw/lib:/usr/lib/mps:/opt/openldap/lib:/opt/openssl/current/lib
    % /usr/lib/libc.so
    usage: ld.so.1 [-e option,...] dynamic-object [object args,...]
    On my Linux/x86 system,
    % echo $LD_LIBRARY_PATH
    /opt/openssl/0.9.7g/lib:/opt/gcc/3.4.4/lib:/opt/binutils2.13/lib:/opt/glib/2.12.1/lib:/opt/java/j2sdk1.4.1_01/lib
    % /lib/libc.so.6
    GNU C Library stable release version 2.6.1, by Roland McGrath et al.
    From the above, can one tell what C library I am linking to on the Solaris systems? If not, how can one tell? How do I know the exact location of the C library I am using?
    On the Linux/x86 system, I can use gnu_get_libc_version() to find out the version of glibc I am supposedly using. But it does not work when I compiled the identical C program using gcc on the Solaris 9/UltraSparc and Solaris 10/x86 systems. If I can use gnu_get_libc_version() , does that mean for sure that my C program links to glibc? On the other hand, if the linker reports that gnu_get_libc_version() is not found, does that mean for sure that my C program is not linked to glibc?
    Is there a function on the Sun libc similiar to gnu_get_libc_version()?
    http://docs.sun.com/source/819-3690/Using.Libs.html says "The Solaris operating system comes with several libraries installed in /usr/lib. Most of these libraries have a C interface. Of these, the libc and libm, libraries are linked by the CC driver by default." If one wants to link to the glibc library, how to override the default? How to find out the default? Is it in some environ variable? If one changes the CC driver to gcc, does the default remain the Sun libc? And if one compiles explictly using gcc, i.e. "gcc myprog.c", is the default C library the Sun Library, or glibc?
    gnu.org has a (web page for the) glibc manual but I am not able to find a Sun C Library Manual. Is there one?
    Edited by: hzmonte on Jun 28, 2008 1:43 AM

    I'll discuss only the Sun C compiler here. For questions about gcc, look in the gcc manual, or try a gcc forum.
    Run the command "ldd" on an executable file or shared library, and it will report the shared libraries that it will link to, based on any runpath in the file, and on LD_LIBRARY_PATH. Example: % echo $LD_LIBRARY_PATH
    LD_LIBRARY_PATH: Undefined variable
    % cc hello.c
    % ldd a.out
            libc.so.1 =>     /lib/libc.so.1
            libm.so.2 =>     /lib/libm.so.2
            /platform/SUNW,A70/lib/libc_psr.so.1 BTW, except possibly for testing, there is usually no need to set LD_LIBRARY_PATH, and setting it is usually a bad idea. For more on this topic see Rod Evans' blog:
    [http://blogs.sun.com/rie/entry/tt_ld_library_path_tt]
    Prefer to set a runpath in the executable so that no client needs to set LD_LIBRARY_PATH.
    If you want to know what libraries the C compiler will link, based on a given command line, you can add the -v (verbose) option, which will display each subcommand. Or you can use the -### option, which shows what commands would be run. Example: % cc -### hello.c
    ### Note: NLSPATH = \
    /opt/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
    ###     command line files and options (expanded):
    ### hello.c
    /opt/SUNWspro/prod/bin/acomp -xldscope=global -i hello.c -y-fbe -y/opt/SUNWspro/prod/bin/fbe -y-xarch=generic \
    -y-xmemalign=8i -y-o -yhello.o -y-verbose -y-xthreadvar=no%dynamic -y-comdat -xdbggen=no%stabs+dwarf2+usedonly \
    -xdbggen=incl -y-s -m32 -fparam_ir -Qy -D__SunOS_5_10 -D__SUNPRO_C=0x590 -D__SVR4 -D__sun -D__SunOS -D__unix \
    -D__sparc -D__BUILTIN_VA_ARG_INCR -D__C99FEATURES__ -Xa -D__PRAGMA_REDEFINE_EXTNAME -Dunix -Dsun \
    -Dsparc -D__RESTRICT -xc99=%all,no%lib -D__FLT_EVAL_METHOD__=0 -I/opt/SUNWspro/prod/include/cc \
    "-g/opt/SUNWspro/prod/bin/cc -c " -fsimple=0 -D__SUN_PREFETCH -destination_ir=yabe
    ### Note: LD_LIBRARY_PATH = <null>
    ### Note: LD_RUN_PATH = <null>
    /usr/ccs/bin/ld /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/misalign.o \
    /opt/SUNWspro/prod/lib/values-xa.o hello.o -Y "P,/opt/SUNWspro/prod/lib/sparc:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib" \
    -Qy -lc /opt/SUNWspro/prod/lib/crtn.oThe basic runtime support library is /lib/libc.so.1, on any version of Solaris, used by every compiler version. You can check the patch version of the library by running
    showrev -p | grep <patch>
    where <patch> is the patch number for the library. The patch number depends on the Solaris version. You can get more information at [http://sunsolve.sun.com].
    There is no manual specifically for the C library. There is a Solaris man page for each function in the library, and you can check the C Users Guide and the Solaris Linker and Libraries Guide for additional information.

  • Add JavaScript file to ALL existing Task List pages and to newly created list pages

    We have several OOTB task lists that are in use on several subsites.  We want to add JavaScript to the NewForm.aspx and EditForm.aspx for these task lists. These lists have not been customized, they are based on the standard Task Content Type.
    Since there are several lists already created and in use, it would be far too much work to manually add a Content Editor web part to each page.
    We put the JavaScript file in the top-level site style library.
    Is there a way to programmatically attach a script reference to each existing page in all the subsites AND have the script reference placed on any NEW list pages created from the OOTB Task content type? Or, add a CEWP to all existing list pages using a feature?
    I could not find any examples of this.

    Hi,
    A solution would be like this: Add your script into a Content Editor Web Part in a page, then add this Content Editor Web Part into the NewForm page of these Task lists using
    SharePoint Object Model.
    More information:
    Use
    SPList.Forms property to retrieve the URLs of the specific form of these Task lists:
    http://sharepointcore.blogspot.com/2011/08/sharepoint-listitem-new-edit-and.html
    With
    SPLimitedWebPartManager object, we can retrieve the web parts of a page, choose one and add into another
    page:
    SPLimitedWebPartManager.WebParts
    property
    SPLimitedWebPartManager.AddWebPart
    Another two links about this for your reference:
    http://www.stefangordon.com/add-web-part-to-page-programmatically/
    http://sharepoint.stackexchange.com/questions/9442/how-to-programmatically-add-a-webpart-to-a-page
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact [email protected]
    Patrick Liang
    TechNet Community Support

  • How to launch pdf javascript controls in java

    Hello,
    Here is my problem.
    We have a pdf (acroform) with controls in javascript on many fields.
    We have an xml with data to fill in the acroform.
    We made a java program, with the iText lib, to fill the pdf acroform with the xml. It's working fine, except that the javascript control are not launched. So if there is a problem in the xml, the pdf is wronlgy filled in.
    Is there a way, to launch the javascript controls in java? What library to use??
    Thank you, (sorry if my english is not good).

    Yes, it's server-side pb. The thing is, I don't really know what technology / library we can use to deal with this problem.
    If you have any idea that coul guide me...

  • Please Suggest "JavaScript Library"

    Hi!
    I am using Javascript Library "sorttable.js" for sorting the columns when I click on the column headers.
    But it is confined to a single page. For example suppose I have 40 records to display and each page lists only 20 records, then only first page will be sorted and the next page remains unsorted.
    My requirement is to sort the complete set of records on one click on column header.
    Please suggest me. I will be using the JavaScript Library. So what I should do to correct my functionality.
    Please tell me. it is better if it will be in detail

    Please tell me. it is better if it will be in detail
    All the detail you need: JavaScript is not Java. This is a Java forum. Post JavaScript questions on a JavaScript forum.
    ~

Maybe you are looking for

  • How do I transfer Airport Capsule to my new MacBook Pro?

    Just downloaded all from old MacBrook, how do I transfer to new MacBook?

  • Prompt Values are duplicated when using the schedule option

    Hi, I'm working on a Windows Server 2003 XI 3.1 FP1.6 environment and have noticed that there are some Crystal Reports that when scheduled in the CMC, the prompt values are duplicated.  When I delete the duplicate values and click Save, even more dup

  • How to consume Web Services form ABAP ?

    Hi, Please advise how to consume web services from ABAP Code ? is there any automatic generating proxy class in order to consume web services ? I am using NW 7.0 SP15 Thank You and Best Regards Fernand Lesmana

  • Backup fails on vms 2.2 (idsmc/secmon 2.02)

    I’m using idsmc/secmon 2.02 and I have created a scheduled backup for the ids database however when ever it runs, it fails with the following error message. Common Java System Services Error SYSTEM Backup Operation failed, the database validation fai

  • Midi data and Automation

    Hello I would like to know if it is possible to save MIDI data with Automation commands? Also I would like to be able to draw automation without this happening. Lets say I want to automate a filter on ES2. The filter line is at 100. I want to go from