Java and jsp codes

C

CAESAR

the java code is:

package examples;

public class ReloadedClass
{
public static String getMessage()
{
return "This is the original message";
}
}


And the JSP code is :

<%@ page language="java" import="examples.*" %>
<html>
<body>

The message is: <%= ReloadedClass.getMessage() %>
</body>
</html>
 
C

CAESAR

Both the files are in tomcat\webapps\root folder

the java code is:

package examples;

  public class ReloadedClass
  {
     public static String getMessage()
      {
          return "This is the original message";
     }

}

And the JSP code is :

<%@ page language="java" import="examples.*" %>
  <html>
  <body>

  The message is: <%= ReloadedClass.getMessage() %>
  </body>
  </html>



The above code is giving an error..... that :

Unable to compile class for JSP:
 
L

Lew

CAESAR said:
Both the files are in tomcat\webapps\root folder





The above code is giving an error..... that :

Unable to compile class for JSP:

You should copy and paste entire error messages, not edited fragments or
paraphrases.

In what directory is ReloadedClass.class deployed?
 
L

Lew

You should copy and paste entire error messages, not edited fragments or
paraphrases.

In what directory is ReloadedClass.class deployed?

I ask because in a similar thread you started, others gave you advice about
putting the .class file in relative path rooted at the class path, and
"tomcat\webapps\root" is not a class path element. You should review that advice.

As with any Java .class file, ReloadedClass.class must reside in a
subdirectory corresponding to its package, in this case "examples/". The
canonical class path root for web applications is "WEB-INF/classes/" relative
to the context root. This is all clearly documented in the Tomcat documentation.
 
Joined
Dec 24, 2010
Messages
19
Reaction score
0
CAESAR said:
the java code is:

package examples;

public class ReloadedClass
{
public static String getMessage()
{
return "This is the original message";
}
}


And the JSP code is :

<%@ page language="java" import="examples.*" %>
<html>
<body>

The message is: <%= ReloadedClass.getMessage() %>
</body>
</html>

what if you use
<%@ page import="examples.*" %>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top