A basic tomcat question  
Author Message
Doug Lowe





PostPosted: 2005-1-28 1:08:00 Top

java-programmer, A basic tomcat question Hi gang, Tomcat's not my area of expertise but I have to get some simple
things set up -- nothing fancy.

I'm having trouble getting classes & packages to work. The setup is Tomcat
5.5.4 & JDK1.5. I can get basic servlets and JSPs to work, but I'm having
trouble with user classes and packages. Here's an example:

tomcat\webapps\ROOT\Test\TestMovie.jsp
----------------------------------------
<#@ page import="testpackage" @>
<html>
<body>
<% Movie m = new Movie("Gone With the Wind", 1936, 19.95); %>
<%= m.title %>
</body>
</html>

tomcat\webapps\ROOT\Test\WEB-INF\classes\testpackage\Movie.java
-------------------------------------------------------------------------
package testpackage;

public class Movie
{
public String title;
public int year;
public double price;

public Movie(String title, int year, double price)
{
this.title = title;
this.year = year;
this.price = price;
}
}


I've googled this & read the documentation, everything seems to say put all
the classes in packages, create a folder for the package under
WEB-INF\classes, and put the class files in the package folder, and that
should do the trick. But I must have something else missing. Any ideas?

Also, I don't know if this is related, but is there a trick to using new
featured of Java 1.5 in a JSP? I can't get the following JSP to compile:

<%@ page import="java.util.*" %>
<html>
<head>
<title>You're breaking my concentration.</title>
</head>
<body>
<% ArrayList<String> s = new ArrayList<String>();
%>
</body>
</html>

It complains about the first < in the scriptlet. Does that have to be
escaped somehow?

TIA,

--D



 
Wendy S





PostPosted: 2005-1-28 6:35:00 Top

java-programmer >> A basic tomcat question "Doug Lowe" <email***@***.com> wrote

> tomcat\webapps\ROOT\Test\TestMovie.jsp
> ----------------------------------------
> <#@ page import="testpackage" @>

Wouldn't that be import="testpackage.Movie" (or testpackage.*) ?

> <% ArrayList<String> s = new ArrayList<String>(); %>
> It complains about the first < in the scriptlet.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31269

--
Wendy S


 
Ryan Stewart





PostPosted: 2005-1-28 7:22:00 Top

java-programmer >> A basic tomcat question "Wendy S" <email***@***.com> wrote in message
news:ctbqa6$249$email***@***.com...
> "Doug Lowe" <email***@***.com> wrote
>
>> tomcat\webapps\ROOT\Test\TestMovie.jsp
>> ----------------------------------------
>> <#@ page import="testpackage" @>
>
> Wouldn't that be import="testpackage.Movie" (or testpackage.*) ?
>
Also, it's <%@ ... %>


 
 
Ryan Stewart





PostPosted: 2005-1-28 7:27:00 Top

java-programmer >> A basic tomcat question "Doug Lowe" <email***@***.com> wrote in message
news:41f91f1b$0$13893$email***@***.com...
[...]
> tomcat\webapps\ROOT\Test\WEB-INF\classes\testpackage\Movie.java
[...]
Did you put the class file there or just the source file?


 
 
Doug Lowe





PostPosted: 2005-1-28 13:18:00 Top

java-programmer >> A basic tomcat question D'oh!

Thanks, that was pretty stupid of me.

Now I'm wrestling with another problem related to JavaBeans -- It's probably
something just as dumb :)

--Doug

"Wendy S" <email***@***.com> wrote in message
news:ctbqa6$249$email***@***.com...
> "Doug Lowe" <email***@***.com> wrote
>
> > tomcat\webapps\ROOT\Test\TestMovie.jsp
> > ----------------------------------------
> > <#@ page import="testpackage" @>
>
> Wouldn't that be import="testpackage.Movie" (or testpackage.*) ?
>
> > <% ArrayList<String> s = new ArrayList<String>(); %>
> > It complains about the first < in the scriptlet.
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=31269
>
> --
> Wendy S
>
>