JSP Linking in javascript

Hi,
I have downloaded the masthead portal archive and imported it into my NDS. I have added a couple of extra jsps and a javascript file. What I'm trying to do is have a popup window launch from my first jsp to hold my 2nd jsp via javascript. e.g.
The javascript calls: window.open("FFDialog.jsp","Dialog","width:200px;height:100px;toolbar:no;directories:no;status:no;menubar:no;scrollbars:no;resizable:no;modal:yes");
The popup opens, but doesn't contain my jsp (which is really just a basic html/js file).
I think its because my jsp sits under dist->PORTAL-INF->jsp and the javascript under dist->scripts hence FFDialog.jsp isn't in the same location. What needs to be the path in my window.open?
Cheers!

Hi Jo,
         In your jsp ,from where you are calling javascript function to call other jsp, write below code
         to get the app path.
<%String webpath = componentRequest.getWebResourcePath()+"/"; %>
        Now the variable have the root path for your application , So suppose your 2nd jsp page is
inside a director called jsp so now you use:-
window.open("<%=webpath%>jsp/FFDialog.jsp", "Dialog","width:200px;height:100px;
toolbar:no;directories:no;status:no;menubar:no;scrollbars:no;resizable:no;modal:yes");
       Same way if you have your css file inside a directory called css use below code:-
<LINK href="<%=webpath%>css/style1.css" type=text/css rel=stylesheet>
    Regards,
    Piyush

Similar Messages

  • How to pass an array which in the jsp to a javascript file

    now i have 2 files: jsp and js(javascript)
    i want pass an array which in the jsp to another file--> js file
    how can i do it ???
    can u give me some related links or some source codes as the references???
    thx

    bcos ....my senior has resigned!!! so i take over his job !!!!!
    depend on the talent and the project ....only that way to implement to whole project !!!!
    but , i had settled it already ....
    it is very simple
    in the middle.jsp
    Collection result = menuManager.getUserRoleMenu(webSessionUser.getGnuserId());
    String menuname[]=new String[110];
    int menucounter=0;
    Iterator vi = result.iterator();
    while(vi.hasNext())
    HashMap hm=(HashMap)vi.next();
    menuname[menucounter]=hm.toString();
    menucounter++;
    int i;
    String tempstr="";
    for(i=0;i<menuname.length;i++)
    tempstr+=menuname[i]+",";
    session.setAttribute("menuname",tempstr);
    %>
    <script language="javascript">
    menu123("<%=tempstr %>");
    </script>
    in the body,js
    function menu123(string123)
    //doing
    so ....through the script --menu123
    i can get the string from jsp to the js!!!!!
    is it very simple, but it spends my 2 days!!!
    i just learn javascript ....about 1 month !!!

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • Passing jsp variable into javascript.....

    Hai friends,
    Look this code.....
    var mywindow= window.open( ......)
    mywindow.<%= loc%>.style.visibility = "hidden";     
    loc is my jsp variable passing dyanamically to the script....
    But it is not taking....
    when i assign jsp var into javascript like
    mywindow.somehardcodedvalue.style.visibility = <%= loc%>;     
    it is working fine ....
    pl reply me.......

    Hi,
    It is not working.My code is like....
    String loc=(String)arrStr;
    %>
    <script language="JavaScript" type="text/JavaScript">
    mywindow.<%= loc%>.style.visibility = "hidden";     
    </script>
    <%

  • Create link using javascript or other relevant automated process

    i have multiple PDF which i have combined using Acrobat pro... the table of content for this pdf does not have link as i had generated it in Word using RD fields. Now, my main concern is it possible to create links using Javascript or any other process.. i am aware of link tool however my document is very huge and the TOC comprises of around 25 pages.. it will be very cumbersome to manually add for each topic and will be difficult to maintain as we keep updating the document content..i would really appreciate if any one could help me in this as i really stuck up in middle of project...

    thanks a ton for your prompt response..As i had mentioned earlier, i have around 13 sub documents. i have generated a table of contents for these document using RD fields in a seperate document and saved it as TOC.doc. As these are fields are referring to topic outside the current document, the links are not availabled in word.. i am not aware of any possible method in word to retrieve links for these topics just like how a standard TOC in word works. as i saw it PRO, there is an option to create link, i was wondering if there is any way i could automatically link these topics as in PDF, the topics are in the same document where as in WORD these are different documents.If you could suggest some work around, i would be glad

  • How to use JOptionPane in jsp, instead of javascript message alert box?

    HI,
    How to use JOptionPane in jsp,
    instead of javascript "message alert box"?
    I hate javascript,
    I'd like to only use java in jsp. don't use javascript.
    javascript is client side,
    jsp is server side. i know that.
    how to... instead of javascript box?
    how to use ... message box in webpage?
    don't use applet,,,, don't use javascript,,,
    hm...zzzZzz
    I hate javascript..T.T
    <SCRIPT language=JavaScript>
    alert("hate javascript");
    </SCRIPT>
    ===>>>>
    In this way,,
    JOptionPane.showOptionDialog(null,"I love java")
    I'd like to only use jsp and java and html...in webpage.
    don't use javascript....
    Why? don't sun provide message box in jsp, instead of javascrip box?
    Why?
    Edited by: seong-ki on Nov 4, 2007 8:38 PM

    Drugs are bad, m'kay?

  • How I detect in a dynamic website either PHP or CFM or JSP that cookies & javascript are enabled ?

    How I detect in a dynamic website either PHP or CFM or JSP that cookies & javascript are enabled ?

    You do that on the browser end using JavaScript. For cookies, simply establish session variables in PHP or whatever you use. if the browser refuses them, they wil lreturn a respective value in the referrers...
    Mylenium

  • JSP variable in javascript

    Can I use a jsp variable in javascript? If so, how? It would be used in an "if" statement:
    function get This() {
    if (document.form.tfName.checked==true) || (<%jsp>) {
      then do this...}
    }

    My problem is I am grabbing a persistant value from a
    value object: the value of a checkbox as
    <%=InformationVO.isChecked()%>If (==true) i want javascript to enable a button on
    load. If not disable it. Plus I hav javascript on
    the page that controls this while the page is open.
    Just don't know how to incorporate the two scenarios
    s for:
    1.checking the value to ernable/disable the sumbit on
    load with the value of the VO
    2. using javascript to control the enable/disable
    while page is laodedYou want something like this?
    <%
    boolean enableButton = InformationVO.isChecked();
    %>
    <html>
    <head>
    <script language="javascript">
    // load event, enables or displables button depending on the InformationVO.isChecked value.
    function doMyLoadEvent(){
         if(<%=enableButton%>){
              // enable mySubmitButton object
         }else{
              // disable mySubmitButton object
    // submits the form
    function submitForm(){
         var frm = document.forms[0];
           frm.action = "path to your servlet goes here";
           frm.submit();     
    </script>
    </head>
    <body onload="javascript:doMyLoadEvent()">
    Woopdy doo!
    <form method="post" action="" name="">
    <input type="button" name="mySubmitButton" value="Submit" onclick="javascript:submitForm()">
    </form>
    </body>
    </html>

  • Calling jsp file from javascript function

    How can i call a jsp file itself from javascript function written in it?

    I do not think you can invoke the current jsp directly using javascript.
    If the effect you are trying to achieve is to reload the page, then you could execute the servlet / code which called the current jsp.

  • Call jsp function in javascript without using Applet

    anyone knows how to call jsp function in javascript .
    just as follows:
    <%!
    public string jspcall()
    return new String("just a example");
    %>
    <script language="javascript">
    <!--
    temp = jspcall();
    //->
    </script>
    it's desn't work.
    any suggestion will help!

    it's was not able to call a jsp function in javascript.
    jsp function was on server site while javascript normally on the client site.

  • How jsp to use javascript's variable??

    Hi, how jsp to use javascript's variable or a jsp's variable can be assigned a value in the javascript??
    thx

    well i havent accessed the value of javascript variable in jsp
    yet but i have accessed the value of a java variable in java script
    try it
    <script ...>
    function jspToJavaScript(a){
    alert(a);
    </script>
    <%
    int a=10;
    %>
    <img src="..." onClick="jspToJavaScript(<%=a%>)">

  • Assiging jsp values to javascript variables

    Hai all,
    I am working in WebSphere Application Developer Tool, My requirement is to assign a JSP value to javascript variable, I tried this by using this code but it is not working.
    <script language="javascript">
    var date = "<%=date%>";
    </script>
    Can any of you please let me know the way to do this
    Thanks in Advance
    Suresh

    I tried that
    what I am getting in alert box is(<%=date%>)
    and I also I am sure my jsp variable has the value when the page gets loaded, When I tried this code in Tomcat sometime back this was working, but now it is not working in WEBSphereApplication Developer that's why I mentioned, Is that anything specific we need to do for this
    please let me know
    Thanks in Advance
    Suresh

  • Open link with javascript via UIButton - Amazon widget

    Hi guys,
    I'd like to offer links to products on Amazon using the Amazon associates program, but all the links require Javascript and I dont really want to add a UIWebView just for this. Is such a thing possible?
    I'm wondering if its possible to open a link via a UIButton like this:
    [[UIApplication sharedApplication] openURL:[[NSURL alloc] initWithString:@"http://www.example.com"]];
    BUT via using an included javascript file, i.e. to make a link like the following but with a UIButton:
    <SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&MarketPlace=US&ID=V 20070822/US/imfoip-20/8005/6f95d841-8a9f-4e00-9bbc-db692d4cf04f"> </SCRIPT> <NOSCRIPT>Amazon.com Widgets</NOSCRIPT>
    My favorite hero
    Thanks

    Captivate 8 introduced the common JavaScript API which gets and sets Captivate variables for both SWF and HTML5 output in the same way.  You can read more about that here:
    https://helpx.adobe.com/captivate/using/common-js-interface.html
    Another great thing about Captivate 8, is that they exposed Captivate events to JavaScript.  So, for example, you can listen for when a user submits a quiz question and execute your own JavaScript when that submit event occurs.  Not only can you listen for this event, you also get information sent to you about that event... like what the correct answer was vs. what the student chose.  What I'd recommend is that you subscribe to the following events:
    CPAPI_QUESTIONSUBMIT
    CPAPI_INTERACTIVEITEMSUBMIT
    The event data sent back from the event will give you the information you need.  Download the sample project from the article to find out how to subscribe to these events.

  • Can I submit a jsp link to provide the XML feed from a dabase?

    Will a .jsp file that querries our database to provide formatted & tagged iTunes XML be allowed as a valid podcast link through iTunes? We are trying to provide our clients with multiple-title XMLs. This would be a great way for us to manage/schedule the data. Are there any alternative methodologies for database-driven XML that iTunes can accept? I think we can do .php as well.
    Thanks in advance.

    Throw this open to the community to chip in, but off the top of my head.... thinking of something along lines of:
    Create 3 web apps,
    Product (Fields Product Name & ProductID)
    Zipcode (Fields Area Desc & Zipcode)
    Freight Rates (Fields FreightRateID (made up of ProductID_ZipCode), Freight Rate)
    Create a web app search form for Web App Freight Rates with:
    Product select, with options drawn from web app 1 using ProductID for value.
    Zipcode select, with options drawn from web app 2 using Zipcode for value.
    Hidden FreightRateID field.
    Once a visitor has selected their product and zipcode, using javascript concatenate the selected ProductID with selected Zipcode.
    This will produce a FreightRateID (e.g. PROD1_4567), which can be loaded into the hidden FreightRateID field.
    When submitted, it will perform a web app search for a Freight Rate that matches the chosen product and zipcode, ie. FreightRateID.
    To make entry of the freight rates easier, maybe add 2 datasource fields to the Freight Rate web app for Product and Zipcode.
    Then create a front end web app add/edit (via a secure zone) to allow entry to be done by:
    Select product, select zipcode then enter freight rate.  (FreightRateID can be created and populated in same way as search above)

  • Jsp page calls javascript to be displayed in html page

    I want to test if user is logged in or logged out and put the logic of it on the header of my static html page (tomcat, apache)
    I would put .js code like this in my html header:
    document.getElementById("test").innerHTML= '<a href="/login.jsp>Login</a>
    And if user is logged in then put link to LOGOUT dynamicaly.
    I am using JSP page to check for logic login/logout:
    <c:if test=${!empty user">
    <p><a href="/logout">Logout</a>
    How do I implement following: call to the javascript from this JSP page to display on my html page (header) .
    I am not to use jsp on my html pages thus this workaround

    double post

Maybe you are looking for