Set jsp from javascript

I have three "div" tags in index.jsp ,
<div id='header'></div>
<div id='body'></div>
<div id='footer'></div>
Now when window is loaded i want other jsp page to be set in the "body" div tag of index.jsp from javascript
My javascript code
function invokeJSP(){
document.getElementById('body').innerHTML="<jsp:include page='test.jsp'>'";
when I am including this code in <head > part of index.jsp its working the problem is if at all
In test.jsp
if i try to include this line
<% = request.getParameter("name")%>
its giving an error like "unterminated literal string" in javascript console
Can anyone help me how to set the jsp from javascript
Sorry for my bad english.This is the first time I am posting the forum
thanks
hema

hi
Thanks for the response
but i have closed the tag in my program. Have u ever tried to invoke jsp from javascript in this way if it works plz help me.
thanks hema

Similar Messages

  • Set preferences from Javascript

    Can preferences be set from a folder-level or document-level Javascript in Acrobat Pro 7 and 8?
    In particular, I am interested in toggling on "Display PDF in browser" and "Use local fonts".
    Alternatively, can JS read these settings, so that a suitable warning can be displayed?
    Thanks,
    Bruce

    Bruce,
      Were you able to address the issue here.. setPreference through JS (HTML).... our corporate policy is enforce opening PDF in new window but our application needs to open PDF in the same browser...... but the links need to open in new window.
    Thanks for your response..
    - K

  • Set Stroke Alignment from JavaScript

    Hi,
    I'm trying to set the stroke style for a path item I've drawn through JavaScript, however I can't find a way to set the stroke alignment for my path item.
    I've checked the Illustrator JavaScript reference but I can't seem to find that option in there.
    I would expect something like:
    pathItem.strokeAlignment = StrokeAlignment.OUTSIDE; // This doesn't work, what is the correct way to set the stroke alignment from JavaScript?
    If I change the option in the Actions Panel it comes up as 'Set Stroke/Alignment: Outside', so there must be an equivalent way of setting it from JavaScript.
    Is there a way of converting Actions to JavaScript so you can see which properties and attributes are being set on the object?
    Does anyone know the correct way to set the strok alignment from JavaScript?
    Thanks!

    You can only call an action from JavaScript in CS6… (I don't have this). Up until then it was AppleScript and Visual Basic only…
    Document raster effects you do have access to…
    Class
    RasterEffectOptions
    The document raster effects settings.
    Class
    Property
    Type
    Access
    Description
    antiAliasing
    bool
    r/w
    Should the resulting image be antialiased. (default: false)
    clippingMask
    bool
    r/w
    Should a clipping mask be created for the resulting image. (default: false)
    colorModel
    RasterizationColorModel:
    RasterizationColorModel.DEFAULTCOLORMODEL
    RasterizationColorModel.GRAYSCALE
    RasterizationColorModel.BITMAP
    r/w
    The color model for the rasterization. (default: RasterizationColorModel.DEFAULTCOLORMODEL)
    convertSpotColors
    bool
    r/w
    Whether to convert all spot colors to process colors in the resulting image. (default: false)
    padding
    number
    r/w
    The amount of white space (in points) to be added around the object during rasterization. (default: 0)
    resolution
    number (range: 72.0 - 2400.0)
    r/w
    The rasterization resolution in dots-per-inch (dpi) (default: 300)
    transparency
    bool
    r/w
    Should the resulting image use transparency. (default: false)

  • Set jsp variable in javascript

    I have a simple question.
    I have a section in jsp as below
    <%!
    String initial = "true";
    %>
    Can I set the "initial" parameter in javascript function in the same jsp like below?
    function init() {
    <%! initial = "true"; %>
    If not, would you please give me the syntax to do it?
    Thanks in advance,
    Mustafa

    the jsp scriptlet code, everything in between your <% ... %> marks, is compiled on the server.
    the javascript code is run on the client.
    therefore, you can NOT edit the scriptlet code from javascript. it cannot be done.
    you CAN however edit your javascript code with the jsp scriplet. see the below example, which shows me setting a javascript variable based on some scriplet code...
    <% String name = "Joe Schmoe"; %>
    <script>
    function doSomething() {
    var something = '<%= name %>';
    </script>
    When that page is rendered it will look like this...
    <script>
    function doSomething() {
    var something = 'Joe Schmoe';
    </script>

  • How can I access xml document from javascript whithin a JSP page

    how can I access xml document from javascript whithin a JSP page?
    I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
    Thanks in advance!

    The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
    It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation.

  • In jsp how to extract the value from a name obtained from javascript?

    It's few time i program in Java and i'm involved in an application that uses javascript to communicate between pages. I've the follow problem: in my jsp page i must process a string, but this string is produced from a javascript function. But in jsp, out of javascript function, how can i access to the value of that string of which i see from Javascript only its name?

    My string is already in a form, but i have not the request because data transmission happens through javascript: i've tried to write
    request.getParameter("StringName")
    and i've not found compilation mistakes but in execution the application gives error (maybe it doesn't find the request in the caller page)

  • Newbie qs. how to find duration or set position (in time) of a flash movie from Javascript?

    I am trying to control the Flash player browser plugin from
    Javascript.
    - I need to set the start position to play, based on time.
    example, setPosition(10 seconds)
    However I notice that the flash player API is based upon
    number of frames.
    for example, the methods TotalFrames() and GotoFrame() are
    based on frame number.
    How do I convert it to time? I don't see a frame rate
    variable.
    I don't see a call to access this - but the duration of a
    clip is always shown near the slider
    - can I also query the duration from the player?
    - I also need a callback into my Javascript object when an
    event occurs - for example,
    when the player stops playing because it is stopped by the
    user. Should work on earlier versions than Flash 8.
    Any help appreciated.
    thanks,
    Anil

    no replies?

  • Keep getting a message from Javascript (not Java)- "Uninstall Set", help it will not go away

    Each time I use Firefox, the message "Uninstall Set" keep popping up from Javascript (not Java). I can not use Firefox because this keeps popping up.

    That would be from an extension, anything similar from Firefox would have been cleaned up. If you'd been on 4.0.1 for a while and it just started happening, then I'd try Tools > Add-ons > Extensions then on the gear wheel choose "View Recent Updates" the date will appear the list small and the. The "last updated" button near top right does something mysterious.
    To see list in normal fashion again choose "Appearances" then return to "Extensions".
    If you dislike the formatting of the Add-ons list during normal viewing you can improve it tremendously with a custom style:
    * [https://addons.mozilla.org/firefox/addon/stylish/ Stylish :: Add-ons for Firefox]
    * [http://userstyles.org/styles/42112/firefox-4-compact-addons-manager Firefox 4 - Compact Addons Manager - Themes and Skins for browser - userstyles.org]
    From the wording the message could possible be referring to a Collection of Extensions. I avoid collection sets like the plague.
    Also see related answer
    * [https://support.mozilla.com/en-US/questions/824098 i keep getting a pop up saying uninstall set | Firefox Support Forum | Firefox Help] by Cor-el.

  • 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.

  • Set application item from javascript?

    Hi!
    Is it possible to set an APPLICATION ITEM from javascript? If so can some one please point me to the thread, or a FAQ or an example, etc?
    Thanks!
    Dave Venus

    dvenus1,
    Sure. In the script below I check variables and populate based on what I find...
    <script language="JavaScript" type="text/javascript">
    function Populate_fld()
    var formVehicle = document.getElementById('P9_HIDE_VEHICLE').value;
    var formState = document.getElementById('P9_HIDE_STATE').value;
    var formTag = document.getElementById('P9_HIDE_TAG').value;
    var formName = document.getElementById('P9_HIDE_NAME').value;
    document.getElementById("P9_VEHICLE").value = formVehicle;
    document.getElementById("P9_TAG").value = formTag;
    document.getElementById("P9_STATE").value = formState;
    document.getElementById("P9_VISITOR_NAME").value = formName;
    if (formState = " ")
    document.getElementById("P9_STATE").value = "FL";
    </script>
    Keep Smiling,
    Bob R

  • Calling a java static method from javascript

    I am running into issue while calling a java static method with a parameter from javascript. I am getting the following error. Any help is greatly appreciated.
    Thx
    An error occurred at line: 103 in the jsp file: /jnlpLaunch.jsp
    pfProjectId cannot be resolved to a variable
    =================================================
    // Java static method with one parameter
    <%!
    public static void CreateJnlpFile(String pfProjectId)
    %>
    //Script that calls java static method
    <script language="javascript" type="text/javascript">
    var pfProjectId = "proj1057";
    // Here I am calling java method
    <%CreateJnlpFile(pfProjectId);%>
    </script>
    ===================================================
    Edited by: 878645 on Mar 6, 2012 11:30 PM

    Thanks, Got what you are telling. Right now I have one jsp file which is setting the parameter 'pfProjectId' and in another .jsp I am retrieving it. But I am getting null valuue
    for the variable. I am wondering why I am getting null value in the second jsp page?.
    Thx
    ====================================================================
    <script language="javascript" type="text/javascript">
    // Setting parameter pfProjectId
    var pfProjectId = "proj1057";
    request.setParameter("pfProjectId", "pfProjectId");
    </script>
    // Using Button post to call a .jsp that creates jnlp file
    <form method=post action="CreateJnlpFile.jsp">
    <input type="submit" value="Create JNLP File">
    </form>
    //Contents of second .jsp file CreateJNLPFile.jsp
    String pfProjectId = request.getParameter("pfProjectId ");
    System.out.println( "In CreateJnlpFile.jsp pfProjectId " + pfProjectId );
    =======================================================

  • How to call jpf controller method from javascript

    Can any one help me how to call pageflow controller method from JavaScript.\
    Thanks.

    Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
    1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
    document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
    document.getElementById("batchForm").submit;
    2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
    document.getElementById("ACTION_NAME").value = "UPDATE";
    document.getElementById("batchForm").submit.
    Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
    3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
    This entire lines of code should do what we want.
    <netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>                    
    <netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
    <c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
    <%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
    <netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
    </c:forEach>               
    </netui:select>
    See if you can build along those above lines of code. Any other simpler approches are highly welcome.
    Thanks
    Ravi Jegga

  • Adding items to a selectOneListbox from Javascript

    In my JSF page I have...
    <h:form id="alternateDeviceSelectForm">
        <h:selectOneListbox id="selectBox"/>
        <h:commandButton id="okButton" value="#{i18n.ok}" action="#{aBean.anActionMethod}"/>
    </h:form>I also have this Javascript...
    for (var i=0; i < devices.length; i++) {
        var device = devices;
    // a String
    var id = device.getId();
    // another String
    var displayName = device.getDisplayName();
    this.selectBox.options[i] = new Option(displayName,id);
    This creates the listbox and when the Javascript method fires, the appropriate items are listed in as list items.  However, when I hit the OK button, I get a JSF message about a validation error.  I'm not using any custom validation at all.
    Here's the error message I get... "alternateDeviceSelectForm:selectBox: Validation Error: Value is not valid"
    Any ideas on how I can get this working?  (I have to get the listbox item values from Javascript because that is the interface to a browser plugin that is involved in this process.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    dalearyous wrote:
    the only thing is there is no data to begin with. after you choose the data structure there is a text field to type in something like apple and then you click add. then you can type in something like pear and click add.If you do it right, the part that controls the data structures won't need to directly interact with the part that adds/removes the elements in the data structures -- they'll be independent units. That's what we call "orthogonal", and it helps make programs much easier to develop and maintain. To do that, you have a common set of add/remove operations across all data structures -- just like in the Collections framework, which you should use unless your teacher is telling you that you must make your own. (And even if you do, ask your teacher if you can use the interfaces from the Collections framework, if not the implementations.)
    The example I showed you supports that, in that it doesn't assume that the data structures initially contain any data. (Though it might be better to create empty Collections in your constructor, rather than ever letting existingCollection go null.

  • How to get a value from JavaScript

    How to get return value from Java Script and catch it in c++ code. I have tried following code, but its not working in my case.
    what I want is if it returns true then call some function if it returns false then do nothing, so how to get those values in c++
    ScriptData::ScriptDataType fDataType = resultData.GetType();
    if (fDataType == kTrue)
           CAlert::InformationAlert("sucess");
           //call some function
                        else
                                  CAlert::InformationAlert("Error");
         // do nothing
    JavaScript Code:
        if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
               alert(value);
                return true;
      else
               alert ("SORRY");
               return false;

    How to get java script result into JSResult i m not getting it.
    I have wriiten follwing code in c++ :
              WideString scriptPath("\\InDesign\\Source1.jsx");
              IDFile scriptFile(scriptPath);
              InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
              if(scriptRunner)
                        ScriptRecordData arguments;
                        ScriptIDValuePair arg;
                        ScriptID aID;
                        ScriptData script(scriptFile);
                        ScriptData resultData;
                        PMString errorString;
                        KeyValuePair<ScriptID,ScriptData> ScriptIDValuePair(aID,script);
                        arguments.push_back(ScriptIDValuePair);
                        PMString paramkeyname1;
                        Utils<IScriptArgs>()->Save();
                        Utils<IScriptArgs>()->Set("paramkeyname1",scriptPath);
                        Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner,script,arguments,resultData,erro rString,kFalse);
                        Utils<IScriptArgs>()->Restore();
                        ScriptData::ScriptDataType fDataType = resultData.GetType(); // here i should get true or false which i m passing it from javascript code......not as s_boolean
                        if (fDataType == kTrue)
                                       //CAlert::InformationAlert("sucess");
                                     iOrigActionComponent->DoAction(ac, actionID, mousePoint, widget);
                        else
                                    this->PreProcess(PMString(kCstAFltAboutBoxStringKey));
    Java script code:
    function main()
           var scrpt_var;
           var scriptPath,scrptMsg;
           var frntDoc=app.documents[0];
           if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
                alert(value);
                 return true; // i want this value i should get in c++ code...How to get these values in c++
           else
              alert ("Error");
              return false; // i want this value i should get in c++ code...How to get these values in c++

  • File Not found error when calling Form Post Method to a JSP from JSP Portlet

    I have built a set of JSP forms using post method to call other JSPs. Normally, the code looks like
    <form name="MyForm" action="MyJsp.jsp" method="post">
    I migrated the calling form containing this code to a portlet, but not the MyJsp.jsp. When I submit the form, I get a file not found in Jserv.log
    Exception:javax.servlet.ServletException: java.io.FileNotFoundException: D:\servlet\RegisterCompany.jsp (The system cannot find the file specified)
    [14/06/2001 13:59:59:679 PDT] JspServlet: unable to dispatch to requested page: Exception:javax.servlet.ServletException: java.io.FileNotFoundException: d:\oracle\isuites\apache\apache\MyJsp.jsp (The system cannot find the file specified)
    I notice that launching the calling jsp from a portlet, my opriginal context that uses ../Apache/Apache/htdocs is not being searched for the JSp. Why is this? Moreover, I try to set up an Alias in httpd.conf file to the this director and use it with the jsp in the action tag, but still get an error that my jsp servlets/Myjsp can't be found. Why is it insiting on looking at servlets context instead of htdocs.
    I have none of these issues outside of Portal30 using IAS.
    regard

    Initially, I couldn't do this unless I moved tghe jsp's up to the root directory of IAS, i.e ../Apache/Apache. Nomrally, htdocs is my doc directory for IAS. I could not do http:\\myUrl\htdocs\myJsp. If I tgried this, I got an error in Apache error logg that said can't find file ..\htdocs\htdocs\MyJsp.jsp.
    If I just tried the the URL http:\\myUrl\MyJsp.jsp with Jsp file in htdocs, I would get an error in the Jserve log that file d:\oracle\isuites\apache\apache\MyJsp.jsp could not be found. Once I moved the file MyJsp to Apache/Apache directory, it could be found using http:\\myUrl\MyJsp.jsp. Later, I delted these files and kept the ones in htdocs and they continued to work.
    I'm confused why launching pages through portal isn't consistant with Apache Standards. Where is the documentation that tells me how to configure context and aliases for pages launched from portal pages?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Sue Vickers ([email protected]):
    David,
    Passing information using Portal is different than just using Apache/Jserv. Does it work in portal if you use the absolute path?
    <form name="MyForm" action="http://host.domain/MyJSP.jsp" method="post">
    Portal will not be on the same relative path as your Apache, so you may need to adjust your action somehow.
    Thanks,
    Sue<HR></BLOCKQUOTE>
    null

Maybe you are looking for