• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The server encountered an internal error () that prevented it from fulfilling this request

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I got following error when I was accessing a JSP page, which is qute a big


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

[code]org.apache.jasper.JasperException: /dbsave.jsp(3,0) The value for the useBean class attribute finalproject.Winterproject is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1272)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3426)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)[/code]


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.[/strike][/strike]


--------------------------------------------------------------------------------

Apache Tomcat/6.0.20



My project was a survey system.

A HTML page was described "Are you content with one specific mobile phone?"

so, I installed JDBC connector in between Tomcat\lib and Tomcat\webapps\Root\WEB-INF\lib

then,, I made one html and class which is installed in Tomcat\webapps\Root\WEB-INF\classes.

that's it is


and My dbsave.jsp is likly that.

[code]<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import="finalproject.Winterproject" %>
<jsp:useBean id="myBean" class="finalproject.Winterproject" scope="session"/>


<% request.setCharacterEncoding("euc-kr");

String contents= request.getParameter("ask");
String s1 = request.getParameter("ask1");
String s2 = request.getParameter("ask2");
String s3 = request.getParameter("ask3");
String s4 = request.getParameter("ask4");
String s5 = request.getParameter("ask5");
String s6 = request.getParameter("ask6");
String s7 = request.getParameter("ask7");
String s8 = request.getParameter("ask8");
String s9 = request.getParameter("ask9");
String s10 = request.getParameter("ask10");


myBean.setData(contents, s1,s2,s3,s4,s5,s6,s7,s8,s9,s10);

response.sendRedirect("team.html");
%> [/code]

[b]and my bean.jsp is likey that,[/b]


[code]<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import="finalproject.Winterproject"%>

<jsp:useBean id="myBean" class="finalproject.Winterproject" scope="session"/>

<%myBean.getData();
int[] id = myBean.getId();
String[] contents = myBean.getcontents();
String[] s1 = myBean.gets1();
String[] s2 = myBean.gets2();
String[] s3 = myBean.gets3();
String[] s4 = myBean.gets4();
String[] s5 = myBean.gets5();
String[] s6 = myBean.gets6();
String[] s7 = myBean.gets7();
String[] s8 = myBean.gets8();
String[] s9 = myBean.gets9();
String[] s10 = myBean.gets10();

%>

<html>
<body>
<table>
<tr>
<td>id</td>
<td>contents</td>
<td>s1</td>
<td>s2</td>
<td>s3</td>
<td>s4</td>
<td>s5</td>
<td>s6</td>
<td>s7</td>
<td>s8</td>
<td>s9</td>
<td>s10</td>


</tr>
<% for (int i = 0; i < id.length; i++) { %>

<tr>
<td><%= id[i] %></td>
<td><a href="#" onClick="javascript:window.open('dbsave.jsp? s1=<%= s1[i] s2=<%= s2[i] s3=<%= s3[i] s4=<%= s4[i] s5=<%= s5[i] s6=<%= s6[i] s7=<%= s7[i] s8=<%= s8[i] s9=<%= s9[i] s10=<%= s10[i] %>','
','scrollbars=yes, toolbar=no, height=600, width=800, resizable=no')"><%= contents[i] %></a></a></td>
<td><%= s1[i] %></td> <td><%= s2[i] %></td> <td><%= s3[i] %></td> <td><%= s4[i] %></td> <td><%= s5[i] %></td>
<td><%= s6[i] %></td> <td><%= s7[i] %></td> <td><%= s8[i] %></td> <td><%= s9[i] %></td> <td><%= s10[i] %></td>
</tr>


<%
}
%>
</table>
<br>
<a href="#" onClick="javascript:window.open('team.html', '', '')">새 설문조사 입력</a></td>
</body>
</html>[/code]

[b]And last one is class information.[/b]

package finalproject;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Winterproject
{
Connection conn = null;
Statement stmt = null;

int count = 0;
int[] id = null;
String[] contents = null;
String[] s1 = null;
String[] s2 = null;
String[] s3 = null;
String[] s4 = null;
String[] s5 = null;
String[] s6 = null;
String[] s7 = null;
String[] s8 = null;
String[] s9 = null;
String[] s10 = null;


public Winterproject()
{
try
{
Class.forName("org.gjt.mm.mysql.Driver");
String URL = "jdbc:mysql://localhost:3306/survey";
conn = DriverManager.getConnection(URL, "root", "mysql");
stmt = conn.createStatement();
}
catch(ClassNotFoundException e)
{
System.out.println("Class Not Found");
}
catch(SQLException e)
{
System.out.println("SQL Error");
}
}
public void getData()
{
try {
String query = "SELECT count(*) FROM teamproject";
ResultSet rs = stmt.executeQuery(query);

while(rs.next())
count = rs.getInt(1);

id = new int[count];
contents = new String[count];
s1 = new String[count];
s2 = new String[count];
s3 = new String[count];
s4 = new String[count];
s5 = new String[count];
s6 = new String[count];
s7 = new String[count];
s8 = new String[count];
s9 = new String[count];
s10 = new String[count];



query = "SELECT * FROM teamproject";
rs = stmt.executeQuery(query);

for(int i = 0; i < count; i++)
{
rs.next();
id[i] = rs.getInt(1);
contents[i] = rs.getString(2);
s1[i] = rs.getString(3);
s2[i] = rs.getString(4);
s3[i] = rs.getString(5);
s4[i] = rs.getString(6);
s5[i] = rs.getString(7);
s6[i] = rs.getString(8);
s7[i] = rs.getString(9);
s8[i] = rs.getString(10);
s9[i] = rs.getString(11);
s10[i] = rs.getString(12);
}
}
catch (SQLException e)
{
}

for(int i = 0; i < count; i++)
System.out.print(id[i] + ", " + contents[i] + ", "
+ s1[i] +", " + s2[i] +", " + s3[i] +", "
+ s4[i] +", " + s5[i] +", " + s6[i] +", "
+ s7[i] +", " + s8[i] +", " + s9[i] +", "
+ s10[i] +"\n");
}
public void setData(String contents, String s1, String s2, String s3, String s4, String s5,
String s6, String s7, String s8, String s9, String s10)
{
PreparedStatement pstmt = null;

try
{
String query = "select max(id) from teamproject";
int maxId = 0;

ResultSet rs = stmt.executeQuery(query);
while(rs.next())
maxId= rs.getInt(1);

query = "insert into teamproject values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

pstmt = conn.prepareStatement(query);
pstmt.setInt(1, maxId + 1);
pstmt.setString(2, contents);
pstmt.setString(3, s1);
pstmt.setString(4, s2);
pstmt.setString(5, s3);
pstmt.setString(6, s4);
pstmt.setString(7, s5);
pstmt.setString(8, s6);
pstmt.setString(9, s7);
pstmt.setString(10, s8);
pstmt.setString(11, s9);
pstmt.setString(12, s10);

pstmt.executeUpdate();


} catch (SQLException e) {
}
}


protected void finalize()
{
try {
if(stmt != null)
stmt.close();

if(conn != null)
conn.close();
} catch (SQLException e) {
}
}

public static void main(String[] args)
{
Winterproject tb = new Winterproject();
tb.getData();
}

public int[] getId()
{
return id;
}

public String[] getcontents()
{
return contents;
}

public String[] gets1()
{
return s1;
}
public String[] gets2()
{
return s2;
}
public String[] gets3()
{
return s3;
}
public String[] gets4()
{
return s4;
}
public String[] gets5()
{
return s5;
}
public String[] gets6()
{
return s6;
}
public String[] gets7()
{
return s7;
}
public String[] gets8()
{
return s8;
}
public String[] gets9()
{
return s9;
}
public String[] gets10()
{
return s10;
}

};



What is problem?


Please!!!

Could you Help me !!!


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.
 
daewoo lee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thaks you. Yor mention. I don't know this posting system. BUy, Now , I got it
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would follow my suggestion and edit the post to be more readable.
 
reply
    Bookmark Topic Watch Topic
  • New Topic