how to call different java method based on html select option choice?

any code sample?

basically, user will select a dropdown option and press submit.
for each option,different query should be executed.
using mysql DB and netbeans IDE.

Thanks !!!

Recommended Answers

All 3 Replies

Member Avatar for LastMitch

@chaitanya_krish

how to call different java method based on html select option choice?

Have you google this topic? Base on the question you ask you don't really know how mysql DB and netbeans IDE work together? If you did you wouldn't need post that.

This is the link for the connection:

http://netbeans.org/kb/docs/ide/mysql.html

Read this, it's has a simple example on how to create a select option (check box/radio button):

http://www.javaguicodexample.com/mysqldatabasenetbeans2.html

just pass the method name to the page where your processing is done
based on the method name you may call the appropriate method as follows

for example: the following are the methods to execute (think this would be servelet or jsp whatever you want )

method_name = request.getParameter("metod_to_execute");

if(method_name.equalIgnoreCase("add")){

    addDetails();

}else if(method_name.equalIgnoreCase("delete")){

    deleteDetails();

}else if(method_name.equalIgnoreCase("update")){

    updateDetails();

} 

the only thing you have to do is just send the method_to_excute value to this page from the selection of your choice

i think you got my point

if you have any doubts in my clarification let me know

happy coding

actually, saying you are using NetBeans as IDE shows that you're notr really experienced. if you were, you would know that

String myString = new String("yup");

just like any other code in java, does exactly the same when written in NetBeans, VI, notepad, eclipse, SpringSource, JCreator, ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.