If-else not working

If-else not working

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>Untitled Document</title>
</head>
<%
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/mhs?user=root&password=admin");
        Statement stmt=conn.createStatement();
        ResultSet rs=null;

%>
<body>

<form method="post">
Select Your Choice:
<select name="Lab">
<option value="No"><--Select Lab/Non-Lab--></option>
<option value="Lab">Lab Base Students</option>
<option value="Non-Lab">Non-Lab Base Students</option>
</select>
<br></br>
<input type="submit" value=" To Show Student List Click here"><br></br>

</form>

<% String Lab=request.getParameter("Lab");
   String query=null;

   if (Lab == "Lab"){
       query="SELECT REGNO,SNAME FROM sub_comb WHERE L_category='Lab'";
       }
    else if (Lab == "Non-Lab")
      { 
       query="SELECT REGNO,SNAME FROM sub_comb WHERE L_category='Non-Lab'";

      }
   rs=stmt.executeQuery(query);
 %>
</body>
</html>
View Answers

Ads









Related Tutorials/Questions & Answers:
If-else not working
If-else not working  <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %> <html> <...="SELECT REGNO,SNAME FROM sub_comb WHERE L_category='Lab'"; } else if (Lab
If-else not working
If-else not working  <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %> <html> <...="SELECT REGNO,SNAME FROM sub_comb WHERE L_category='Lab'"; } else if (Lab
Advertisements
If and else if ladder
If and else if ladder  How we can use if and else if statement?  ...) System.out.println("Grater than 100"); else if(i < 50) System.out.println("Grater than 50"); else
programes on if....else
or not write a program to find minimum of 3 nos using nested if else. write... a program to input score of a student out of 100 and print grades using else...){ System.out.println("Leap Year!"); } else{ System.out.println("Not a Leap
if/else statements
if/else statements  I'm having a hard time programming this question: code an if/else statement that test the value of a string variable named.... If the value is "UPS," code another if/else statement that tests the value
UITapgesturerecognizer not working
UITapgesturerecognizer not working  uitapgesturerecognizer not working
if else condition - Java Beginners
if else condition  Please explain the if else condition in Java programming language
if else statement in java
if else statement in java  if else statement in java explain with example
if else statement in java
if else statement in java  explain about simple if else statement and complex if else statement in java with an example
if else in javascript function
if else in javascript function  How can i write the else statement in JavaScript to check if the web browser is IE or not? Is there any other way to validate this way ..? Thanks
switch case instead of if else
switch case instead of if else  How to write code in switch case instead of if else in Java
Java if else condition
Java if else condition  its there any similar condition for (X<=5 || y<=10) please post the answer as soon as possible.... TQ
check condition in if-else block
check condition in if-else block  Hi, I want to update database with following query int i= st.executeUpdate("Insert into text_editor(words) values('"+words+"')"); how can I give a check option so only valid words are inserted
Datagrid not working
Datagrid not working  The code here is working fine, apart from the fact that that I'm using netbeans 6.5 and the servlet v2.5 and struts 1.1.... working. please help me out
hibernate.archive.autodetection not working
hibernate.archive.autodetection not working  Hi, What is the use of hibernate.archive.autodetection? I am trying to use in my project but its not working. How to resolve hibernate.archive.autodetection not working issue
Why this is not working...?
Why this is not working...?  import java.util.*; public class Family { int size_of_family=0; public Person[] members=new Person[size_of_family...; } else{ System.out.println("This person already exist
using if and else if statments
using if and else if statments  Hello everyone Hope all are well Just new here & already have a question. I have a little veg shop it sells 6... if and nested if and else if This has my head in bits for days I have the below done x6
Java if else
Java if else       The if-else statement is one of the widely used control flow statements while... to the programmer to handle the condition based programming. Syntax for if-else
IF-ELSE In JSTL
IF-ELSE In JSTL In this section we will read about implementation of if-else.... In JSTL if-else tag is not implemented directly like the if-else statement is used on the Java/JSP coding. Implementation of if-else tag in JSTL coding
Ajax not working in jsp
Ajax not working in jsp  I'm using Netbean, Ajax validation in the following code is not working the code succesfully run for first UID validation adn also for ee-mail but does not enter if else for firstname field please help me
Objective C if else statements syntax
Objective C if else statements syntax  What is the syntax of if else statements in Objective C?   Using of if else statement in Objective C There is no changes in the syntax format of if else statement. You can write
ModuleNotFoundError: No module named 'maybe-else'
ModuleNotFoundError: No module named 'maybe-else'  Hi, My Python... 'maybe-else' How to remove the ModuleNotFoundError: No module named 'maybe-else' error? Thanks   Hi, In your python environment you
Update not working in hibernate.
Update not working in hibernate.  Update not working in hibernate
Comparing arrays not working correctly?
Comparing arrays not working correctly?  Comparing arrays not working correctly
Nitobi Grid is not working in IE10/IE11
Nitobi Grid is not working in IE10/IE11  Nitobi grid is working in IE8, but not working in IE10/IE11. we are using above two javascript files to open the grid
Focus method not working in firefox
Focus method not working in firefox  object.focus() is not working in firefox and chrome the element is not focused what was the problem
The else Keyword
The else Keyword        The else is the one more keyword of Java. It is used to specify a statement..., the code after the else keyword is executed. It is an optional part of a branching
ModuleNotFoundError: No module named 'working'
ModuleNotFoundError: No module named 'working'  Hi, My Python... 'working' How to remove the ModuleNotFoundError: No module named 'working... to install padas library. You can install working python with following command
ModuleNotFoundError: No module named 'working'
ModuleNotFoundError: No module named 'working'  Hi, My Python... 'working' How to remove the ModuleNotFoundError: No module named 'working... to install padas library. You can install working python with following command
ModuleNotFoundError: No module named 'working'
ModuleNotFoundError: No module named 'working'  Hi, My Python... 'working' How to remove the ModuleNotFoundError: No module named 'working... to install padas library. You can install working python with following command
Multi Threading is not working in that why...?
Multi Threading is not working in that why...?   import java.io.File...); nextBuffer = 2; } else { len = fp.read... NewThread(filename,k,1,len); else new NewThread(filename

Ads