• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Ajax passing values to the server.

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);
1 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.

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now