Hi,

i need to retrieve the combo box value to the string parameter in the same page parameter for checking condition is it possible in JSP ?

<%@ page import="java.io.*"%>
<%@ page import="java.sql.*"%>
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" session="true"%>
<HTML>
 <HEAD>
      <TITLE>Trail</TITLE>
       </head>

  <body bgcolor="#00000" text="white" >


<form name="frm" method="POST" >

<div align="center">

  <table border="0" height="300" width="1090" colspan="4" text="blue" bgcolor="#000000">
<tr>
<td align="left">
  <select name="year">
     <option value="Select Year">Select Year</option>");
  <%
    for(int i=2009;i<2012;i++)
  {
	  
	  out.println("<option value="+i+">"+i+"</option>");
  }
  %>
   </select>
</td>
</tr>
<tr><td>
<%
String ss34 = request.getParameter("year");
out.println(ss34);

Connection con2 = null;
PreparedStatement stmt2=null;
PreparedStatement stmt3=null;
Connection con3=null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

con2 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","bgl","bgl");

 [B]String class_name=request.getParameter("year");[/B]
out.println("Year.........................."+class_name);
stmt2 = con2.prepareStatement("select * from vapco where qty_sets ='MONTH PLAN -FBD'");
ResultSet rs2=stmt2.executeQuery();
%>
</form>
</BODY>
</HTML>

i need to get the selecting value in class_name parameter.

How can i get please help me.

You need to separate view from logic, meaning move that database connectivity to a class that will be called by servlet and do not do this in JSP. Check out MVC tutorial at the top of JSP section for more suitable approach

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.