Relating javascript and jsp

hi
i have one jsp file;in that i have written
<%
response.setContentType("application/ms-word");
%>
<script language="JavaScript">
document.write("ss")
</script>
i am able to see ms-word document but i couldnt see output ss on the word document;will jsp doesnt access javascript after calling response.setContentType(("application/ms-word")?;if i want to see ss on the word document thru javascript wat i have to do;
plzz help
chaitu

See http://forum.java.sun.com/thread.jsp?forum=45&thread=390559&tstart=0&trange=30

Similar Messages

  • Parameters b/w javascript and JSp

    how i can pass values between javascript and jsp .
    ( java script varaible in the JSP part & jsp object in the javascript code )

    Since Java script is on the client side , to get the value of a java script variable into jsp, u have to set some form field variable and submit it to the server again. So, it can be something like:
    <script>
    function submit()
         var scriptVar = 12;
         document.form1.formVariable.value=scriptVar;
         document.form1.submit();
    </script>
    <%
    System.out.println("Script variable value = " +request.getParameter("formVariable"));
    %>
    <form name="form1" method="post">
    <input type="hidden" name="formVariable" value=""/>
    <input type="button" name="bSubmit" value="Submit" onclick="javascript:submit()" />
    </form>
    The first time this jsp is called, the value of formVariable will be null.
    The next time, when u click on submit button, the value will be 12.
    I have not tested this. There might be some syntax errors. Just try it out. Also, make sure that u don't end up submitting the form in an infinite loop by using the submit() generally in the script. Hope this helps.

  • Mix JavaScript and JSP

    Hi.
    I have jsp and javascript mixed when I click a check call a function javascript for example:
    //JavaScript
    function Hola(numerop) {
              idRol = Number(numerop)
              <%nombreRol = roles.get(numerop)%> }
    //Form
    <input type="checkbox" name="<%=roles.get(sum)%>" value="<%=roles.get(sum)%>" onClick="Hola('<%=roles.get(sum)%>')">
    In the function numerop is a number but in the jsp code numerop is undefined.
    How I can mixed javaScript and jsp??
    Please I need help you.

    Remember that the JSP runs on the server and generates the HTML, including Javascript. The Javascript runs on the browser after the JSP is finished. So you cannot do whatever it is you expected that to do.

  • Problem in JavaScript and JSP

    Hello all, I have a problem. I am using a file upload box in my JSP page.
    And I want to put some validations on the input of that file - see if it exists, check its size, or may be its type. I tried to use ActiveXObject in the JavaScript but it gives an error - ActiveXObject is not defined. Is not allowed to use ActiveX object in JavaScript. if not then where can we use such an object. I used such a FileSystemObject in VbScript, but that too was a independent running scripts like .vbs file. Can anybody help?

    Use of ActiveX object is strongly discouraged, however
    Check if this solution solves your problem
    Inorder to use ActiveX Objects ,check whether ActiveX object s are enabled in IE.
    Goto IE>Internet Options>Security Tab>click button Custom level>
         scroll to 'Run ActiveX controls and plug-ins'>select �enable�.
         also enable "Initialize and script ActiveX control not marked as safe."

  • Again combining javascript and jsp

    can i do the post methode of a form inner a javascript function?
    i want first check whether the reqiered fileds r filled and the do the post action.
    Andre

    Yeah that is really quite simple....
    function FormValidation()
    //do Validation stuff here
    document.MyForm.submit;
    <HTML><BODY>
    <input type=submit name=submit value="Submit
    onclick = "FormValidation(); return false;">
    The return false will cancel the submit action.
    null

  • Javascript and jsp forms

    Hi,
    I have the following java code what I am trying to do is to use some java script to read values from the buttons. As per my thinking the javascript code when called should print out the no of radio buttons but what it is giving is undefined. Could somebody point out what I ma doing wrong???????
    Its already drawing me crazy.
    <dsp:form name="students" action="../../check.jsp" method="post">
                <P>books  </P>
          <INPUT type="radio" name="books" value="Java2InANutShell">
                                   Java 2 in a nutshell
                          </INPUT>
                          <br><br>
         <input type="button" value="Length" id="length"      name="Log In"  onclick="launchAutoWindow()"/>
    </dsp:form>
    function launchAutoWindow(id)
    alert(document.students.books.length);
    }

    You only have one radio with the name of "books" on
    the page.
    If you have only one, "document.students.books"
    evaluates directly to the radio object
    If there is more than one object with that name, it
    evaluates to an array of the objects. At that point,
    length would be defined.
    So if length is not defined, you know you only have
    one :-)
    Don't you just love javascript?Thanx mate. That solved the problem. I would have never figured it out myself. Thats kindaa silly but as long as it works ;)
    Thanx again.

  • Embed javascript in JSP

    hi
    i want to store the query string of an URL in a flat file. but i want to append the name of the person who's passing the query string by prompting him to enter his/her name. i have a code something like this
    FileWriter outputFile = new FileWriter("Libset1.txt", true);
    BufferedWriter outputBuffer= new BufferedWriter(outputFile);
    final PrintWriter outputWriter = new PrintWriter(outputBuffer);
    //writes all data to the output file
    for (int i=0; i<Selected_set1.length; i++)
    outputWriter.println("some javascript to prompt the user goes here..." + Selected_set1);
    outputWriter.close(); //closes output file
    i want to embed some javascript in place "some javascript to prompt the user goes here..." prompting the user to enter his name..
    is it possible to do that. if yes, how.?
    sorry i'm just a beginner, it might look silly for you...please help...
    thanks in advance..

    First of all, you need to understand how Javascript and JSP work together....they don't. Javascript is a client side scripting language, which means that it executes and runs in the client browser after the page has been loaded. JSP is purely server side, it only runs while the request is being serviced, or while it's generating the HTML to send back to the client browser.
    To do what you're asking for should be pretty easy using javascript. You should be able to use the Javascript onClick() event for the link the user is clicking on to execute a Javascript method that prompts the user for their name.
    You might try something like this...
    <script language="JavaScript">
    function promptUser(newPage)
      var username = prompt("Please enter your username");
      if(username)
        document.location = newPage + "&username=" + username;
    }</script>
    Click Here Please!
    This will result in a query string that looks something like mypage.jsp?id=23&view=whatever&username=john
    Make sense?

  • Problem with include and relative path in jsp

    Precompile jsp with wlappc in 9.2, I got the error "The include file was not found" when the jsp use <%@ include file="../includes/dataEntry/code_error.html" %>
              This code used to work with 8.1. I notice that someone has report the same problem with 9.0 and you have patch for it. Is it fix in 9.2 or do I require a patch as well?
              Thanks,
              Khuemy

    When you precompile, can you say "Keepgenerated=TRUE". It might help you track
              down the difference with the URL. You should only get a 404 error when the
              resource is not found at runtime, which is independant of when you compile. The
              difference should be in how the URL is compiled.
              Chris
              ali wrote:
              > I am using WLS 6.0 SP1, when I use relative path in <jsp:forward> in my JSPs
              > it forwards ok if I am using directly JSPs but if I am using pre-compiled
              > JSPs (and have proper servlet-mappings
              > in my web.xml), I get 404 error with the relative-path, if I change it to
              > absolute path with pre-compiled JSPs it forwards ok , then.
              > any ideas why this is so?
              > thanks,
              

  • WL vs. WL-express and JSP vs. javascript/SQL

    folks-
    i am trying to convince a certain party to
    disband a web-based job tracking system being
    written in ASP, javascript, html, css and SQL.
    it will be hosted on MS webserver running NT.
    i am trying to convince them to use JSP and
    WL express. i have done two years of EJB
    component work on weblogic, however, i have not
    done work with JSP or thin-clients. i was mostly
    business-logic.
    anyway i have some questions and need some
    direction. i already know JSP is better than
    ASP/javascript etc. because:
    * ASP is proprietary. ditto for VBscript
    * with an IDE creating JSP is easy and JSP
    automatically creates servlets which is way
    faster than by hand
    * JSP is JAVA based and hence benefits from
    all the portability pluses of JAVA
    but here are the more difficult questions:
    * why is WL express better than an MS
    web server? (not including WL market share
    and size. after all MS can claim that)
    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?

    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    Use JDO or an OR-mapper or embed JDBC into your own data access classes.
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    Presentation=JSP
    Logic=Servlet
    Data access=JDO or similar
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    You should be able to tell up front if it a tx-intensive app that requires
    WLS.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    They aren't exclusive. For dynamic pages, use Javascript on the front end,
    JSP on the back.
    * with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?
    In the real world, and for most apps, while Java has the architectural edge,
    they both have similar scalability and similar robustness. MS gives you no
    choice though, and you rewrite every time they see a new buzzword. You can't
    leave MS-land without abandoning almost everything. You can leave WLS in a
    week if you have to.
    It's an investment. Invest wisely.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "shane miller" <[email protected]> wrote in message
    news:[email protected]...
    folks-
    i am trying to convince a certain party to
    disband a web-based job tracking system being
    written in ASP, javascript, html, css and SQL.
    it will be hosted on MS webserver running NT.
    i am trying to convince them to use JSP and
    WL express. i have done two years of EJB
    component work on weblogic, however, i have not
    done work with JSP or thin-clients. i was mostly
    business-logic.
    anyway i have some questions and need some
    direction. i already know JSP is better than
    ASP/javascript etc. because:
    * ASP is proprietary. ditto for VBscript
    * with an IDE creating JSP is easy and JSP
    automatically creates servlets which is way
    faster than by hand
    * JSP is JAVA based and hence benefits from
    all the portability pluses of JAVA
    but here are the more difficult questions:
    * why is WL express better than an MS
    web server? (not including WL market share
    and size. after all MS can claim that)
    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?

  • EXPRESS and JSP relation

    have got some basic doubtd in IDM
    We have XML and JSPs how both r getting related in
    the sense Take Login Form --> Login.jsp how both
    are gettign related
    Suppose In form1 I am entering some data that data
    if I want to recieve in form 2 How to specify the
    action ?
    It seems elementary
    Thanks in Advance
    senthilRajan

    I'm not really sure I understand your question.
    Although it's probably generally true that a JSP file maps to an XML form, it's not always the case.
    Can you be more specific about what you are trying to do? Are form1 and form2 different forms that would be presented during the processing of a workflow? Are you referring to end user vs. and admin activity?
    Often it can be easier to use a single form that nests fields within fields that can be conditionally disabled. Thus, a single form can look like multiple different forms. Or you can use tabs in the form spread fields out on multiple tabbed pages.
    Hope that helps,
    sbr

  • FORM and JSP in the same page

    Hello All
    Is it possible to pass variable from a html textbox to a JSP? but they both are in the same page.
    For this purpose, I have a created a index.html, which contain two frames, top.html and bottom.jsp. There is a textbox in the top.html, it collects 2 variables and use form action "POST" to call bottom.jsp to display a graph.
    However after I run this page on Tomcat, it gave me error message in the bottom.html:
    The server encountered an internal error () that prevented it from fulfilling this request.
    Can anyone teach me how to solve this problem? Thanks a lot
    Viola
    index.html
    ===============================
    (FRAME) top.html
    <form action="bottom.jsp" method="post">
    <input type="text" name="apple">
    <input type="text" name="orange">
    ===============================
    (FRAME) bottom.jsp
    String apple = request.getParameter("apple");
    String orange = request.getParameter("orange");
    use those two variables to do something
    and display a graph

    The problem is that both pages are loaded @ the same time so when the getParameter gets executed the parameters are null and this is the probable cause of your error. Another problem is the action in form will cause the bottom to go into tops frame and not have anything to do with the other frame. If you want data to go from one frame to another while the user still sees them look @ DHTML, JavaScript and IFrames.
    HTH,
    J.Clancey

  • How to find out the filename of javascript and pathname of javascript?

    I got the filename of javascript and pathname of javascript(not the active document file name) using the below code in illustrator cs3.
    var path = $.fileName;
    But my problem was if i run the javascript through "extendscript toolkit" i got it correctly. But if i run my script through illustrator cs3 application(File->Scripts->test.jsx) i got some integer value only(did not get the javascript filepath and filename). Kindly advice how to get the javascript file name and file path in windows platform through illustrator cs3 javascript. Please help me.

    I already have that extension, but I'm not sure which idx I need to look at. Also, I suppose that the numbers I'm looking for depend on places.history.expiration.transient_current_max_pages and therefore there is no way to get them relative to the installation of Firefox. My point is, I can see my history only up to 1 year, even though I have Firefox installed for 3 years. Correct me if I'm wrong.

  • Associating two events with submit button using  javascript in jsp

    Hi
    How can i Associate two events with submit button using javascript in jsp. Firstly it should insert the data to database and secondly it should close the same pop-up window

    Have something like :
    <input type="submit" name="submitbtn" value="Click me" onClick="function1(); function2(); " />
    You just call both functions sequentially, it's that simple. Although using javascript to work with a database, that seems a bit tricky.

  • Combo box in JavaScript and store the combo box values into database

    i am a developer, i have a task ie.. i have combo box in JavaScript and i have to store the combo box values into database through JavaServerPage..
    i please every one to have a look on this and please reply soon....

    dear sir,
    your suggestions are really greater the god.............
    i have applied as you said , now i am the page as updated and also i nform you that its multi select ....
    i will show the codings , then u will get a clear identification
    <script language= "JavaScript">
    <!--
    function one2two() {
        m1len = m1.length ;
        for ( i=0; i<m1len ; i++){
            if (m1.options.selected == true ) {
    m2len = m2.length;
    m2.options[m2len]= new Option(m1.options[i].text);
    for ( i = (m1len -1); i>=0; i--){
    if (m1.options[i].selected == true ) {
    m1.options[i] = null;
    function two2one() {
    m2len = m2.length ;
    for ( i=0; i<m2len ; i++){
    if (m2.options[i].selected == true ) {
    m1len = m1.length;
    m1.options[m1len]= new Option(m2.options[i].text);
    for ( i=(m2len-1); i>=0; i--) {
    if (m2.options[i].selected == true ) {
    m2.options[i] = null;
    //-->
    </script>
    <form method="POST" name="theForm" action="update.jsp">
    <table bgcolor="white" border="1" cellpadding="5" cellspacing="2" align="center">
    <tr><td align="center">
    <select id=menu1 size=10 multiple>
    <option>javascript</option>
    <option>php</option>
    <option>Zeo</option>
    <option>asp</option>
    <option>jsp</option>
    <option>ajax</option>
    <option>struts</option>
    </select>
    <p align="center"><input type="button" onClick="one2two()" value=" >> "></p>
    </td><td align="center">
    Languages you know:<BR>
    <SELECT NAME="language" multiple>
    <OPTION VALUE="c">C
    <OPTION VALUE="c++">C++
    </SELECT>
    <p align="center"><input type="button" onClick="two2one()" value=" << " ></p>
    </td></tr></table>
    <center><input type="submit" value="update"></center>
    </form>
    <h4><u>Back<h4>
    <script language= "JavaScript">
    var m1 = document.theForm.menu1;
    var m2 = document.theForm.language;
    </script>
    </body>
    </html>

  • Help me!! How to use JavaScript with JSP ??

    I am using JDeveloper and I created a screen in JSP which uses a bean for database connectivity and retriving info onto the page.
    The page has a ListBox where list items are populated from the database.My requirement is
    whenever the list is changed the page shuold be refreshed with the selected item info.
    I tried to use 'JavaScript' for triggering the event with 'onChange' event of the ListBox.But the event is not getting invoked. I think JavaScript is not working with JSP.
    Please help me with how to Use javaScript with JSP or any other alternative where I can meet my requirement.
    I have one more question...I have gone through the JSP samples in OTN and I am trying do download the sample 'Travel servlet' which show list of countries...etc
    I have also gone through the 'readme' but I don't know how to extract .jar file.
    I would be great if you could help me in this.
    Thanks!!
    Geeta
    null

    We have a similar need. We have used Cold Fusion to display data from Our Oracle Database. We have a simple SElect Box in HTML populated with the oracle data. When someone selects say the State of Pennsylvania. then we have an On change event that runs a Javascript to go get all the cities in Pennsylvania.
    Proble we are having is that inorder for the Javascript to work , we currently have to send all the valid data.
    Do you know of any way to dynamically query the the Oracle database in Javascript

Maybe you are looking for

  • Account access problem

    I woke up this morning hoping to download, like quite a few others on this board, the Red Hot Chilli Peppers new album. It seems that I have no account registered with iTunes. That's fine, I click on sign in next to account on the upper right hand of

  • PhotoShop CS2 installer issues...

    CS2 version 9.0.2 photoshop, cant get rid of this every time I open PS... any ideas? "The Adobe Updater could not be started.  Please reinstall the application and components."

  • Macbook pro 2012 charger.

    My macbook pro 2012 charger does not charge my computer anymore. No green light on the charger, nothing. Any ideas?

  • March 6th 08 Steve Jobs Keynote???

    Deggie said it is on the 6th! Is apple going to announce a al macbook? Or SDK??

  • Calendar Server 6.3 reminders - General Error: caldb: PR_GetHostByName fail

    Hello. Event Notification Server is not working on my old Calendar Server 6.3*. I'm getting a lot of errors like these every second: [29/Jan/2013:14:40:53 +0100] calendar1 csnotifyd[28556]: General Error: caldb: PR_GetHostByName failed Any thoughts?