How to invoke a Servlet on onClick event of CheckBox ?

Hi,
Can anybody provide me with the code - how to invoke a Servlet & then pass all form variables to the Servlet on onClick Event of CheckBox in a JSP Page.
I guess it is possible with Javascript but i need the code...
Pls Help !
Thanx.

<html>
<head>
<script language="JavaScript">
<!--
function submitMyForm(){      
document.myform.submit();
//-->
</script>
</head>
<body>
<form name="myform" method="POST" action="http://mywebserver/servlet/myServlet" target=_top>
<input type="checkbox" name="mycheckbox" OnClick = "javascript:submitMyForm()">
</form>
</body>
</html>
Hope this helps...

Similar Messages

  • How to invoke a servlet from MDB

    Hi,
    Can someone please tell me how to invoke a servlet from MDB. Actually I want to have a MDB that will invoke a servlet that takes arround ~3 minutes to process and send the response back to MDB. Any small code snippet on invoking a servlet.
    Thanks

    nope. this is probably a bad design.
    but here's a hint: whenever you have a question like this, start browsing the javadocs. chances are there's a class that might help you.
    i'd recommend that you look at this:
    http://java.sun.com/javase/6/docs/api/java/net/HttpURLConnection.html
    %

  • How to invoke the servlet

    how to invoke a servlet using jsp
    containing JSF components
    how can we do this using creator ?
    having sucessfully executed the examples
    still dont know how to do it
    and also jsp source is quite different than normal jsp
    it doesnt allow jsp tags such as
    <%= "asdf"%>any help is great to me
    thanks in advance !
    cheers,
    shekar

    and also jsp source is quite different than normal
    jsp
    it doesnt allow jsp tags such as
    <%= "asdf"%>
    This is jsp syntax -- JSC uses jsf...:-(
    Regards,
    - D.t.O

  • How to invoke a servlet in another servlet

    In my first servlet named TransferServlet ,I want to invoke another servlet named PublisherServlet.So I wrote the codes:
    URL objURL = new URL("http://localhost:8080/servlet/PublisherServlet") ;
    HttpURLConnection hucConnection = (HttpURLConnection)objURL.openConnection() ;
    hucConnection.setDoOutput(true) ;
    hucConnection.setRequestMethod("POST") ;
    hucConnection.connect() ;
    but i can't invoke PublisherServlet. pls help me.
    Thanks a log

    Try this:
    String strURL = "http://localhost:8080/servlet/PublisherServlet";
    URL url = new URL(strURL);
    URLConnection con = url.openConnection();
    con.setDoInput( true );
    con.setDoOutput( true );
    con.setUseCaches( false );
    //con.getOutputStream().write(bArr);
    BufferedReader inStream      =     new BufferedReader(new InputStreamReader(con.getInputStream()));
    String strResponse;
    while ((strResponse = inStream.readLine ()) != null)
         sbfResponse.append (strResponse+"\n");
    inStream.close ();

  • How to invoke a servlet using a tag?

    hi,
    I have written a programme where I need to invoke a servlet from a hyperlink rather than a submit button,which is usually used to invoke a servlet.I hope you can help me out.
    thanks in anticipation
    regards
    Deepa Datar

    Thanks.
    Earlier I didn't get it because I was using doPost() method instead of doget().
    Thanks once again.
    Deepa Datar

  • How to invoke a servlet from an application-URGENT

    Hi,
              My requirement is as follows :
              I have to invoke a servlet from a client application. I am using
              java.net.URL and java.netURLConnection classes to
              open a connection and invoke the servlet.
              I am using WebLogic5.1
              my code snippet is as follows :
              URL url = new URL("http://localhost:7001/urlservlet");
              URLConnection connection = url.openConnection();
              connection.setRequestMethod("GET");
              connection.setDoOutput(true);
              connection.setDoInput(true);
              PrintStream outStream = new PrintStream( connection.getOutputStream() );
              outStream.print("message=hai");
              outStream.flush();
              outStream.close();
              When I execute the application, Webloigc server console is displaying the
              following line.
              <Listen Thread> Adding Address : <machine name><ip address>
              But the service method of servlet is not getting invoked at all.
              Help me to find the answer.
              Jeelani
              

    jeelani <[email protected]> wrote:
              > Hi Dimitri,
              > Thanks a lot.That worked for me.
              > But if I want to send java objects (Vectors,beans),what is the best way to
              > do it.
              > This is exactly what our requirement is..
              If you want to send Java object you have to use POST:
              URLConnection conn = ...
              conn.setDoOutput(true); // makes this a POST
              OutputStream os = conn.getOutputStream();
              ...write your objects here...
              os.flush();
              os.close();
              InputStream in = conn.getInputStream(); // sends data to the server and
              // opens input stream
              ..read servlet response..
              .. ot just close the stream...
              in.close();
              > my client application need to send some java components to our main server
              > located in our head office.The servlet will read the objects and execute the
              > functionality..
              > I really appreciate for the fast response from you.
              > Dimitri Rakitine <[email protected]> wrote in message
              > news:[email protected]...
              >> Try it like this:
              >>
              >> URL url = new URL("http://localhost:7001/urlservlet?message=hai");
              >> URLConnection connection = url.openConnection();
              >> InputStream in = connection.getInputStream();
              >> in.close();
              >>
              >>
              >> jeelani <[email protected]> wrote:
              >> > Thanks for the quick response.
              >>
              >> > Actually right now it doesn't matter whether it is by GET or by POST.
              >> > Add my clinet application just needs to send data to Servlet and nothing
              > to
              >> > get in return.Thats why I am using connection.getOutputStream().
              >>
              >> > since application will not be reading anything from servlet, I don't
              >> > think it is required to use connection.getInputStream().
              >> > (I am sorry, if I am wrong).
              >>
              >> > Can you please help me out. weblogic server is able to get the address
              >> > from where the request is coming. Only problem is servlet is not getting
              >> > invoked.
              >>
              >> > regards,
              >> > Jeelani
              >>
              >>
              >> > Dimitri Rakitine <[email protected]> wrote in message
              >> > news:[email protected]...
              >> >> Are you trying to do get or post? First you set method to GET
              >> >> and then you do the POST.
              >> >>
              >> >> And add InputStream is = connection.getInputStream() - that will
              >> >> result in HttpURLConnection sending data to the server and getting
              >> >> back the response.
              >> >>
              >> >> jeelani <[email protected]> wrote:
              >> >> > Hi,
              >> >>
              >> >> > My requirement is as follows :
              >> >>
              >> >> > I have to invoke a servlet from a client application. I am using
              >> >> > java.net.URL and java.netURLConnection classes to
              >> >> > open a connection and invoke the servlet.
              >> >>
              >> >> > I am using WebLogic5.1
              >> >>
              >> >> > my code snippet is as follows :
              >> >>
              >> >> > URL url = new URL("http://localhost:7001/urlservlet");
              >> >>
              >> >> > URLConnection connection = url.openConnection();
              >> >>
              >> >> > connection.setRequestMethod("GET");
              >> >> > connection.setDoOutput(true);
              >>
              >> >> > PrintStream outStream = new
              >> > PrintStream( connection.getOutputStream() );
              >> >> > outStream.print("message=hai");
              >> >> > outStream.flush();
              >> >> > outStream.close();
              >> >>
              >> >> > When I execute the application, Webloigc server console is displaying
              >> > the
              >> >> > following line.
              >> >>
              >> >> > <Listen Thread> Adding Address : <machine name><ip address>
              >> >>
              >> >> > But the service method of servlet is not getting invoked at all.
              >> >>
              >> >> > Help me to find the answer.
              >> >>
              >> >> > Jeelani
              >> >>
              >> >> --
              >> >> Dimitri
              >> >> http://dima.dhs.org
              >>
              >>
              >>
              >> --
              >> Dimitri
              >> http://dima.dhs.org
              Dimitri
              http://dima.dhs.org
              

  • How to invoke a servlet/JSP in WebLogic 6.1 after change without restarting

              Hi, all:
              Does anyone know how to have your servlet/JSP pick up the class changed without
              restarting the weblogic 6.1 server?
              Thank you so much for your help.
              - Charles
              

    Use exploded deployment format, touch REDPLOY file.
              Peace,
              Cameron Purdy
              Tangosol Inc.
              Tangosol Coherence: Clustered Coherent Cache for J2EE
              Information at http://www.tangosol.com/
              "Charles Li" <[email protected]> wrote in message
              news:3c3b9161$[email protected]..
              >
              > Hi, all:
              >
              > Does anyone know how to have your servlet/JSP pick up the class changed
              without
              > restarting the weblogic 6.1 server?
              >
              > Thank you so much for your help.
              >
              > - Charles
              

  • How to invoke a Servlet method from application

    please help me.the scenario is as follows
    1)a servlet is placed on the server and application has invoked servlet with URL and URL Connection class
    but how do i call a certain method of servlet on the server from the application.Let suppose the servlet's method to be invoked is print(String s).How it can be done from application.

    As GrayMan suggested, Servlets are intended to be used for HTTP communication.
    If you want to open common logic to multiple clients, use EJBs, CORBA or some type of Web Service (SOAP, XML-RPC).
    When you send a request to a servlet, the doPost or doGet method will be invoked. Products such as STRUTS allow you do 'map' to other classes. I suggest avoiding this.
    Personally, I avoid STRUTS like a bad disease. Using STRUTS instead of just learning Servlets/JSP adds a lot of overhead. I prefer performance over development time. A good example of this is that ANY request that comes in over the WEB has ALL variables from the calling page (text boxes, radio buttons and such) made avaialable through the HttpServletRequest.getParameter(String parameterName) method. STRUTS requires you to build a subclass of it's ActionForm classes that is nothing more than a JavaBean with fields that match that of the web page. STRUTS will look at all the parameters in the request and all the fields in the Bean and assign any matches from the request to the Bean. The Bean is instanciated and the matching logic performed just to give you access to objects you already have access to.
    Just my 2 cents, avoid STRUTS like an STD.

  • How to invoke a servlet from the command line

    Hi,
    I have a process that needs to do something remotely. One of the ideas is to have a servlet on the other side that can do that. So the question is how can I invoke it from my process?
    Thanks,

    First approximation to code:URL remoteTask = new URL("http://yourserver.org/yourservlet");
    InputStream response = remoteTask.openStream();
    // read the servlet's response from that InputStreamYou will find more comprehensive versions of this code if you search the forum.

  • How to invoke method BEFORE a window event occurs

    Hi all,
    I didn't get may results searching for this.
    I have two windows open - one is a JFrame and the other is an overlay. I would like the overlay to go down BEFORE the windowIconified (window minimized) event. However, the window listener for that event only happens AFTER the window is iconified. Is there any way to do this? In other words, I want to invoke my methods to take down the overlay BEFORE the JFrame is minimized.
    Is there any way this can be done?
    Any help would be greatly appreciated.
    Thanks,
    JB

    The problem is that the windowIconified windowListener occurs AFTER the JFrame has been minimized. Here is the timeline that occurs: User minimizes the window -> windowListener:windowIconified is invoked -> overlay is brought down.
    Here is the timeline that I want:
    User clicks on minimizes -> overlay is brought down -> window is ACTUALLY minimized here

  • How to set the session using onClick event?

    Dear All,
    I have a link, which once the user click on it, I want to set the session.
    <a href="link.jsp" > Link </a>How to set the session? Where should I put <%session1.setAttribute ("test", "1234"); %>?
    Any idea?
    Thanks

    when u click on Link
    the control goes to link.jsp/.
    and in this page u can write the session related code.

  • How to invoke the FileUpload field click event without clicking on the browse button?

    The Fileupload field click() method works in IE, but not in firefox. Can someone provide some details on this issue?

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.
    See http://forums.mozillazine.org/viewforum.php?f=25

  • Can I invoke a SubVI in an event? and how do I set the background color of a pipe to #0000ff?

    When I click an image or a glass pipe(which belongs to Industry/Chesmitry category in palette), I want a SubVI to be invoked.
    The purpose is to fetch an OPC-UA data from a web service and to write to it via the service.
    We are building an HMI solution which displays an interactive water plant diagram.
    When users click pipes and motors in the diagram, clicked devices should be turned on and off and change their animations or colors accordingly.
    OPC-UA is for communication with devices.
    I couldn't even set the background color of a pipe to "#0000ff", but setting it to "Red" or "Blue" was possible, and I don't know how to invoke SubVIs in event scripts.
    The documentations in NI.com are confusing and lack depth.
    Even silverlight references are confusing.
    How do I do all of these?

    Hi iCat,
    Can you provide some more information about your current implementation so that we can help to answer your questions. Some questions I have for you are:
    Are you creating this project in the NI LabVIEW Web UI Builder or in LabVIEW?
    How are you publishing your webservice? Is this also in LabVIEW?
    How is your webservice interacting with an OPC-UA server?
    How is the certification set up with OPC-UA so that you can communicate between the server and the client?
    Best Regards,
    Allison M.
    Applications Engineer
    National Instruments
    ni.com/support

  • How to create a navigation bar entry with onclick event

    I have requirement of creating navigation bar entry with a an "on click" event. When a user clicking time a location list should open. I didn't understand how to do it on NAVIGATIONBAR_ENTRY.
    Also Navigation Bar Entry IMage is not displaying.
    Regards
    Edited by: satheeshkumars on Oct 25, 2010 7:52 PM

    Do you specifically need to use the onclick event, or do you jts want to run Javascript from the navbar entry? If the latter then you can use the URL method and set the URL to:
    javascript:myfunction()
    If it must be an onclick event then I think you would need to attach it dynamically in Javascript (using jQuery if available) to locate the link somehow (it's not easy to give it a unique ID unfortunately).
    Edited by: Tony Andrews on Oct 26, 2010 10:35 AM

  • Invoking Component With OnClick Event

    I need help! I am trying to invoke a component asychronously
    with an onclick event of my form. Unfortunately, I have not been
    able to get it to work. I am currently using a framework by JSMX,
    but it is not functioning properly for me.
    I know that my cfc is okay, for when I manually invoke it
    through the URL, it behaves as expected. Can anyone familiar with
    JSMX help me out? Thanks!
    My code is as follows:

    Why don't you do it the easy way and submit the form to a cf
    template that calls the method? If necessary, put that template
    into an iframe so it is not visible to the user.
    Take into account that once you get your code to actually do
    something, you have to contend with users clicking the button
    repeatedly wondering why nothing appears to be happening.

Maybe you are looking for

  • Need help migrating users from dead 10.4.0 server to 10.5.8 server

    Hello, We have an ancient xserv (G4, SCSI drives I think) that was running 10.4.0 server, serving http, AFP and SMB, and doing the streaming for the college radio station to the internet(qt broadcaster was sending from another machine to this machine

  • B/w photo with isolated color

    How can one turn a photo into black/white but have one element within the photo show in color? For an example, you can log into stock.xchng and check out the following photo: http://www.sxc.hu/index.phtml I'd be using Fireworks 8... THanks for all yo

  • Stop auto PlayOn download of media

    Downloading from LSM.ORG , a. ' *.cfm' file; when it starts downloading, it generates an error saying - "cannot play the selected track". I assume that this means that downloading process implicitly starts a 'PLAY' of the audio file, thus eliciting t

  • Macbook Pro Display Problems

    I have a Macbook Pro thats 2 years old. Everyday now the display just goes black, I get no picture but there seems to be power still going to the screen because you can see the black going brighter when you turn the brightness up. The only way to get

  • Fireworks roundtrip on OS X Mavericks

    Hi all, I'm using OS X Mavericks with the Creative Cloud version of Fireworks CS6 and Dreamweaver CC. When I edit an image from DW, the first time, it works with no problem but, do it again with another image and it appears to work BUT.. In Fireworks