Link to home
Start Free TrialLog in
Avatar of LarryAndro
LarryAndro

asked on

Class Call Failure

My call to a class does nothing!  (I'm trying to write rows to a table.)  My environment is...

- Start Tomcat
- Start browser and invoke index.jsp
- Click on link taking me to Application_EnterEdit.html
- Call to java class populates table (what doesn't work)

Here's the top of Application_EnterEdit.html...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import="gov.vha.hvm.deliveryservice.scs.jsp.Subscriptioncalls" %>
<%@ page import="java.io.Writer" %>
<html>
<head>
<title></title>


In Application_EnterEdit.html, here's my call to the java class...

<table id="appList" class="sortable" cellspacing="10">
<thead>
<tr>
     <th>Name</th>
     <th>Description</th>
</tr>
</thead>
<tbody>
<% Subscriptioncalls.tblLoadApps(out); %>            <--- right here
</tbody>
</table>

Here's my class...

package gov.vha.hvm.deliveryservice.scs.jsp;

import java.io.IOException;
import java.io.Writer;

public class Subscriptioncalls {
 
  public static void tblLoadApps(Writer out){
         try {
            out.write("<tr><td>abc</td><td>def</td></tr>\n");
        } catch (IOException e) {
            e.printStackTrace();
        }
  }
}

What am I doing wrong?  Why aren't rows added to table?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LarryAndro
LarryAndro

ASKER

I'll change from html to jsp.  

Whether that fixes the problem or not, that makes sense... I take it you can't shell out to a java class from a html.  Right?

Thx, LJA
>>I take it you can't shell out to a java class from a html.  Right?

Right. html files are not compiled into servlets. jsp files are
Now, I'm getting the following error message?  Any ideas?
Thx...

HTTP Status 500 -

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

type Exception report

message

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

exception

javax.servlet.ServletException: org/apache/jsp/Index_jsp (wrong name: org/apache/jsp/index_jsp)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.NoClassDefFoundError: org/apache/jsp/Index_jsp (wrong name: org/apache/jsp/index_jsp)
      java.lang.ClassLoader.defineClass0(Native Method)
      java.lang.ClassLoader.defineClass(ClassLoader.java:539)
      java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
      java.net.URLClassLoader.access$100(URLClassLoader.java:55)
      java.net.URLClassLoader$1.run(URLClassLoader.java:194)
      java.security.AccessController.doPrivileged(Native Method)
      java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:192)
      org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:110)
      org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:585)
      org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:177)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.

Figured it out.  Here's the error...

javax.servlet.ServletException: org/apache/jsp/Index_jsp (wrong name: org/apache/jsp/index_jsp)
 
I noticed the different case of the name... Index vs index.  So, I stopped server, browser, and deleted all files in C:\Tomcat\work\Catalina\localhost\SCS\org\apache\jsp.  When I restarted, everything worked.
CEHJ, thanks for the html should be jsp help!
:-)