1.11M Members

I need to retrieve the combo box value ?



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"
<%@ page language="java" session="true"%>

  <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">
<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>");
String ss34 = request.getParameter("year");

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]
stmt2 = con2.prepareStatement("select * from vapco where qty_sets ='MONTH PLAN -FBD'");
ResultSet rs2=stmt2.executeQuery();

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

This article has been dead for over six months: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: