Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet If-else not working

Have Programming Question? Ask it here!
 
 
 


Abir Ghosh
If-else not working
0 Answer(s)      2 years and 2 months ago
Posted in : JSP-Servlet


<%@ 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>

Advertisement
View Answers

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
if else statement in java
if else statement in java  if else statement in java explain with example
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  explain about simple if else statement and complex if else statement in java with an example
UITapgesturerecognizer not working
UITapgesturerecognizer not working  uitapgesturerecognizer not working
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
ELSE STATEMENT!! - Java Beginners
ELSE STATEMENT!!  Hi! I just want to know why doesn't my else statement works? Else statement is there in the code below which is: else JOptionPane.showMessageDialog(null, n+ " is not in the array!");//doesn't work
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
'else' Not Required
Java Notes'else' Not Required 'else' is not required In this section we will learn about if else statement in more detail with example. It is not necessary to have the else part of an if statement. Maybe only 50
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
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
If and else statement - JDBC
If and else statement  Dear Sir, I had created a statement...); ======================================================= how to create a if and else statement... or else it will prompt a message dialog to indicate that the word is already
htpasswd working
htpasswd working   hii, What does htpasswd do?   hello, htpasswd creates a new user in a specified group, and asks to specify a password for that user
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
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
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
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
Control Tags-If / Else If / Else
Control Tags-If / Else If / Else      ... are used for flow control such as if, else and iterate.)  'If' tag could be used by itself or with 'Else If' Tag and/or single/multiple 'Else' Tag. Create
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
else if (selection = * 'M'); - Java Beginners
else if (selection = * 'M');  I am trying to get 2 numbers 2 multiply and i keep getting this error illegal start of expression else... + number2)); else if (selection = - 'S') System.out.println(number1
jstl if else
In this section we have discussed about how to implement if-else tag in JSTL..., as their is not default value. Hence, if-else tag is not implemented directly but is implemented with the help of some tags: <c:choose> tag : works like if-else
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
PHP Else Construct
Else Construct: Else construct is generally used when a previous condition does not met, it means that we place the else construct after if statement and if  'if statement' does not met, then the else part
Comparing arrays not working correctly?
Comparing arrays not working correctly?  Comparing arrays not working correctly
Update not working in hibernate.
Update not working in hibernate.  Update not working in hibernate
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
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
html dropdown not working firefox
html dropdown not working firefox  I am writing a Dropdown code in HTML which is not working in firefox. What could be the reason as it's perfectly working in IE and Crome. Thanks
calender working in struts - Struts
calender working in struts  when i execute the following code ,that is working properly if i convert to struts html tags that code is not working please help me to rectify the problem
IF-Else Conditional Statement
IF-Else Conditional Statement Conditional Statements are used to carry out actions based on condition. If-Else is also a conditional statement used... the following conditional statement : if statement if...else statement
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
file_exists php not working
file_exists php not working  file_exists php not working. Please give me the simple example
code not working properly
code not working properly  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException..._default.jsp"; } else
Dynamic-update not working in Hibernate.
Dynamic-update not working in Hibernate.  Why is dynamic update not working in hibernate?   Dynamic-update is not working. It means when you are running your update, new data is added in your table in place
Working of POS Terminal
Working of POS Terminal  Hi there, thanks for this post. Just curious how actual POS terminal will interact with PHP. PHP doesn't provide hardware interaction. Thanks for reply. Regards
UIWebView zoom not working
UIWebView zoom not working  Hi, I don't know why UIWebView zoom not working? Tell the solution. Thanks   Hi, Open the .xib file and set scalesPageToFit to YES. Thanks
'if' Statement - 'else if' style
Java Notes'if' Statement - 'else if' style Series of tests It is common to make a series of tests on a value, where the else part contains only another if statement. If you use indentation for the else
StandardServiceRegistryBuilder not working in Hibernate 4.3.1
StandardServiceRegistryBuilder not working in Hibernate 4.3.1  Hi, It seems that the StandardServiceRegistryBuilder not working in Hibernate 4.3.1.... working with the Hibernate 4.3.1 and it is giving following error message: Access
background images in css not working
background images in css not working  In the application i'm passing a background image from CSS in the given format ... background-image: url("Image\backgroundImage.GIF"); which is not working. So, please give me an example
calculate working hour
calculate working hour  why echo not come out? <html><body> <form action="<?php $_SERVER['PHP_SELF'];?>" method="post"> Working hour : <input name="workout" type="text"/><input name="submit1
php <? ?> tag not working
php tag not working  why PHP tags not working in my application?   This might happen when your shortopentag is turned off. So, you will have to turn it on by changing the status of this PHP tag in php.ini file. Here
Working with Eclipse IDE - Struts
Working with Eclipse IDE  hello, i am beginner to eclipse . i want to run my first struts program in eclipse 3.2. what are the steps for running struts in eclipse . Any body plz, tell me the setting environment of eclipse
command prompt is compilation is not working
command prompt is compilation is not working   Dear java users can anyone help me to run the program in command line prompt i tried by selecting the environment variable and class path and path in my system my program
Operators; If, Else, Elseif; Loops
 3.9. Operators; If, Else, Elseif; Loops Conditional Statements If, Else, Elseif are called the Conditional statements that are used for performing... be true as it sets $ Studentname to Ajay. 3.9.2. if...else statement
window.open() not working - Ajax
is that the pop up window is not at all working.. Once I click the button, the page
 

 

 

DMCA.com