i want to display where i entered values to same page

i want to display where i entered values to same page

hi friends !!

i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format.

View Answers

May 23, 2013 at 3:11 PM

hi friend,

Try the following code, may this will be helpful for you

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Student Record</title>
</head>
<body>
<h2>Student Record</h2>
<form action="#" method="post">
<div>
<div align="left">
<table>
<tr>
<td>
Select Course <select name="course">
<option value="select">select</option>
<option value="MCA">MCA</option>
<option value="BCA">BCA</option>
</select>
</td>
<td></td>
<td align="right">Enter Roll No</td>
<td><input type="text" name="roll"/></td>
</tr>
</table>
</div>
<div>
<table>
<tr>
<th>Subject</th>
<th>Obtained Marks</th>
<th>Full Marks</th>
</tr>
<tr>
<td align="center">C</td>
<td align="center"><input type="text" size="5" name="c"/></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">Java</td>
<td align="center"><input type="text" size="5" name="java"/></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">.Net</td>
<td align="center"><input type="text" size="5" name="net"/></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">VB</td>
<td align="center"><input type="text" size="5" name="vb"/></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">DBMS</td>
<td align="center"><input type="text" size="5" name="dbms"/></td>
<td align="center">100</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr><td></td><td align="center"><input type="submit" value="submit"/></td></tr>
</table>
</div>
</div>
</form>

Continue....


May 23, 2013 at 3:13 PM

<%!
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/record";
String user = "root";
String psw = "root";
%>

<%
String c = request.getParameter("c");
String j = request.getParameter("java");
String n = request.getParameter("net");
String v = request.getParameter("vb");
String d = request.getParameter("dbms");
String course = request.getParameter("course");
String roll = request.getParameter("roll");
if(!(course == null || course.isEmpty()))
{
    if(!(roll == null || roll.isEmpty()))
    {
        if(!(c == null || c.isEmpty()))
        {
            if(!(j == null || j.isEmpty()))
                if(!(n == null || n.isEmpty()))
                    if(!(v == null || v.isEmpty()))
                        if(!(d == null || d.isEmpty()))
                        {
                            int cmarks = Integer.parseInt(c);
                            int jmarks = Integer.parseInt(j);
                            int nmarks = Integer.parseInt(n);
                            int vmarks = Integer.parseInt(v);
                            int dmarks = Integer.parseInt(d);
                            int rollNo = Integer.parseInt(roll);
                            int total = cmarks+jmarks+nmarks+vmarks+dmarks;
                            int avg = (total)/5;
                            int percent = avg;
                            String grade ="";
                            if(percent < 40){
                                grade = "E";
                                }
                            else if(percent >= 40 && percent <=44){
                                grade = "D";
                                }
                            else if(percent >=45 && percent <=49){
                                grade = "D+";
                                }
                            else if(percent >=50 && percent <=54){
                                grade = "C-";
                                }
                            else if(percent >=55 && percent<=59){
                                grade = "C";
                                }
                            else if(percent >=60 && percent <=64){
                                grade = "C+";
                                }
                            else if(percent >=65 && percent<=69){
                                grade = "B-";
                                }
                            else if(percent >=70 && percent <=74){
                                grade = "B";
                                }
                            else if(percent >=75 && percent <=79){
                                grade = "B+";
                                }
                            else if(percent >=80 && percent <=84){
                                grade = "A";
                                }
                            else if (percent >=85 && percent <=100){
                                grade = "A+";
                                }
                        %>

Continue...


May 23, 2013 at 3:15 PM

<div>
<div>
<table>
<tr>
<td align="left"><b>Course</b></td><td></td>
<td align="center"><%=request.getParameter("course") %></td>
<td align="right"><b>Roll No : </b></td>
<td align="center"><%=request.getParameter("roll") %></td>
</tr>
</table>
</div>
<div>
<table border="1">
<tr>
<th>Subject</th>
<th>Obtained Marks</th>
<th>Full Marks</th>
</tr>
<tr>
<td align="center">C</td>
<td align="center"><%=cmarks %></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">Java</td>
<td align="center"><%=jmarks %></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">.Net</td>
<td align="center"><%=nmarks %></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">VB</td>
<td align="center"><%=vmarks %></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center">DBMS</td>
<td align="center"><%=dmarks %></td>
<td align="center">100</td>
</tr>
<tr>
<td align="center"><b>Aggregate Marks</b></td>
<td align="center"><%=total %></td>
</tr>
<tr>
<td align="center"><b>Grade</b></td>
<td align="center"><%=grade %></td>
</tr>
</table>
</div>
</div>

Continue...

May 23, 2013 at 3:15 PM

<%
try{
Class.forName(driverName);
con = DriverManager.getConnection(url,user,psw);
String sql = "insert into sturecord values(?,?,?,?,?,?,?,?)";
ps = con.prepareStatement(sql);                             
ps.setInt(1, rollNo);
ps.setString(2, course);
ps.setInt(3, cmarks);
ps.setInt(4, jmarks);
ps.setInt(5, nmarks);
ps.setInt(6, vmarks);
ps.setInt(7, dmarks);
ps.setString(8, grade);
ps.executeUpdate();                             
out.println("Added Successfully");
}
catch(Exception e)
{
out.println(e);
}
finally
{
ps.close();
con.close();
}
}
}
}
}
%>

    </body>
    </html>









Related Tutorials/Questions & Answers:
i want to display where i entered values to same page
i want to display where i entered values to same page  hi friends !! i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format
i want to display where i entered values to same page
i want to display where i entered values to same page  hi friends !! i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format
Advertisements
i want to display where i entered values to same page
i want to display where i entered values to same page  hi friends !! i have a values from jsp page .and i want to store that values into DB at the same time i want to show immediatlly on same jsp page with tabular format
i want to update values
i want to update values  in my form i have 2 submit buttons one for edit and another for update on page load all my details need to fetch from database and it need to insert automatically in to disabled text boxs and once i press
I want to display 10,000 records in a jsp page.Can I display page by page?
I want to display 10,000 records in a jsp page.Can I display page by page?  When I submit a form it says "ERROR: Query request too large. Total rows... print page by page or have say 900 records per page in a jsp? Should I have
same thing i want but from db..
same thing i want but from db..  http://www.roseindia.net/tutorial/javascript/dynamicCombo.html same thing i want but from db
i want display integer number in a string of statement
i want display integer number in a string of statement  i want display integer number in a string of statement
I want to learn Machine Learning, where should I start?
I want to learn Machine Learning, where should I start?  Hi, I am... for the tutorials to learn: I want to learn Machine Learning, where should I start? Try... "I want to learn Machine Learning, where should I start?". Also tell me
I want display frame in another frame - Java Beginners
I want display frame in another frame  Hi all, this is available in jsps folder and Admin.jsp is main page i m taking two frame fisrt is header.jsp and another is footer.jsp I want to display footer.jsp is display
i want to retriev and update in same form but its not working pls help....
i want to retriev and update in same form but its not working pls help.... ...;div id="page"> <div id="header"> <a href="#"><h1...("refno"); re=stmt.executeQuery("select * from passapp where refno='"+refno
Want to display Arraylist items on same row in JSF
Want to display Arraylist items on same row in JSF  I want do display values of one arraylist on same row using datatable? If i use h:column, then it goes on different row. Please tell me, how I can do it?   Hi Friend
display results on same jsp page
display results on same jsp page  is there any method to display search results from database on the same jsp page where i give the inputs using struts 1.2
display results on same jsp page
display results on same jsp page  is there any method to display search results from database on the same jsp page where i give the inputs using struts 1.2
display results on same jsp page
display results on same jsp page  is there any method to display search results from database on the same jsp page where i give the inputs using struts 1.2
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p  Hi, I have designed a "back" button for jsp page. Now I want to disable Browser's default button So that people will use "back
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p  Hi, I have designed a "back" button for jsp page. Now I want to disable Browser's default button So that people will use "back
How can I output text typed in textarea by user on the same page?
How can I output text typed in textarea by user on the same page?  I have a basic HTML page where I have created a textarea for users comments. I would like to take the comments and append them to the same page for all to see
I want to learn maven
I want to learn maven  Hi, I have to work on the maven based projects in my company. So, I want to learn it in 5-6 days. How to start learning Maven? Can I learn Maven in 5-6 days. Thanks
how to store multiple values from drop down in database where i am using java struts 1.3
how to store multiple values from drop down in database where i am using java struts 1.3  hii, i am coding a form where i need a keyskills attribute where i have to select multiple keyskills. but it is taking only one valuee.. i
i want to learn Jquery
i want to learn Jquery  i want to learn jquery can u plz guide me   Yes, you can learn these technologies by yourself. Go through the following links: Ajax Tutorials JSON Tutorials JQuery Tutorials
I want this jsp answers
I want this jsp answers    How can we declare third party classes and interfaces inside our jsp page? How can we declare and definr global variables... for particular jsp pages? If we want to develop any jsp pages using eclipse where we can
I want this jsp answers
I want this jsp answers    How can we declare third party classes and interfaces inside our jsp page? How can we declare and definr global variables... for particular jsp pages? If we want to develop any jsp pages using eclipse where we can
display all the values on next page
when i return on first page it should display my selected values in textbox...display all the values on next page  i am inserting values... values are inserting in the database and i am moving on another page after
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap   i want to create invoice report .. help out asap
i want for statement codding
i want for statement codding  what is the for condition following out put 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
I want to update the multiple values of database depending on checkbox..? Please help me out..
I want to update the multiple values of database depending on checkbox..? Please help me out..   Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap
i want to create invoice report editable. values should be taken from dabase and editable .. help out asap   i want to create invoice report editable. values should be taken from dabase and editable .. help out asap
I want to learn maven
I want to learn maven  Hi, I have to work on the maven based projects in my company. So, I want to learn it in 5-6 days. How to start learning Maven? Can I learn Maven in 5-6 days. Thanks   Hi, First of all I would
i want code for these programs
i want code for these programs   Advances in operating system Laboratory Work: (The following programs can be executed on any available and suitable platform) Design, develop and execute a program using any
how can i display a editable result of form?
is display on text. i cant modify them. i have a form with hundreds of checkbox. i want to display form result in same page i have alredy created a hidden div which... display on same result div which is a part of form and in that div i have 2 buttons
Where can I learn JavaScript
Where can I learn JavaScript  Hi, I have HTML knowledge and now want to learn JavaScript. Which is the best tutorials to learn JavaScript? Where can I learn JavaScript? Thanks   Hi, JavaScript is programming
I want to display the quantity of the selected item of a drop down list in a textbox. The data is stored in database.
I want to display the quantity of the selected item of a drop down list in a textbox. The data is stored in database.  The code for retrieving data..."); pre = con.prepareStatement("select Quantity from library.booklist where Book
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.  I am reading...... } The output displays 4 rows and 2 columns. How can I calculate the total
i want to learn data science
i want to learn data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: i want... can learn the topic "i want to learn data science". Also tell me
i want to learn machine learning
i want to learn machine learning  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: i want... so that I can learn the topic "i want to learn machine learning"
I need Oracle connector jar file. where will i download?
I need Oracle connector jar file. where will i download?  I need Oracle connector jar file. where will i download
I want solution for this jsp program..
I want solution for this jsp program..   <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.sql.*" %> JSP Page <%! String
To Retain the values entered in the text box after submit in jsp page
To Retain the values entered in the text box after submit in jsp page  ... given all those. Now my problem is how can i retain those values entered in box after submit has been done ? coz when data is displayed then the values entered
display checked ckeckbox in same jsp page
_TO_REPLACE_2 Now i want to display ,selected checked checkboxes in another table in same... ckeckbox in same jsp page?   Hi, Here is the html code to display check..._TO_REPLACE_10 I want to display records, when i click on submit button or any dumy
i am getting multiple values in listbox
i am getting multiple values in listbox   hi sir, i am using... but i want only distinct names pls help me... table1 a,table2 b where a.stuno=b.stuno and b.recdate in(select max(recdate) from
I want to put user guide in pdf and word in side WEB-INF and need to give link on the home page
I want to put user guide in pdf and word in side WEB-INF and need to give link on the home page  I want to put user guide in pdf and word formats in side WEB-INF (for security reasons, I want these documents visible after user
display contents on the same page by selecting a radio button
display contents on the same page by selecting a radio button  Bill...")) { %> Due Date<input type="date" name="date"/> <% } %> i want... on the same page under the radio button
Where i can use UNIX Operating System?
Where i can use UNIX Operating System?  Where i can use UNIX Operating System
i want to pass Javascript value to JSP scriptlet..
i want to pass Javascript value to JSP scriptlet..  i am having a problem that, i am having a combo box in the JSP page when i select an item from... now i want to pass this value to JSP scriptlet
Where can I find a nice TensorFlow tutorial?
Where can I find a nice TensorFlow tutorial?  Hi, I am beginner in TensorFlow and trying to find nice tutorials of TensorFlow. Where can I find a nice TensorFlow tutorial? Thanks
Where can I find a nice TensorFlow tutorial?
Where can I find a nice TensorFlow tutorial?  Hi, I am beginner in TensorFlow and trying to find nice tutorials of TensorFlow. Where can I find a nice TensorFlow tutorial? Thanks
i want to create dynamic calendar in java
i want to create dynamic calendar in java  i want code and explanation
i want to create dynamic calendar in java
i want to create dynamic calendar in java  i want code and explanation
Do I learn ML and IoT at the same time
Do I learn ML and IoT at the same time  Hi, I want to make better... to learn first? Do I learn ML and IoT at the same time? Thanks   Hi, All... are very important. I advice you to start learning ML and also some time
Do I learn ML and IoT at the same time
Do I learn ML and IoT at the same time  Hi, I want to make better... to learn first? Do I learn ML and IoT at the same time? Thanks   Hi, All... are very important. I advice you to start learning ML and also some time

Ads