Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

headache can someone help me in this

 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

actually i want to read the data inside the vector then put it inside the textbox value to make it can be post to the next page. how i need to do this
[ March 12, 2007: Message edited by: Bear Bibeault ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your html tags are not correct. Some quotations are missing.
You'd better write a simple JSP page and forward the request to it after getting the necessary data.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i already change my page but i still getting error:
An error occurred at line: 65 in the jsp file: /report.jsp
Generated servlet error:
add cannot be resolved


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


What is this proble actually or have other method to let me do this?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're declaring the "String add" in the for loop, so it will not be visible outside that loop. You should declare it outside.
Sorry, I can't help more, I have a very bad connection this week
 
sreekanth nair
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this



<%@ page import="java.net.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>Untitled</title>
</head>

<body>
<%
Vector mail = new Vector();
try{
Class.forName("com.mysql.jdbc.Driver");
}
catch (Exception E) {
out.println("Unable to load driver.");
E.printStackTrace();
}
try{

Connection C = DriverManager.getConnection("jdbc:mysql://localhost/attendance","root","");
%>
<div align="center"><font size="+6">Student BarList</font><br>
In this page will display out the student that attendance NOT MORE THAN 70%. The Student Below is NOT ALLOW to take exam for the relevant subject.
The student whoever not satisfy with the bar can negotiate with the lecturer of the relevant subject.<p/>
The student below will be bar from the relevent subject:<br/>

<%
Statement S = C.createStatement();
ResultSet rs = S.executeQuery("SELECT * FROM bar");
ResultSetMetaData rsStruc = rs.getMetaData();
out.println("<table bgcolor=red cellpadding=10 cellspacing=1 size=70>");
out.println("<tr bgcolor=red>");
int colCount = rsStruc.getColumnCount();
String colName = "";
for(int i=1;i <= colCount; i++){
colName = rsStruc.getColumnName(i) ;
out.println("<td><B><font color=white>" + colName + "</font></b></td>\n");
}
out.println("</tr>");
while (rs.next()) {
String email=rs.getString("email");
mail.addElement(email);
out.println("<tr bgcolor='ffffff'>");
for(int i=1;i <= colCount; i++){
colName = rsStruc.getColumnName(i) ;

String fld = rs.getString(colName);
out.println("<td>" + fld + "</td>");
}
out.println("</tr>");
}
out.println("</table>");
rs.close();
C.close();}
catch (Exception E) {
out.println("SQLException: " + E.getMessage());
}
String add = "";
for(int i=0; i< mail.size(); i++){
add = mail.elementAt(i)+",";
out.println(add);
}
%>
<form action="simplemail.jsp" method="post">
<input type="text" name="address" value="<%=add%>">
<input type="submit" name="send" value="Send Mail">
</body>
</html>
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
declare at outside just ca let me to get the last data in the vector
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic