Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java and jsp codes

0 views
Skip to first unread message

CAESAR

unread,
Nov 11, 2009, 1:31:10 PM11/11/09
to
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>

CAESAR

unread,
Nov 12, 2009, 2:33:33 AM11/12/09
to
On Nov 11, 11:31 pm, CAESAR <rohit.agarwa...@gmail.com> wrote:

Both the files are in tomcat\webapps\root folder

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

Unable to compile class for JSP:

Lew

unread,
Nov 12, 2009, 9:41:26 AM11/12/09
to

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

In what directory is ReloadedClass.class deployed?

--
Lew

Lew

unread,
Nov 12, 2009, 9:46:15 AM11/12/09
to
CAESAR wrote:
>> On Nov 11, 11:31 pm, CAESAR <rohit.agarwa...@gmail.com> wrote:
>>
>> 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:

Lew wrote:
> 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.

--
Lew

0 new messages