OnBlur() function and JSP

Hello Everybody!
I'd like to knwo how can I use onBlur() function to make my SELECT form works without submit...
Pratically, I need that, when a use "blur" a voice in the firs SELECT form, the second SELECT change without making a submit.
The problem is that this JSP calls a Servlet that builds a bean, but the solution may be very simple, because I only need (if the user select a particular voice in the first SELECT) to inhibit the second and the third SELECT..
<form name="nuovo" action="TicketHandler" method="post">
<table >
<tr><td>
<b>Programma</b></td>
<td><select name="programma">
<%     dati_bean = bean.Dati_Programma_Ticket();          
     Iterator Idati_bean2 = dati_bean.iterator();
     while (Idati_bean2.hasNext()){
        SQLBean myBean = (SQLBean)Idati_bean2.next();           
          String programma = myBean.getParametro();
          %>
<option><%=programma%></option>
<%}
%>
</select></td></tr>
<tr><td>
<b>Relase</b></td>
<td><select name="relase">
<%     dati_bean = bean.Dati_Relase_Ticket();          
     Iterator Idati_bean3 = dati_bean.iterator();
     while (Idati_bean3.hasNext()){
        SQLBean myBean = (SQLBean)Idati_bean3.next();           
          String relase = myBean.getParametro();
          %>
<option><%=relase%></option>
<%}%>
</select></td></tr>
<tr><td>
<b>Modulo</b></td>
<td><select name="modulo">
<%     dati_bean = bean.Dati_Modulo_Ticket();          
     Iterator Idati_bean = dati_bean.iterator();
     while (Idati_bean.hasNext()){
        SQLBean myBean = (SQLBean)Idati_bean.next();           
          String modulo = myBean.getParametro();
          %>
<option><%=modulo%></option>
<%}
%>

I know there's a javascript way to build a dynamic drop down list, but I was ooking for a "merged" Javascript+Java JSP recursive example! ( I need 3 different dropdown recursively dependet the second from the first and the third from the second..)
anyone can helps?

Similar Messages

  • How to call java script function from JSP ?

    how to call java script function from JSP ?

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • Access session variable in Java Function in JSP

    Hi Experts !!
    I am developing an application using STRUTS MVC...
    Very sorry if u have problem understanding my question, i ll try to improve... and sorry if i can't post codes here
    Basic question is ....
    I want to open a word document on pageLoad of JSP, the word document is not a single document, there is a form in which there is a "name" and "template" whenever user clicks on a button there is one action attached to it which creates a copy of that template in a different folder.. on the next page OnLoad i want to open that particular document. for that i have created a variable and also have set in the session, just want to access it in the below code.
    I have a formbean in which i have a variable, the scope is session, that variable i have put it in session also. but i want to access that variable in a "java function" in JSP so that "onLoad" page that function should work.
    JSP---
    <script type="text/javascript">
    function openDocument() {
    var w = new ActiveXObject("Word.Application");
    var docText;
    var obj;
    var a;
    if (w != null) {
    w.Visible = true;
    obj = w.Documents.Open(I HAVE TO ACCESS THAT VARIABLE HERE);
    </script>
    FORMBEAN----
    public class CreateSOWFormBean extends ActionForm {
    private String workflowName;
    private String comment;
    private String sowTemplate;
    private String sowFileCreated;
    public String getSowFileCreated() {
    return sowFileCreated;
    public void setSowFileCreated(String sowFileCreated) {
    this.sowFileCreated = sowFileCreated;
    sowFileCreated is the variable that i have accessed in session and that value i have to pass in that function in JSP....
    I am aware of something like
    obj = w.Documents.Open(<%'sowFileCreated'%>);
    but i m not sure how to write....
    Plz help.....

    If you're working under a framework like struts you should definitely be using JSTL tags rather than scriptlet code to access variables within the page. With JSTL code <% codes can be almost entirely avoided.
    To transfer a value from a Servlet to a JSP don't use a session variable, use a request attribute. Session variables should only be used when values have to survive from one transaction to another.
    You can write something like:
    obj = w.Documents.open('<c:out value="${openURL}"/>');in the Javascript portion of your JSP.
    Just beware of potential problems with quotes. The coresponding code in the Servlet would be like:
    request.setAttribute("openURL", openUrl);

  • Have a question about  using functions  in JSP 2.0

    Hello,
    Does someone try to create functions in JSP2.0?
    the following codes is from http://developer.java.sun.com/developer/technicalArticles/javaserverpages/JSP20/
    Code Sample:math.jsp
    <%@ taglib prefix="my" uri="http://jakarta.apache.org/tomcat/jsp2-example-taglib %>
    <HTML>
    <HEAD>
    <TITLE>Functions</TITLE>
    </HEAD>
    <BODY>
    <H3>Add Numbers</H3>
    <P>
    <FORM action="math.jsp" method="GET">
       X = <input type="text" name="x" value="${param["x"]}">
       <BR>
       Y = <input type="text" name="y" value="${param["y"]}">
       <input type="submit" value="Add Numbers">
    </FORM>
    <P>
    The sum is: ${my:add(param["x"],param["y"])}
    </BODY>
    </HTML>Compute.java
    package jsp2.examples.el;
    import java.util.*;
    public class Compute {
       public static int add(String x, String y) {
          int a = 0;
          int b = 0;
          try {
            a = Integer.parseInt(x);
            b = Integer.parseInt(y);
          }catch(Exception e) {}
          return a + b;
    }I put function tags in C:\Tomcat\webapps\jsp-examples\WEB-INF\jsp2\jsp2-example-taglib.tld
      <function>
            <description>add x and y</description>
            <name>add</name>
            <function-class>jsp2.examples.el.Compute</function-class>
            <function-signature>int add(java.lang.String,java.lang.String)</function-signature>
        </function>But get the error messages:
    The server encountered an internal error () that prevented it from fulfilling this request.
    org.apache.jasper.JasperException: /jsp2-tutorial/math.jsp(11,22) equal symbol expected
    Am I missing somethig?
    Thanks.

    Well, i think the code is perfectly fine , what you should look after : is there any servlet.jar exist in the jre/lib/ext on you java sdk ,you can determine whether EL 2 works by trying some jsp 2 examples provide with tomcat 5 alpha version .
    If it works , then it is not the alternative servlet.jar issue , most probably is your configuration errors.
    I have try my custom function and it worked well under tomcat 5 after resolving the earlier servlet.jar issue.
    By the way you don't have to put your tld file as described , simply place it under your /WEB-INF and edited your tomcat 5 web.xml to like my example given below .
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
    version="2.4">
    <display-name>Display Name of the application</display-name>
    <description>
    application name
    </description>
    <jsp-config>
    <taglib>
    <taglib-uri>
    your tld file
    </taglib-uri>
    <taglib-location>
    /WEB-INF/your tld file.tld
    </taglib-location>
    </taglib>
    </jsp-config>
    </web-app>
    Please give it a try and let me know whether it works , I will provide more assistance if required.

  • InterMedia Java Classes for Servlets and JSPs and Netscape

    I am using the interMedia Java Classes for Servlets and JSPs to upload and retrieve multimedia data. I have found that it is much more performant in Internet Explorer (5.5) than in Netscape Communicator (4.7). In fact, I cannot upload images larger than 10K at all using netscape. However, the same image can be uploaded into the same application using IE. Is this a known issue?
    Thanks in advance.

    Hi,
    We have successfully uploaded multimedia data in the giga-byte range (Quicktime and AVI files) at the same speed with both the Netscape (4.7n) and MS IE (4.n and 5.n) browsers. One thing we have noticed is that its very important to set the manual proxy settings correctly if you have an environment with a proxy server. If you don't, then uploads can go via the proxy server and, for some reason, that seems to take considerably longer. For example, suppose you are in the www.xyzco.com domain and are connecting to a host named webserver.www.xyzco.com, then specify webserver and webserver.www.xyzco.com (to cover both cases) in the "Do not use proxy servers for..." box in the manual proxy server configuration screen. Also, if you're using a tool such as JDeveloper that uses the host IP address in the debugger environment, then you also need to add the numeric-based (nnn.nnn.nnn.nnn) IP address to this list.
    Hope this helps.
    In order to better understand the variety of ways in which our customers are using interMedia, we'd be very interested in knowing a little more about your application, the interMedia functionality that you are using, and how you are developing and deploying your application. If you are able to help us, please send a short email message with some information about your application, together with any comments you may have, to the Oracle interMedia Product Manager, Joe Mauro, at [email protected] Thank you!
    Regards,
    Simon
    null

  • How to realize print function in JSP

    How to realize print function in JSP? I know use Javascript:window.print() can print,but it will print whole page,it don't fit me;Another method is to write JSP into Excel and then print it in Excel,but it don't fit me too,because it don't print directly. Anybody know how to print it directly?

    Many websites offer a "printer friendly" version of a certain page. That IMO is the only way to solve your problem, next to using CSS to use a different style for printer output. Here is a tutorial that covers this:
    http://www.alistapart.com/stories/goingtoprint/

  • Problems using JNI and JSP in WebLogic 6.0

    Hello everybody. My problem is that I've got a Java class that is called from a JSP. That class connects to a C function and it returns a String. A want this string to be shown by the JSP. The code is:
    JSP
    <html>
    <head>
    <title>prueba JNI</title>
    </head>
    <body>
    <%@ page import="ejemplosJNI.*, conversiones.*;"%>
    <%
    Texto texto = new Texto();
    out.println(texto.realizado());
    %>
    </body>
    </html>
    Java class
    package ejemplosJNI;
    public class Texto
    private native String getLine(String prompt);
    String input = null;
    public static void main(String args[])
    Texto t = new Texto();
    static
    System.loadLibrary("MyImpOfPrompt");
    public String realizado()
    input = this.getLine("Mando una l�nea desde Java");
    return input;
    C function
    #include <stdio.h>
    #include <jni.h>
    #include "Texto.h"
    JNIEXPORT jstring JNICALL
    Java_Texto_getLine(JNIEnv *env, jobject obj, jstring prompt)
    char buf[128];
    const char str = (env)->GetStringUTFChars(env, prompt, 0);
    (*env)->ReleaseStringUTFChars(env, prompt, str);
    return (*env)->NewStringUTF(env, str);
    I compile de C function and put the .dll library in the 'bin' folder in webLogic.
    When I call the JSP, I get the next exception:
    Servlet failed with Exception
    java.lang.UnsatisfiedLinkError: getLine
    at ejemplosJNI.Texto.getLine(Native Method)
    at ejemplosJNI.Texto.realizado(Texto.java:19)
    at jsp_servlet._jsp._pruebasjni._prueba1._jspService(_prueba1.java:93)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:213)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:246)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:1265)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1622)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    Is there any place where I have to put the .dll?
    Is there any place where I have to put the generated .lib?
    Where do I have to put the Texto.h file generated with javah?
    Can anybody help me to solve this problem?
    Thanks in advance.

    Hi, jschell! Maybe you can see my problem if I give you the code. My Java class and the C funtions are:
    Java class
    package ejemplos.cadena;
    public class Texto
    private native String getLine(String prompt) throws Exception;
    String cadenaFinal = null;
    public static void main(String args[])
    Texto t = new Texto();
    static
    System.loadLibrary("LibreriaCadena");
    public String realizado(String cadena)
    try
    cadenaFinal = getLine(cadena);
    catch(Exception e)
    System.out.println(e.toString());
    return cadenaFinal;
    C code
    #include <stdio.h>
    #include <jni.h>
    #include "ejemplos_cadena_Texto.h"
    JNIEXPORT jstring JNICALL
    Java_ejemplos_cadena_Texto_getLine(JNIEnv *env, jobject obj, jstring prompt)
    int cero =0;
    int division = 10 / cero;
    const char str = (env)->GetStringUTFChars(env, prompt, 0);
    (*env)->ReleaseStringUTFChars(env, prompt, str);
    return (*env)->NewStringUTF(env, str);
    I have done something like "int division = 10 / cero;" in order to get an exception in my C code. When I run my Java class I get an error message and the application breaks. I would like to know how to catch the C exception in order to pass it to my Java class that can manage it into the try-catch clause. I have read I have to use something like "FindClass" or "ThrowNew", but my problem is that I have no idea about C programming.
    Can you help me?
    Thanks for your time.

  • Server running xsql and JSP

    I made a xsql file (sql in xml file) and I want to deploy it. I have made JSP files too.
    Which server can run xsql and JSP files?
    Oracle 8.1.6 can run xsql and JSP files?
    Thank you

    Check out the [MIMES] section of webtogo.ora file which is located in %JDEVHOME%\lib. There is an entry which defines the handler for .xsql files (which in this case is the XSQL Servlet (oracle.xml.xsql.XSQLServlet). Same goes for jsps. You can run this on any Java enabled web server.
    The version of OAS which will provide this functionality is the soon expected 4.0.8.2

  • Functions in jsp

    hi
    I'm newbie to jsp and i want to know is there any familiar thing like a function? i developed some sites before in asp and php ...... and now i'm learning jsp.... what is the best thing in jsp to use if you have the same actions to do a lot of times .... in asp and php you can declare some funtion and call it like
    somefunction(adfasdfasdf);
    is this beans or servlets?
    thanks in advance.

    you can create any number of functions and put it in Beans, and now you can create the instance of your bean (scope may be page,session,application) and through that instance call your functions (method), number of methods ,any number of times.
    <b> Bean </b>
    <code>
    class Bean {
    String name=null;
    public String name(String name) {
    return name;
    </code>
    <b>JSP</b>
    <code>
    <jsp:useBean id="instance" class="Bean"/>
    <%=instance.name("Tom")%>
    <%=instance.name("Grey")%>
    <%=instance.name("Tomoto")%>
    </code>

  • How to run the recursive function in jsp

    hi, can any body tell me how to run
    rrays.sort(files);
    for (int i = 0, n = files.length; i < n; i++) {
    for (int indent = 0; indent < indentLevel; indent++) {
    System.out.print(" ");
    if (files.toString().endsWith(".jsp"))
    System.out.println(files[i].toString());
    if (files[i].isDirectory()) {
    listPath(files[i]);
    indentLevel--;
    this code in jsp
    thanks in advance

    Why are you writing scriptlets and functions in JSPs?
    Functions are supposed to be written in the Java Application layer.
    JSPs are best suited only to display information.
    Also why are you using Scriptlets insted of JSTL ?
    Anyway, if you want to write in JSPs only , here's how to write a function in them: http://forum.java.sun.com/thread.jspa?threadID=496577&messageID=2341986 you can figure out the rest.

  • Equivalent function of JSP:include or @include?

    Could someone please let me know how I can include html pages in a java servlet page? I am looking for similar function as JSP include. A simple example would be must appreciated. Thanks!

    Thanks for you reply. Actually, what I want to do is to import/include a static html page to my java servlet page. I do not want to use JSP because all the pages created were sevlet. I found out a way that using getServletcontext.getResource to read in the html page and print it out from the servlet. Just wondering that if there is a better way to do this?

  • Trying to fetch a value in a java function and returning the array.

    hello....I am trying to fetch a value in a java function and returning a array......I already write the pl/sql function which is working fine....but i think i m lost......when i run it through the jsp it shows me error........pls help
    java code:=
    public String [] viewx(String bid) throws SQLException, Exception {
    String [] values;
    try {
    CallableStatement cstmt = null;
    String SQL = "{?=call vi_dis.v_dis(?)}";
    cstmt = con.prepareCall(SQL);
    cstmt.registerOutParameter(1,Types.ARRAY);
    cstmt.setString(2, bid);
    cstmt.execute();
    Array simpleArray = cstmt.getArray(1);
    values = (String [])simpleArray.getArray();
    cstmt.close();
    } catch (SQLException sqle) {
    error = "SQLException: Could not execute the query.";
    throw new SQLException(error);
    } catch (Exception e) {
    error = "An exception occured while retrieving emp.";
    throw new Exception(error);
    return values;
    pl/sql function
    create or replace package vi_dis
    as
    function v_dis(vbid IN student.bid%type) return stuarray ;
    end;
    create or replace
    package body vi_dis
    as
    function v_dis(vbid IN student.bid%type) return stuarray
    is
    l_stu stUarray :=stuarray();
    cursor c_sel
    is
    SELECT CNAME
    FROM COURSE C,ENROLL E
    WHERE C.CID=E.CID
    AND E.BID=vbid;
    BEGIN
    OPEN c_sel;
    FETCH c_sel BULK COLLECT INTO l_stu;
    l_stu.extend;
    CLOSE c_sel;
    RETURN l_stu;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN DBMS_OUTPUT.PUT_LINE('NO RESULT AVAILABLE');
    CLOSE c_sel;
    END;
    END;
    /

    BalusC wrote:
    It is comparing the selected value against the List<SelectItem> returned by getSetoresOrigem() as it is during the apply request values phase of the form submit request.Ok. That's what I supposed JSF was doing.
    BalusC wrote:
    If the selected value isn't in there, then you will get this error.I can understand this, but is this right? As I said, the old value isn't really there because I changed the list values to new ones. But the new value (the value of fSetorOrigem ) corresponds to a value that exist in the new list items, so a valid value. So JSF is not considering that I also changed the list, not just the value. It is comparing the new value with the old list, not the new one. Acting like this JSF is making the page looks like a static HTML page, not a dynamic one. If I can't change the list and the value, what's the point of that? In my point of view I'm not doing anything wrong, I'm not violating any JSF rules.
    Marcos

  • Exit a function in JSP

    How can I exit a function in JSp
    my code is
    <%! String Dothis(int level)
    if(level==2)
    //exit the function
    else
    %>
    How can I exit this function .....
    Break label does not work...as I am not able to declare a label
    Pl...guide me
    smita

    Looking into ur code ,,,, U can do it like the following in addition to solutions posted above ( Exception and return)
    <%! String Dothis(int level)
    if(level != 2)
    %>
    Thanks
    Sampath ...

  • EMAIL FUNCTION USING JSP

    HOW CAN I WRITE A EMAIL FUNCTION USING JSP
    WHICH HAVE FORWARD, REPLY, REPLAY ALL, AND ADDRESS BOOK LIKE YAHOO EMAIL FUNCTION
    HOW CAN I WRITE IT?

    I meant you would face a considerable challenge trying to write
    public static void main(String[] arg) { } with your Caps-Lock key stuck.
    You would not even be able to escape your way out of it with
    \u0070\u0075\u0062\u006C\u0069\u0063 \u0073\u0074\u0061\u0074\u0069\u0063 \u0076\u006F\u0069\u0064 \u006D\u0061\u0069\u006E(S\u0074\u0072\u0069\u006E\u0067[] \u0061\u0072\u0067) { } as the "\u" escape sequence also contains a lowercase character.

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

Maybe you are looking for

  • SELECTION SCREEN EVENT

    Hi Guys,    we have a customized selection program similar to RSNAST00. In that while maintaining the variant when the users enter values other than say "ZABC " in output type field (KSCHL) and press enter certain fields in the screen should not be a

  • Multi Language support in ADF

    i have a requirement in ADF, my client wants me to display all the fields in the language he/she chooses to view. is this possible in ADF ?

  • AIR INSTALLER ISSUES...BAD ONES

    Hi Gang, I need HELP!!!!!! I'm trying to install Tweetdeck and along with it, my MACINTOSH is trying to install Adobe Air. I get this error message, "An error occurred while installing Adobe AIR. Installation may not be allowed by your administrator.

  • Is it just me or is Chrome 44 not as fast as the previos versions

    Well, the point of any product is to make money. Chrome earns money for Google by getting ads in front of eye balls....maybe. It also caches pages you haven't request, which possibly adds to their revenue. I know it irritates me if I'm looking for pa

  • Do the Ipods work with Flash videos?

    my friends and i were wondering if the ipods worked with flash vids and if so what format they should be in....