Home Answers Viewqa JSP-Servlet How to give the value

 
 


Raja
How to give the value
1 Answer(s)      3 years and 3 months ago
Posted in : JSP-Servlet

How to give the value in following query..
"select * from studentinformation where studentid = '?'";

How to give the value into question mark?...
View Answers

February 24, 2010 at 4:10 PM


Hi Friend,

Try the following code:

<%@ page language="java" %>
<%@ page import="java.sql.*" %>

<%!
Connection conn = null;
ResultSet rs =null;
Statement st=null;
String query="";
int cid;
%>
<%
if(request.getParameter("cid")!=null){
cid=Integer.parseInt(request.getParameter("cid"));
}else {
cid=0;
}
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/register","root";, "root");
st = conn.createStatement();
rs = st.executeQuery("select * from student");
%>
<html>
<head>
<script type="text/javascript">

function view(){
var cid=document.getElementById("student").selectedIndex;
window.location.replace("http://localhost:8080/examples/jsp/combo.jsp?cid="+cid);
}
</script>
</head>
<body>
<select id="student" onchange="view(this)">
<option value="0">--Please Select--</option>
<% while(rs.next()){ %>
<option value='<%=rs.getInt("id")%>'><%=rs.getInt("id")%></option>
<%}%>
</select>
<%
rs = st.executeQuery("select * from student where id='"+cid+"'");
%>
<%
String name="";
while(rs.next()){
name=rs.getString("name");
}%>
<input type="text" value="<%=name%>">
</body>
</html>

Thanks









Related Pages:
How to give the value - JSP-Servlet
How to give the value   How to give the value in following query.. "select * from studentinformation where studentid = '?'"; How to give the value into question mark?...  Hi Friend, Try the following code
How to give value for select in HTML dynamically using javascript
How to give value for select in HTML dynamically using javascript  hi. Consider the situation i am having 2 select options called degree... should be displayed in the dept list. how to do this using javascript
how to get radio value
how to get radio value    how to retrive the option value and insert the next table pls give example
how to give link from jsp to jsp page
how to give link from jsp to jsp page  hi this is my following code... file is Modify but here i have to give modifyUser.jsp file but i don't khow how..." value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff
how to give link from jsp to jsp page
how to give link from jsp to jsp page  hi this is my following code... file is Modify but here i have to give modifyUser.jsp file but i don't khow how..." value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff
give idea
give idea  how to plot graph in java   Please visit the following link: http://www.roseindia.net/java/example/java/swing/draw-simple-bar-chart.shtml
How to give path to the Dfile?
How to give path to the Dfile?  Hello erveryone, I want to make... on sphinx, i have to give path to the sphinx4.jar file which is present in my... you give me the write path, please help me
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ...=" + document.getElementById('txtbx').value } <!-- function hideMe(){ // Hide...; <input type="submit" name="button" id="button" value="Accept
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ...=" + document.getElementById('txtbx').value } <!-- function hideMe(){ // Hide...; <input type="submit" name="button" id="button" value="Accept
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ...=" + document.getElementById('txtbx').value } <!-- function hideMe(){ // Hide...; <input type="submit" name="button" id="button" value="Accept
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ...=" + document.getElementById('txtbx').value } <!-- function hideMe(){ // Hide...; <input type="submit" name="button" id="button" value="Accept
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations ...=" + document.getElementById('txtbx').value } <!-- function hideMe(){ // Hide...; <input type="submit" name="button" id="button" value="Accept
how to validate javascriptcode n i am attaching file give validations
how to validate javascriptcode n i am attaching file give validations  <%@page import="java.sql.SQLException"%> <%@page import... = lnk.href + "?mdnno=" + document.getElementById('txtbx').value
Plz give java coding for this
iMin = 1, iMax = 8, iMid; // give max. value in even no. int jMin = 1, jMax = 12, jMid; // give max. value in even no. iMid = iMax / 2; jMid = jMax / 2...Plz give java coding for this  
GIVE ME A ANSWER
GIVE ME A ANSWER  Discuss the Number Class in the java.lang package   Number class is an abstract class extended by all classes..., and Double. The class contains abstract methods that convert the object value to any
give the code for this ques///
give the code for this ques///  write a program in java which... constructor initialize the value of a and b ,3 argument constructor initialize the value of c and 4 argument constructor initialize the value of d.Now call
how to give validation using javascript in swing
how to give validation using javascript in swing   how to give validation using javascript in swing....... can somebody give code for username and password validation using javscript and swing
How to Give button tool tip image
How to Give button tool tip image  In eclipse the same code is not working...not able to point to the image   Please visit the following link: Java Button Tooltip Image
CONVERT VALUE MONEY TO WORDS IN SQL?
CONVERT VALUE MONEY TO WORDS IN SQL?  i want to covert money or varchar value (like 7500000 ) in words like (75 lacs) then how to convert this value in this words . please give me solution
huffman code give the explanation for this code
huffman code give the explanation for this code  package bitcompress... = false; private BitFilter next_filter = null; private int value; private..._count = 0; value = 0; if (!encode_flag) bit_array = new boolean[256
huffman code give the explanation for this code
huffman code give the explanation for this code  package bitcompress... = false; private BitFilter next_filter = null; private int value; private..._count = 0; value = 0; if (!encode_flag) bit_array = new boolean[256
how to check particular value is avilable in hashmap - Java Beginners
how to check particular value is avilable in hashmap  Hi friends, i created a hashmap,in that hashmap key is tagginglist and value is tagsname,these tags is in the form arraylist.then how i will check particular tags
How to give tint color effect
How to give tint color effect Give the tint effect to your photo by this example. This effect will apply on the tree picture so follow this tutorial to learn complete. Take a Picture: Take any picture
How many ways we can give the output to a browser?
How many ways we can give the output to a browser?  How many ways we can give the output to a browser
How to save value in JSP
How to save value in JSP  Employee Name Time-IN Time-OUT... 324 2012-12-12 save i want to save dis value jsp to action ...how can i get all value ..and store..how can its values goes
how to archive cllocation value
how to archive cllocation value  hi, Am working with location based application, need to store cllocation value in array, for that i need to arhive it using NSKeyarchiver... haved searched on net but didnt find anything on how
how to archive cllocation value
how to archive cllocation value  hi, Am working with location based application, need to store cllocation value in array, for that i need to arhive it using NSKeyarchiver... haved searche not net but didnt find anything on how
how to create a bar chart in jsp by fetching value from oracle databse?
how to create a bar chart in jsp by fetching value from oracle databse?  i want to show the population of various states in a bar chart in my jsp..., but doesn't work and showing exceptions. Will you please give me a solution
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
How to move a value in array?
How to move a value in array?   Enter value at the End: 5 Display... value at the End again 8 Display Array Elements Index at [0]0 Index at [1]0 Index at [2]5 Index at [3]8 Enter value at the beginning: 7 Index at [0]7 Index at [1
How to move a value in array?
How to move a value in array?   Enter value at the End: 5 Display... value at the End again 8 Display Array Elements Index at [0]0 Index at [1]0 Index at [2]5 Index at [3]8 Enter value at the beginning: 7 Index at [0]7 Index at [1
Web Service - Which files we have to give to client and how they will use that
Web Service - Which files we have to give to client and how they will use... this web service or want to give it to client , for that which files i have to give. 2) In client side how they will use that, and how they call method from
please give me an idea to develop a program for this question?
please give me an idea to develop a program for this question?  How to enter a text or number from keyboard without using InputStreamReader method in java
How to add radio button value in a table for particular field?
How to add radio button value in a table for particular field?  Hi,I... one radio button for text field then it insert only one value absent OR present for every text field name so please give me some help to solving this problem my
how to set the value of textfield constant
how to set the value of textfield constant  how to set the value of textfield constant
how to get the checkbox value in jsp
how to get the checkbox value in jsp  how to get the checkbox value in jsp?   JSP CheckBox Example - how to get the checkbox value in jsp
sentinel value
sentinel value  how to count the number of red cars that assume 10 cars using sentinel value
Give difference between LinkedList and ArrayList - Java Beginners
Give difference between LinkedList and ArrayList  Hi, What is the use of LinkedList and ArrayList? How you can difference between LinkedList and ArrayList? Provide examples of each. Thanks   Hi Friend
sentinel value
sentinel value  how to count the number of red cars. Assume there are 10 cars.   how to count the number of red cars that assume 10 cars using sentinel value
Min Value
Min Value   How to access min value of column from database table?   Hi Samar, You can access minimum value of column from database...(selectQuery); System.out.println("Min Value : " +query.list().get(0
how to select second combobox value .
how to select second combobox value .  I requirement is , i have two combo box, i am selected first combo box value then automatically second combo box value show ,But this both combo box value i retrieves in database. please
How to get enum value in Java
How to get enum value in Java  Hi all, i am looking for a solution to get an enum value from index in Java. Please suggest. Thanks
Update value
Update value  How to update value of database using hibernate ?   Hi Samar, With the help of this code, you will see how can update database using hibernate. package net.roseindia.DAO; import
How to change the checkbox value dynamically.
How to change the checkbox value dynamically.  Hi, I am using struts 1.2 checkbox tag. Requirement is on page load the value must be "true... i am unchecked the box it is showing the value as"true". please suggest me
sentinel value
sentinel value  how to count the number of red cars. Assume there are 10 cars
How to pass value of a link to a textfield
How to pass value of a link to a textfield  Dear Sir, in my project I'm initially making a value of the textfield as a link. Now, I want to pass the value of the link in the textfield after clicking the link and dont want to open
how to set value of dropdown list
how to set value of dropdown list  Hello Sir, I'd solved the earlier problems somehow but now this time another problem arised when I want to pass the value from a link to a dropdown list. I want to set the dropdown list selected
how to set value of dropdown list
how to set value of dropdown list  Hello Sir, I'd solved the earlier problems somehow but now this time another problem arised when I want to pass the value from a link to a dropdown list. I want to set the dropdown list selected
how to insert value in dynamic table
how to insert value in dynamic table  i am creating a project in Training and Placement.i have a created a company register part where i create... student table. and company and year value i'm getting through company table.but apache
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.