Further advice needed on my last question 1 Answer(s) 2 years and 11 months ago
Posted in : JSP-Servlet
Dear Experts,
I refer to your last solution regarding my matching codes.
After I tried out your solution, I get alot of errors..
.Netbean IDE mpiling 1 source file to C:\Documents and Settings\build\generated\classes
C:\Documents and Settings\enter_jsp.java:132: 'catch' without 'try' } catch (Throwable t) { ^ C:\Documents and Settingsapache\jsp\enter_jsp.java:132: ')' expected } catch (Throwable t) { ^ C:\Documents and Settingsenter_jsp.java:132: not a statement } catch (Throwable t) { ^ C:\Documents and Settingsbuild\generated\src\org\apache\jsp\enter_jsp.java:132: ';' expected } catch (Throwable t) { ^ C:\Documents and Settings\enter_jsp.java:139: 'finally' without 'try' } finally { C:\Documents and Settings\enter_jsp.java:43: 'try' without 'catch' or 'finally' try { C:\Documents and Settingsjsp\enter_jsp.java:143: reached end of file while parsing } 7 errors
Here are my codes which I modified but basically followed your logic:-
<%String id = request.getParameter("id"); if (id != null) {%> try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:PracticalODBC"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM parents where strNRICNOME ='" + id + "'");
<table border="1"> <tr> <th>Parents NRIC No</th> <th>Parents Name</th> <th>Subjects to be tutored</th> <th>Parents Contact No</th> <th>Location</th> <th>Tutors NRIC No</th> <th>Tutors Name</th> <th>Tutors Contact No</th> <th>Tutors Location</th> String sub = "", location = ""; while (rs.next()) { sub = rs.getString("strSubjectsME"); location = rs.getString("strAddress"); } ResultSet res = st.executeQuery("SELECT FROM parents, memberparticulars WHERE memberparticulars.strSubject = '" + sub + "' + memberparticulars.strLocation = '" + location + "' and strNRICNOME = '" + id + "' "); while(res.next()){ <tr> <td><%=res.getString("strNRICNOME")%></td> <td><%=res.getString("strFullNameME")%></td> <td><%=res.getString("strSubjectsME")%></td> <td><%=res.getString("strContactME")%></td> <td><%=res.getString("strLocationME")%></td> <td><%=res.getString("strNRICNO")%></td> <td><%=res.getString("strTutorName")%></td> <td><%=res.getString("strContact")%></td> <td><%=res.getString("strAddress")%></td> <td><input type=button value="Get" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick='info("<%=sub%>","<%=location%>")'></td></tr> } } </table> } catch(Exception e) { out.println("An error occurred: " + e); } </BODY> </HTML>
I have tried and tried, putting the try and catch but still can't get it right. I really hope you will advise me the correct way to do it. Once again, thank you very much for your help and patience.
View Answers
June 21, 2010 at 3:27 PM
Hi Friend,
We have modified your code. You haven't close scriptlet tag and braces in few places therefore error occurs.Here is your code:
<%String id = request.getParameter("id"); if (id != null) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:PracticalODBC"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM parents where strNRICNOME ='" + id + "'"); %> <table border="1"> <tr> <th>Parents NRIC No</th> <th>Parents Name</th> <th>Subjects to be tutored</th> <th>Parents Contact No</th> <th>Location</th> <th>Tutors NRIC No</th> <th>Tutors Name</th> <th>Tutors Contact No</th> <th>Tutors Location</th> <% String sub = "", location = ""; while (rs.next()) { sub = rs.getString("strSubjectsME"); location = rs.getString("strAddress"); } ResultSet res = st.executeQuery("SELECT FROM parents, memberparticulars WHERE memberparticulars.strSubject = '" + sub + "' + memberparticulars.strLocation = '" + location + "' and strNRICNOME = '" + id + "' "); while(res.next()){ %> <tr> <td><%=res.getString("strNRICNOME")%></td> <td><%=res.getString("strFullNameME")%></td> <td><%=res.getString("strSubjectsME")%></td> <td><%=res.getString("strContactME")%></td> <td><%=res.getString("strLocationME")%></td> <td><%=res.getString("strNRICNO")%></td> <td><%=res.getString("strTutorName")%></td> <td><%=res.getString("strContact")%></td> <td><%=res.getString("strAddress")%></td> <td><input type=button value="Get" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick='info("<%=sub%>","<%=location%>")'></td></tr> <% } %> </table> <% } catch(Exception e) { out.println("An error occurred: " + e); } } %> </BODY> </HTML>
Thanks
Related Pages:
Further advice needed on my last question - JSP-Servlet Furtheradviceneeded on mylast question Dear Experts,
I refer to your last solution regarding my matching codes.
After I tried out your... errors
Here are my codes which I modified but basically followed your logic
further clarification needed - Java Beginners further clarification needed Dear Experts,
I refer to the last...-University Level.
Some tutors will enter more sujbects.
So, my query will have to change to %LIKE% is it?
How do I include query like that into my query
Clarify my last question's answer - Java Beginners
Clarify mylastquestion's answer Dear expert,
I've tried out... did not specify myquestion too clearly.
Here's my 2 database... and parents contain other fields like name, address, email, contact numbers etc.
My
last question last question
Input the name and marks of 25 students and compute the average. Print out the name and average of each student.
(You can do this using an array or without using an array
question
;/tr>
</table>
this is my jsp page
package servlet;
import java.io.... Last Name:");
l4=new JLabel("Employee Address:");
l5=new JLabel...:");
l16=new JLabel("Employee First Name:");
l17=new JLabel("Employee Last Name
my question my question "Write a C/C++ program to show the stored procedure PROCRESETMAIL" on database "USER_NOTIFY
my question my question "Write a C/C++ program to show the stored procedure PROCRESETMAIL" on database "USER_NOTIFY
help Needed with requirements
help Needed with requirements Following are my requirements :
* Maintain a student database
*Based on a student's test results ,reports should be generated so as to project details such as a students weakness in a particular
my question - EJB my question is it possiable to create web application using java beans & EJB's with out implementing Servlets and jsps in that java beans and EJB's
solve my question shortly
solve myquestion shortly <html>
<head>
<script>
function checkphoneNumber(number){
if(/[^\d ]/.test(number)){
alert('It should contain numbers [0-9] only!');
document.getElementById
Code Help Needed
off last time. It will also systematiclly fill in the arrays.
{
System.out.println("Please enter student's last name, Enter end to quit
my question is related to my project viz myquestion is related to my project viz Sir, my project is based on MR tracking system developed using struts framework, it has been developed in Net Beans the whole project is working except a jsp page named dayplan.jsp
Please clarify my doubt
[] args)
{
new Deadlock();
}
}
Myquestion is that class A has 2...Please clarify my doubt /here is my sample code for deadlock/
class...();
}
synchronized void last()
{
System.out.println("Inside
Question Question When there is an exception in my program how java runtime system handles
Question
Question Sir,
which is more better and good to study in struts1 or struts2.compare these two and give me an advice to select of them.reply me as soon as possible.
Please visit the following links:
http
question
question dear sir/madam
myquestion is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question Dear sir
i had some typing mistake at previous question
so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
A question
contains further 2 subfolders named "classes" and "lib" and a "web.xml" page.
The "classes" folder contains further a subfolder "package1"."package1" further
servlet redirect problem help needed
will move to the last location which is stored in string obj... out and also execute the last portion of the code...and giving error
i thought... when the first re.forward(req, resp); executes...and what whappen when the last
servlet redirect problem help needed
will move to the last location which is stored in string obj... out and also execute the last portion of the code...and giving error
i thought... when the first re.forward(req, resp); executes...and what whappen when the last
clarify my question - Java Beginners
clarify my question Dear Sirs/Expert,
Thanks for writing back.
Yes. I want a page to use id of parents to do the search for the match.
So... the matching tutors to the parent.
I was telling you that my degree
question
could get the last results only from resultset,please correct this
how to set
PHP help needed - Development process
PHP help needed This is my code that I am using for search engine, can any body answer how to cheange the code if I want limited and per page result display???
code
Career Search result
Yami says
<?php
question
question Sir ,
i have a starting trouble to start my search engine project , please help me to start my project , please send me some relevant java codes
QUESTION
QUESTION please atach java tutorial to my email
Hello Friend,
Please visit the following link:
Java Tutorial
Thanks
question
question i am using this code in my project
response.sendRedirect("LoginForm1.jsp?msg=Username or Password is incorrect!");
but i wan't to hide this message from url.please help me
question
question Sir,
how to display web snippets for a perticular query
for eg:web snippets for apple
how to implement this concept in my java project
please help me
question
question i need to mark employees as half day absent who came after 10'o clock in my web project,so i need to know who are all late entry.if you have any idea using jsp and mysql please help me
question
question Sir,
i am developing a video streaming PC server to j2me client system that the j2me player can playing video from PC server .if have any code for video streaming then send to my email address as soon as possible
Question? Question? Myquestion is how to:
Add a menu bar to the program with a File menu.
In the File menu, add a submenu (JMenuItem) called About.
When the user clicks on the About menu item, display a JOptionPane message dialog
question
/) is not available.**
how tdo i solve this.please help me to run my project
please give
question
question i am using this code in my project
response.sendRedirect("LoginForm1.jsp?msg=Username or Password is incorrect!");
but i wan't to hide this message from url.please help me.
you gave me the response Hi Jamsiya
question
question following is my code to sent mail but i couldn't work with eclipse ,that have some errors .need i any set up in eclipse or tell to what can i do to work code properly.
<%@ page import="java.io." import="java.lang.
Regarding My 3rd Question in Java - Swing AWT
Regarding My 3rd Question in Java sir in Netbeans By default JTable Columns will appear Horizontal like
Title1 Title2 Title3 Title4
in below these our data will appear so myquestion that is there any method
Some additions for my previous question - Java Beginners
Some additions for my previous question This is the question I posted several hours ago:
"I'm trying to write a program that has a text field... for the GUI. Could anyone please help?"
So my other two questions are:
1
urgent help needed in JDBC AND JAVA GUI - JDBC
urgent help needed in JDBC AND JAVA GUI my application allows a student to open a savings account , the student has to submit his or her names,faculty,course,year of study,university,telephone contact and email address
Help needed for Form Validation please help!
Help needed for Form Validation please help! I have created a page which has login as well as Signup fields. I validated the login part by using jsp...=fname><br>
Last Name <input type=text name=lname><br>
Taj mahal tour packages information needed
Taj mahal tour packages information needed Hi,
I am planning to visit Taj Mahal with my friends next week. Can anyone suggest me the Taj Mahal tour package along with tour around Taj Mahal?
Thanks
Hi,
I think
Pointing last index of the Matcher
Pointing last index of the Matcher
 ... and also indicate the last index of the matcher using expression.For this we..._end.java are described below:-
String text = "My name is Tim.In October Tim
JDBC: Last Inserted Id Example
JDBC: Last Inserted Id Example
In this tutorial, you will learn how to find last inserted record ID using
JDBC API.
Getting Last Inserted ID : Last
inserted Id is required for further insertion, so that you use correct id for
next
Help needed on java standalone app and default browser interaction.
Help needed on java standalone app and default browser interaction. Hi Developers and tutors,
Is anyone able to guide on how am i able to extract the url thats displaying on my default browser to my java standalone application
Java Get Last Line of File
, that is further printed by System.out.println.
Finally the last line of file is printed...
Java Get Last Line of File
 ... you in understanding
Get Last Line of File in Java . For this we have a class
to know my answer
to know my answer hi,
this is pinki, i can't solve myquestion "how to change rupee to dollar,pound and viceversa using wrapper class in java." will u help me