How do I get context path in javascript?

Hi,
I code the following code but the contextPath will return a string = <%=request.getContextPath()%> instead of returning the context path. The codes works on a normal jsp form. Please help. Thanks.
<script>
<contents>
var contextPath = "<![CDATA[<%=request.getContextPath()%>]]>";
function doAction( action ){
if( action == "clear" ){
document.GnCodeSetupForm.action= "clearGnCodeSetupAction.do";
document.GnCodeSetupForm.submit();
</contents>
</script>

var contextPath = "<![CDATA["+<%=request.getContextPath()%>+"]]>";
will return following code
var contextPath = ""+<%=request.getContextPath()%>+"";
which is syntax error.

Similar Messages

  • How can i get the path to config folder placed inside the jar file?

    Hi i have developed an RCP application using eclipse.
    In my application config directory is there.
    When i export my RCP application as JNLP Project the jar file is created which contains config folder inside it.
    When i download the application using java web start , how can i get the path to config folder placed inside the jar file?
    Will the config folder exists in local cache in my system?
    Help needed.
    -Deepak

    -- This works in CS6:
    tell application "Adobe InDesign CS6"
      set myDocument to active document
      set selectedRectangles to selection of myDocument
      set theGraphicsLink to file path of item link of (graphic 1 of (item 1 of selectedRectangles))
    --> "Macintosh HD:folder/folder/filename.tif"
    end tell

  • How can I get the path of an existing file????

    Hi.
    I'm a newbie in Jsp development, so this question may appear trivial.
    How can I get the path into a String of an exixting file ..like ...
    String thepath = path_of("my file.txt");
    Thanks for your help.

    Try
    application.getRealPath("myFile.txt")

  • How can I get the path name and rename it?

    I Hope someone who knows more about automator than I can help me out here. What I'm trying to do is get the path file name, while also changing part of it. Here is my example:
    I can get the path name with this "Get Path" script I found http://automatorworld.com/archives/get-path/all-comments/
    It does half the job so I just need to tweak it but know how. When I get the path this is what I'll get: /Volumes/Public/Creative Services/Campaigns/2010/NCDDiv-32CDV Upgrade/NCDDIV-32Versions.xls
    I need to remove the beginning part"/volumes" to "file://///nhmanmkt01"
    This is so I can send the path from our sever where we keep our files to my windows friends so they can open it.
    Thanks for any help you can provide!

    ok, make the following workflow.
    1. get selected finder items.
    2. run shell script
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    for f in "$@"
    do
    echo "$f"|sed 's%/Volumes%file://///nhmanmkt01%'
    done</pre>
    set the script to accept input as arguments
    3. copy to clipboard
    save it as a finder plugin.

  • How do i get the path of the file selected for opening in JFileChooser

    hi
    I need to get the path of the file selected for opening or saving in the JFileChooser dialog box.Is there any method available.if not how do i get that?
    Thanks and Regards
    Saminathan.

    don't know if its the best/only way, but you could use the getSelectedFile() method in JFileChooser which returns a file and then use the getAbsolutePath() file method

  • Get context path in a jsp without using a scriptlet

    Hi Guys
    I am using Scriptlet to get a application context path in a JSP. I want to get the context path with out using an scriptlet in a JSP, is there way to achieve this..?
    <%=request.getContextPath() %>/listofvalues.do?method=viewListOfValues thanks in advance.
    Regards
    Praveen
    Edited by: praveen_kumarvr on Jul 3, 2008 8:30 AM

    ${pageContext.request.contextPath}A common practice is to put this value in the <base href> in the HTML head and then use this as the root for all of the relative URL's in the page.

  • Getting context path in a jspx

    Greetings
    i have in a JSP this code
    <div id="footerpartners"><img src="<%=request.getContextPath()%>/images/aval.png" width="68" height="26" /><img src="<%=request.getContextPath()%>/images/ath.png" width="79" height="26" /><img src="<%=request.getContextPath()%>/images/ciudad_empresarial.png" width="133" height="26" /><img src="<%=request.getContextPath()%>/images/corficolombiana.png" width="140" height="26" /><img src="<%=request.getContextPath()%>/images/superfinanciera.png" width="181" height="26" /><img src="<%=request.getContextPath()%>/images/verisign.png" width="72" height="26" /></div>
    and this JSP is being include in a JSPX, when loading the JSPX in my browser i am getting this error
    Error de OracleJSP: oracle.jsp.parse.JavaCodeException:Line 3, oracle.jsp.parse.JspParseTagExpression@190fd9b
    Error: Java code in jsp source files is not allowed in ojsp.next mod
    i believe it is because of the contextPath request....................how can i get it in a jspx

    Try using EL instead of the java.
    ${pageContext.servletContext.contextPath}might work.
    Timo

  • How do I get a path to move with a 3D tracker?

    Here is what I have so far: Lumia920 Flying Text - YouTube
    What I'm trying to do in this video is to get the floating Lumia 920 to reflect off of the desk, but not the phone and not the taped part of the desk. I've been trying to apply a mask to a copy of the underlying footage, but there's no position options once I do that.
    My method of getting what I have so far was to:
    1. Track Camera on the underlying footage.
    2. Choose a plane and set up the Lumia 920 text where I want it.
    3. I have a couple of light layers.
    4. For the reflection, I duplicated the Lumia 920 layer and played with the x-axis orientation. Then I decreased opacity to 15% and applied a fast blur.
    How do I get that reflection to be masked in some areas and for the masks to move with the phone and taped part of desk?
    Thanks!

    Im an idiot. I figured it out. I was trying to mask the duplicate. I got rid of the duplicate and just masked the text layer itself.

  • How to set the Context path to AAA/BBB in Weblogic 5.1?

    Hi folks,
              I want to deploy a web application and set the servlet context as:
              AAA/BBB. Put more simply, my application should be accessible via the
              following:
              http:localhost:7001/AAA/BBB/main.jsp
              where http://localhost:7001/AAA/BBB maps to my document root.
              One work around is to set the context to AAA:
              weblogic.httpd.webApp.AAA=WebAppLocation
              And in the deployment descriptor (web.xml) to register all servlets
              with a BBB/ prepended to the desired alias:
              <servlet-mapping>
              <servlet-name>main</servlet-name>
              <url-pattern>BBB/main.jsp</url-pattern>
              </servlet-mapping>
              But this solution does not work for me. Parts of the application refer
              the context root (AAA) and create URLs relative to that. These URLs
              will not have the BBB part. Searching for it in the code and replacing
              it is not desirable (we do not own the code). Does anyone have any
              suggestions?
              Thanks in advance,
              Musafir
              

    What you have done for changing the context root to "/" is all fine but it is important to know that there is a ROOT.war in the deploy folder of JBoss which by default gets bound to "/" context. You must be getting the error message like "Web mapping already exists for deployment" when you would be starting your JBoss server after changing your context root to "/". So either you can completely remove the ROOT.war from the deploy folder or change the context-root of ROOT.war by updating its web.xml like:
    <web-app>
    <display-name>Welcome to JBoss</display-name>
    <description>
    Welcome to JBoss
    </description>
    *<context-param>*
    *<param-name>context-root</param-name>*
    *<param-value>/jboss-root</param-value>*
    *</context-param>*
    <servlet>
    <servlet-name>Status Servlet</servlet-name>
    <servlet-class>org.jboss.web.tomcat.service.StatusServlet</servlet-class>
    </servlet>
    </web-app>
    and also update the jboss-web.xml of ROOT.war:
    <jboss-web>
    <security-domain>java:/jaas/jmx-console</security-domain>
    *<context-root>/jboss-root</context-root>*
    </jboss-web>
    I hope this serves your purpose.
    There can be a workaround also by modifying the index.html of ROOT.war in the deploy folder of your server and redirect request to your web application using meta refresh like:
    <meta http-equiv="refresh" content="0;URL='/store'">

  • How do I get clipping paths to work in PhotoShop CS5?

    I've always used clipping paths to pull-out parts of images that I then save as eps files and bring into other images.
    For some reason, I can't get CS5 PS to capture only the path I created, instead it continues to capture the entire image.
    I normally create a path with the pen tool, save the path, identify it with the Clipping Path from the dropdown, then save out as an EPS. Has worked thousands of times for me in previous versions of PhotoShop, but not with CS5.
    Anyone else encounter this problem or have a solution?

    Ok, I did that but it's still reacting the same way. So I need to start from scrtach and build a new path? That can't b
    e. When I make the change and hit selection I am still getting an inverted selection. See.

  • How do I get file paths when hovering over a file name in Mountain Lion?

    In Snow Leopard I used to be able to hover over any file name and immediately get a file path in a small yellow window. What has happened to this feature in Mountain Lion?

    arthur, thanks for the path bar tip. That is what I needed. Solved the problem.
    I don't know what has happened to the yellow window that would appear if you hovered over any file showing the path of the file. It was simple to see the path with this window that appeared and disappeared if you moved the cursor.

  • How I can get current path during a java app running?

    I want to know the running path of the java app is running.
    do me a favor

    Syestm.getProperty(String Key)
    The requires key somethig like "path", or "user.path", not sure. See Javadoc to find the key you need.
    Abraham

  • How can I get the server absolute path of virtual directory?

    Problem context:
    absolute path of my application at JRUN server is
    c:\testing
    nd url is
    http://kaspak/test
    ( kaspak is a machine local to server i-e client nd server r at same machine )
    I m uploading a file nd saving it at server.
    PROBLEM:
    server save my uploaded file at
    C:\Program Files\Allaire\JRun\servers\default
    [ a path where server is installed ]
    while I want to save it at directory
    c:\testing\uploadfiles
    How can I achieve this???
    waiting for quick reply..
    KasPak

    here is a function for which u said,
    protected void readAndSaveFile(MultipartInputStreamHandler in,
    String boundary,
    String filename,
    String contentType) throws IOException
    A utility method that reads a single part of the multipart request that represents a file, and saves the file to the given directory. A subclass can override this method for a better optimized or differently behaved implementation.
    again saving a file, or uploading a file is no problem,
    but saving a file at our desired location,
    nd this can only be done if we know reall/absolute path of our application at server,
    i-e we need an API which can tells the absolute path of our application.
    e.g
    our application url is http://kaspak/testcode
    we need its absolute mapping to directory on server
    e.g it it is at c:\testcode
    if we get the absolute path then we can pass it in above function or in File class constructor.
    isn't it??
    I think in this way i can save file at other location.
    But how i can get absolute path?????
    thanks for ur reply,
    nd waiting for ur reply again.
    wbw
    kaspak

  • Getting the context path in a jspx

    Greetings
    i have in a JSP this code
    <div id="footerpartners"><img src="<%=request.getContextPath()%>/images/aval.png" width="68" height="26" /><img src="<%=request.getContextPath()%>/images/ath.png" width="79" height="26" /><img src="<%=request.getContextPath()%>/images/ciudad_empresarial.png" width="133" height="26" /><img src="<%=request.getContextPath()%>/images/corficolombiana.png" width="140" height="26" /><img src="<%=request.getContextPath()%>/images/superfinanciera.png" width="181" height="26" /><img src="<%=request.getContextPath()%>/images/verisign.png" width="72" height="26" /></div>
    and this JSP is being include in a JSPX, when loading the JSPX in my browser i am getting this error
    Error de OracleJSP: oracle.jsp.parse.JavaCodeException:Line 3, oracle.jsp.parse.JspParseTagExpression@190fd9b
    Error: Java code in jsp source files is not allowed in ojsp.next mod
    i believe it is because of the contextPath request....................how can i get it in a jspx

    resolved at Getting context path in a jspx

  • Getting the path of  a resource file inside the context

    I am trying to migrate some of our applications running on OracleApplicaiton Server. We have data resource xml file needs to use in the applicaiton. In Oracle Application server we used to give the actual path of the xml file to load the xml file to the parsers since we know the path of the directories after deploying the application as an ear file. How can I get the path of the files in weblogic after deployment. If this is not supported what is the alternative to get the relative path of that xml file to load in ? The xml file is in the root folder of the context.
    THanks
    Suneesh

    Hi Suneesh,
    Please try enabling the <show-archived-real-path-enabled> Tag to TRUE ...And then everything will work fine with the following code:
    context.getRealPath()
    At domain level in config.xml. For example:
    <web-app-container>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
    </web-app-container>
    *****OR *****
    At the web app level in weblogic.xml. For example:
    <container-descriptor>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
    </container-descriptor>
    For Archived Applications , It is always a best practice to use the getResourceAsStream() rather than using getResource().......Below code snippet should workout in 99% cases
    InputStream stream=this.getClass().getClassLoader().getResourceAsStream("someXMLorPropfile.properties");
    Thanks
    Jay SenSharma
    http://middlewaremagic.com/weblogic/?p=408  (Middleware Magic is Here)

Maybe you are looking for

  • ITunes 10.2.1 wiped out everything

    Hey! Automatically installed the 10.2.1 update last night. Opened iTunes this morning and guess what? No music, no podcasts, no nothing at all. Looking in my music folder in my home folder, seems like everything has been deleted. The album artwork an

  • Filevault doesn't work systemwide. Returns -25300

    Filevault Problem FileVault process interrupted. Doesn't work anymore systemwide. Returns in console in up-to-date OSX 10.4.8 loginwindow[5924]: SecFileVaultCreate returned -25300 Description I can't activate FileVault anymore from any account. I ran

  • Photoshop CC Color Issues

    When I updated my Photoshop program two updates ago I began having color issues in Photoshop as the rest of the Adobe Suite.  Regardless of whether the color mode is RGB or CMYK the colors appear washed out on the program.  This image http://i.imgur.

  • I can't move files to trash

    I can't move files to the trash without the finder wanting an administrator password and then the file is immediately deleted.  This just strarted a few days ago.

  • How to become a SUMO developer / contributor / supporter

    Very simply, I'm an EE/CE with TONS of experience in the industry. I would like to determine if you are looking for developers / contributors / supporters. How does one do this? Where do I make the request? I ask because of the feedback I'm hearing i