Ajax passing values to the server.

Posted on 2010-01-04
Last Modified: 2013-11-24
Quick and easy Ajax question:
Given:            A value is passed from js t to a servlet
Question:       does the value have to be used?

Found in one of my other posts Kuldeepchaturvedi: had a thought and thought to post it as a new question.  I agree that the passed value/parameter needs to be added to the select statement if it is tyo be considered but I disagree if all I want is to run a selectstatement.  Thank you in advance for your thoughts!!  Found below is the code in question the link canbe found above.

// in the query part you may have to add a where clause using the keys that you have recieved from client
resp = resp + "<Business>";
ResultSet rs=stmt.executeQuery(lsQuery);
Question by:gazdzid
    LVL 22

    Accepted Solution

    Say e.g.
    There are two companies: A and B

    A has business: A1 and Busniess A2
    B has Business: B1 and Business B2

    See the pictorial representation attached

    Now according to the pictorial representation, user who selects company A should ideally see
    Business belonging to company A only and likewise with comapny B.
    Futher when a Business is chosen, the user would want to see the Sub Business under that particular Business.

    And hence the thought of passing the company name/ business name in the where clause.
    So when user selects Company A - pass it in the query and get all the business Names belonging to Company A
    when a business is chosen - pass the business name in the query to get all the sub business names


    >>does the value have to be used? - NO not necessarily, If you agree with the above logic you will use it. Else all business Names and Sub Business Names will be populated.

    >> but I disagree if all I want is to run a selectstatement.  
    You are right this should not affect the functionality in any way. I am sure Kuldeep had the above logic in mind while suggesting the idea

    I hope you got the scenario.

    LVL 3

    Author Closing Comment

    Great explaination and I agree with you ad I sure Kuldeep does as well.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now