1,105,625 Community Members

I need to retrieve the combo box value ?

Member Avatar
jeraldmuthu
Newbie Poster
15 posts since Jan 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
peter_budo
Code tags enforcer
7,939 posts since Dec 2004
Reputation Points: 2,502 [?]
Q&As Helped to Solve: 1,028 [?]
Skill Endorsements: 66 [?]
Moderator
Featured
 
0
 

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

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