How JSP codes residing in js function works

Hi,
I would like to check with you how JSP codes residing in js function works.
How can I get the 2nd select stmt executed based on the values retrieve from 1st select statement and the conditions pass in to this js function
How can I get the select statement to execute only when a condition is met.
The following is the codes. It is not executing the 2nd select statement. when I didnt put in the 2nd select stmt, i execute those codes in that portion
script
====
function test(obj, obj2) {
<%
sql_query = "SELECT a1, a2 , a3, a4, a5 "+
" FROM table_a ";
try {
rset = db.execSQL(sql_query);
catch(SQLException e){
System.err.println ("Error in query " +e);
%>
var po_ln_fnd = false
<% while (rset.next()) {
j_a1 = rset.getString("a1");
j_a2 = rset.getString("a2");
j_a3 = rset.getString("a3");
%>
if ((eval(obj2.value)== '<%=j_a1%>')) {
if ((obj.value == '<%=j_a2%>') ) {
<% j_a4 = rset.getString("a4");
j_a5 = rset.getString("a5");
sql_query = "SELECT b2, b3, b4 "+
" FROM table_b "+
" WHERE b1 = '"+j_a3+"' ";
try {
rset = db.execSQL(sql_query);
catch (SQLException e) {
System.err.println("Error in query " +e);
while (rset.next()) {
String j_b2 = rset.getString("j_b2");
String j_b3 = rset.getString("j_b3");
String j_b4 = rset.getString("j_b4");
%>
<%}>
}

what is the other alternative to produce the same results: (retrieve the data based on the value entered on screen, upon onChange, it will chk whether the condition met, if met, will retrieve data from another table and display on the screen - all this is done without the submit button being pressed)

Similar Messages

  • How to implement the barcode printing functionality working on the Prod.

    Hi,
    Can anyone help me "How to implement the barcode printing functionality working on the Prod".
    Thanks
    Gangadhara

    Check this link --> barcode

  • ActionScript: How to Re- setInterval Each Time Function Works?

    I have a function that draws a rectangle on the screen (see createInfoPanel())
    While drawing rectangle, I am adding 2 text fields on it.
    But as you may guess, it is adding those immediately.
    I want to delay adding these text fields, then I want to remove these panels after a while.
    The problem is, when I set an interval or timer, they won't work after I using once (I had to stop them by clearing/removing, it didn't set them again).
    Since my panel is being created each time image changes, I need them to work every time image changes.
    So, I have 2 questions:
    1- How can I re-set interval each time my createInfoPanel() function works? It won't work anymore after setting and claring once. 
    2- You can see infoPanel.addChild(titleField); line in addInfoPanel() function. How can I work a smooth animation here? I mean, text appears slowly? 
    Thanks in advance.
    Code file:
    public class ImageRotator extends Sprite
    private var ... ; //Some variables
    public function ImageRotator(xmlPath:String = "images.xml", interval:int = 8301):void
        timer = new Timer(interval);
        loadXML(xmlPath);
    private function loadXML(file:String):void
        urlLoader = new URLLoader(new URLRequest(file));
        urlLoader.addEventListener(Event.COMPLETE, parseXML);
    private function parseXML(e:Event):void
        xml = new XML(e.target.data);
        loadImages();
    private function loadImages():void
        for (var i:int = 0; i < xml.children().length(); i++)
            var loader:Loader = new Loader();
            loader.load(new URLRequest(xml.children()[i].@src));
            imagesVector.push(loader);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, sortImages);
    private function sortImages(e:Event):void
        imagesCounter++;
        for (var i:int = 0; i < imagesVector.length; i++)
            imagesVector.reverse();
            addChild(imagesVector[i]);
        //I have only 3 images, I needed to set indexes because
        //they were covering each other
        this.setChildIndex(imagesVector[2], 0);
        this.setChildIndex(imagesVector[1], 0);
        this.setChildIndex(imagesVector[0], 0);
        if (imagesCounter == imagesVector.length)
            createInfoPanel();
            timer.addEventListener(TimerEvent.TIMER, autoChange);
            timer.start();
    private function createInfoPanel():void
        infoPanel.graphics.beginFill(0x000000, 0.0);
        infoPanel.graphics.drawRect(0, 0, 967, 138);
        infoPanel.graphics.endFill();
    ////Here I want to run addInfoPanel() function with 2 seconds delay,
    ////After it starts, I want to run removeInfoPanel() function with 2 more seconds delay
        addChild(infoPanel);
    private function addInfoPanel():void {
        titleField.text = xml.children()[infoCounter]. @ title;
        titleField.x = 425;
        titleField.y = 0;
        description.text = xml.children()[infoCounter]. @ description;
        description.x = 427;
        description.y = 26;
        infoPanel.y = 300;
        infoPanel.addChild(titleField);
        infoPanel.addChild(description);
    private function removeInfoPanel():void {
        infoPanel.removeChild(titleField);
        infoPanel.removeChild(description);
    private function addActions():void
        //Some function
    private function changeImage(e:MouseEvent):void
        //Image changing function
    private function changeDepth(e:TweenEvent):void
        //Some function
    private function autoChange(e:TimerEvent):void
        //Some function
    Edit: How I used to work the intervals:
    private function createInfoPanel():void
        //lines above code sample
        intervalInfoPanel = setInterval(addInfoPanel,2000);
        addChild(infoPanel);
    private function addInfoPanel():void {
        //lines above code sample
        clearInterval(intervalInfoPanel);
        intervalInfoPanelRemove = setInterval(removeInfoPanel,3500);
    private function removeInfoPanel():void {
        //lines above code sample
        clearInterval(intervalInfoPanelRemove);

    Hi,
    No, no debug/runtime, I also export my movieclip.
    Here's how I use:
    import com.greensock.*;
    private function sortImages(e:Event):void
        imagesCounter++;
        for (var i:int = 0; i < imagesVector.length; i++)
        imagesVector.reverse();
        addChild(imagesVector[i]);
        if (imagesCounter == imagesVector.length)
        createInfoPanel();
        timer.addEventListener(TimerEvent.TIMER, autoChange);
        timer.start();
    private function createInfoPanel():void
        infoPanel.graphics.beginFill(0x000000, 0.0);
        infoPanel.graphics.drawRect(0, 0, 967, 138);
        infoPanel.graphics.endFill();
        addInfoPanel();
        addChild(infoPanel);
    private function addInfoPanel():void {
        infoPanel.y = 300;
        titleField.text = xml.children()[infoCounter]. @ title;
        titleField.x = 425;
        titleField.y = 0;
        description.text = xml.children()[infoCounter]. @ description;
        description.x = 427;
        description.y = 26;
        titleField.alpha = 0;
        TweenLite.to(titleField, 1.0, { alpha: 1 });
        description.alpha = 0;
        TweenLite.to(description, 1.0, { alpha: 1 });
    Nothing appears...

  • How to get the Wiki search functionality working?

    hi,
    Another Wiki question regarding the 7.1u1 Portal wiki functionality: What is necessary to get the wiki search functionality working? Right now when using the wiki search page all it does is return to the search form, no errors but no hits either. I guess some additional administrative work is needed to get search working?
    thanks, tom

    haven't touched anything except for the wiki template jsps to change the design. it is a linux rh4 install. there are no communities on that server (yet), just the wiki portlet in a tab so far. is the wiki search dependent on the portal search server or totally separate (ie self contained wiki search)? any additional services or such that need to be started for it to work?

  • How do you make the 'places' function work in iphoto

    `i have just imported a lot of old photos from my 2007 macbook onto a new macbook pro with ilife 09. `i am trying to make the places function work but can't get it to work. The 'i' icon does not appear in the bottom right hand corner of the events main photo as it's supposed too. Any suggestions?

    Simply open an event; select 1 or more photos and select the i in the lower right corner of a photo thumbnail. You will get the Geocoding window. Start typing the address/place/country in the location area. For detailed addresses you select new place. You can resize the window. Maps from google appears and you select the place it finds. You can even drag the pin to a specific area. Press ok and your done.

  • How long has the 'hey siri' function worked unplugged?

    I use my idevices and siri everyday for hours, I'm familiar with all of ios' functions. But I just discovered while using my iPhone 6 with ios 8.3 that after you hold the home button down activating siri, then ask a question, as long as you keep the siri screen open the 'hey siri' function works unplugged. Has this been the case since ios 8.0?

    simonp_au wrote:
    Ok, well after I press the home button as usual (unplugged), then ask siri a question, siri then answers. That's the way it has always worked, yes. But, if you leave the siri screen open, while unplugged, then say 'hey siri' siri activates again. Try it. And that has not always been an available function.
    I can confirm that it works. My recollection is that Siri always remained open for a minute or so after a query, but you would have to push HOME again for another question. Nice feature!

  • How do you make the mouseover function work?

    My Firefox mouseover function does not work. It stopped working two updates ago. It used to work just fine. I recently updated to version 3.6.13 on my Mac (version 10.5.8), and still no success. I've tried quitting Firefox and restarting, deleting Firefox and re-downloading, shutting down and re-starting the computer. Still no Luck. Any help would be most appreciated.

    Issues with tooltips not working properly have been reported to be caused by the Google Toolbar (Tools > Add-ons > Extensions)<br />
    You can check if there is an update available that fixes that issue.<br />
    You can try to uninstall and reinstall the latest Google Toolbar.<br />
    * https://www.google.com/intl/en/toolbar/ff/

  • How exactly does the logical shift function work?

    I think I am missing something very basic here - I am trying to left shift an 8 bit unsigned integer by one place (x<<1)in each iteration of a while loop. So if I start with a number, say 18, the first iteration I get 36, then 72, 144 and after this 32, 64 and so on. I'm not able to do this apparently simple operation in LabVIEW. I tried the logical shift function and a formula node, but both dont give me what I need. The formula node appears to be close in that it gives me 18,36,72,144 but after that I get 255 rather than 32. I dont understand what the logical shift function is doing here. I have attached a vi here that shows what I am trying to do. Any help explaining the mistake I am making will be greatly apprec
    iated.
    Thanks.
    Attachments:
    Logical_Shift.vi ‏17 KB

    You have the inputs confused. If you want to left-shift by 1 at each iteration, the "1" goes on the upper "y" terminal and the number from the shift register (the "shiftee") goes at the bottom. (see attached modification).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Logical_Shift_2.vi ‏27 KB

  • When using FMLE how does the DVR auto record functionality work?

    Hi,
    Im using FMLE to send a live stream to my FMS. I check marked DVR Auto Record on it. But I am uncertain if its recording, for how long its recording, and whether I can control this functionality though my FLASH application. Do I edit an xml file in FMS directory to manage where the file is recorded to and for how long its recorded? Can actionscript from a FLASH app in the webroot dir access this file and play it back then return to the live stream? Has anyone found a tutorial on these matters.
    I appreciate the help, thank you.

    Check this articles - they should guide you:
    http://www.adobe.com/devnet/flashmediaserver/articles/live_dvr_pt1.html
    http://www.adobe.com/devnet/flashmediaserver/articles/live_dvr_pt2.html
    http://www.adobe.com/devnet/flashmediaserver/articles/live_dynstream_dvr.html

  • How to make a reset password function work in OIM?

    There is a requirement for resetting password for users in OIM.
    An OIM admin should be able to reset a password for a specific user, and the new password which should NOT be known by the admin will be sent to the user via email. And the user will be required to change his password when he logins with the new password.
    I know there is a 'Change Password' button in User Detail page. But the problem is the admin has to type a password for the user, which means the new password is exposed. Ideally, the new password is generated by system. Has anyone had any experience in dealing with this kind of case? Thanks!

    See if this can solve or answer your requirements.
    When User's account is locked, It is assumed that he has forgotten his password.
    Write a scheduled task which looks for all the locked users.
    Generate temporary password for them.
    Send that password in a mail to those users.
    This may not be exactly how you want it to be. But this will require lesses efforts as compared to customizing "Change Password" button on admin console.
    To make it the way you want, Following approach can be useful.
    Admin console of OIM is made using struts framework. So If you know struts, Reading into struts-config.xml file will tell you the action class which is executed on click of "Change Password".
    Modify that action class and make it the way you want that to be.
    -Kiran Thakkar

  • How to code the function of  add+delete+edit using jsp??

    how to code the function of add+delete+edit using jsp??i'm also using the ms sql server 2000 as a database. pls help me!!

    Hi,
    I think you will find the following useful.
    Performing Inserts, Updates, and Deletes
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html

  • Upload file jsp code doesn't work? How can I debug

    Hi Everyone,
    I have the following jsp code that simply adds a new product to the backend database when 'Continue' button is pressed.
    if( "Continue".equals(fp.getParameter("Submit")) ) {
         fp.setParameters(prodForm);
         prodForm.setCreateBy(currentUser.getUserID());
         prodForm.save();
         String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");
         return;
    }The code works fine but the upload doesn't work. This is the upload part of the above code:
    String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");So if the file browser, <input type="file" name="file">, has a file, then it saves the file in the upload folder and saves the filename in the database. But it doesn't work, it doesn't save the file in the upload folder nor it saves the filename in the database. I am new to java and jsp so could you tell me what error checking or deguging I can do in jsp to spot the problem.
    Thanks,
    Zub

    where u write the code to upload the file
    to server end?

  • How do I code relative links as function parameters within Templates?

    I am a newcomer looking for best practices for a "How Do I?" properly code relative links as function parameters within an Adobe template (DWT) which accomodates page creation at 2 different level of folders. Dreamweaver doesn't appear to handle auto-correction of relative links as function parameters as far as I can see.  It's not clear to me what the best practice I should be following.  While this is not exactly a SPRY question, I am hoping that someone using the Spry.Data.XMLDataSet had already found the best practice to use.
    My Site
    -- Multiple pages at this level    and the parameter needs to be "_includes/UnitSideNavigation.xml"
    SubFolder
    -- Other pages at this level.       and the parameter needs to be "../_includes/UnitSideNavigation.xml"
    And this is the particular code snippet within a non edtable template area I would like to work for 2 levels of pages created from the template.
    <script type="text/javascript">
    var dsItems1 = new Spry.Data.XMLDataSet("_includes/UnitSideNavigation.xml", "/links/firstlevel");
    var dslinks = new Spry.Data.NestedXMLDataSet(dsItems1, "secondlevels/secondlevel");
    </script>
    My environment is Windows/Vista using latest CS4 dreamweaver.
    Any pointers appreciated. This is learn time for me. Hope I have made myself clear. Andy

    I use serverside includes instead of DWT for exactly that reason. Not only that, if you change anything within the template you must re-upload all of the files affected by the change; only the modified include file needs to be uploaded.

  • How to get OutputStream/Writer for a file in a JSP code?

    In a JSP code as shown below, how could we get an OutputStream to write a file that resides on the server file system?
    I'm stuck after five hours struggle!
    <%
    /* simple experimental JSP program */
    ...  // get request data
    Properties pt = new Properties();
    Class clas = getClass();
    InputStream is = clas.getResourceAsStream("/users.properties");
    pt.load(is);
    String userNameDB = pt.getProperty("user");
    String passwordDB = pt.getProperty("password");
    long lastLogonDB = Long.parseLong(pt.getProperty("lastLogon"));
        // so far so good ...
    if (userName.equals(userNameDB) && password.equals(passwordDB)){
      if (lastLogonForm > lastLogonDB) {
        session.setAttribute("User", userName); //Saves user name string in the session object
        pt.setProperty("lastLogon", lastLogon);
        pt.setProperty("user", userNameDB);
        pt.setProperty("password", passwordDB);
        ...  // how to write back the new data to the users.properties file?
    %>

    I have found a solution:
    String path = application.getRealPath("/users.properties");
    InputStream is = new FileInputStream(path);
    is.close();
    OutputStream os = new FileOutputStream(path);
    os.close();getResourceAsStream() is oddly incompatible with the code using the getRealPath(). So don't use it.

  • How does the SignatureClear() function work?

    Hello everyone:
    I have read Javascript for Acrobat API Reference (8.0) and I'm still wondering how SignatureClear() works. Is it possible to clear a signature field with this? How? It is said that you can not work with it in Adobe Reader... but I have seen some other functions working despite of the Availability column: is it possible to use it in Reader?
    Code examples will be very appreciated.
    Regards,
    Javier

    Javier
    I have not reviewed thew API documentation, but I can comment...
    1)  To "clear" or remove a digital signature, you need to have access to the "private" key (digital credential\certificate) that was used to generate the signature.  This means that typically, only the signer can remove their own signature.
    2)  You cannot sign a PDF document with Reader, UNLESS the PDF has been "reader extended" with the "signing" permission that will enable the ability to sign a document with Reader.  A PDF can be extended with LiveCycle Reader Extensions (server product) or with Acrobat Professional.  I have nottried it myself, but I would assume that the "signing" permission would need to be enabled on the document to allow Reader to remove (clear) the signature, assuming agaion that Reader had access to the private key used to create the signature.
    Hope this helps.
    Steve

Maybe you are looking for

  • My iPod Classic will not synch fully.

    I have downloaded the  latest version of iTunes onto my new laptop (Windows 8, dont know if that makes a difference), library was all there as its all floating up the clouds somewhere but on attempting sync with my iPod Classic its only synching 1600

  • Java Server Pages (Struts)

    Hi all can any one help me.... i am new in struts .. i installed struts, tomcat on my computer I set all the paths and classpaths but when i call the page the IE gives the following error.... do any one reply me......here or on [email protected]

  • Here is one for the tekkies. How to do this in SQL?

    Input : String 541862356 Table has 2 columns: SNO                             SLENGTH 5418                                4 54186                               5 54321                               5 Output should be 54186. We don't have any other in

  • Browser displays no slider bar to side-scroll if a page is oversized.

    I'm having a problem with the new Firefox 4 and how it displays websites that are oversized. This new browser has a lack of a side scroll bar at the bottom of the page (or top) that allows me to view the whole page. Also, I can't have my Fonts set at

  • How do i ope an illustrator file on indesign and then continue editing?

    Designed a business card in illustrator. Now want to open it in indesign and then continue editing, placing etc.