Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > A basic tomcat question

Reply
Thread Tools

A basic tomcat question

 
 
Doug Lowe
Guest
Posts: n/a
 
      01-27-2005
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



 
Reply With Quote
 
 
 
 
Wendy S
Guest
Posts: n/a
 
      01-27-2005
"Doug Lowe" <> 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


 
Reply With Quote
 
 
 
 
Ryan Stewart
Guest
Posts: n/a
 
      01-27-2005
"Wendy S" <> wrote in message
news:ctbqa6$249$...
> "Doug Lowe" <> wrote
>
>> tomcat\webapps\ROOT\Test\TestMovie.jsp
>> ----------------------------------------
>> <#@ page import="testpackage" @>

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

Also, it's <%@ ... %>


 
Reply With Quote
 
Ryan Stewart
Guest
Posts: n/a
 
      01-27-2005
"Doug Lowe" <> wrote in message
news:41f91f1b$0$13893$. ..
[...]
> tomcat\webapps\ROOT\Test\WEB-INF\classes\testpackage\Movie.java

[...]
Did you put the class file there or just the source file?


 
Reply With Quote
 
Doug Lowe
Guest
Posts: n/a
 
      01-28-2005
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" <> wrote in message
news:ctbqa6$249$...
> "Doug Lowe" <> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat question - running tomcat webapp from root Sean Berry Java 3 12-19-2005 07:19 PM
Tomcat 4.1.31 - huge count of webapps, Tomcat hangs up Martin Eberle Java 2 12-03-2004 07:10 PM
Tomcat Web application manager - Virtual host Tomcat 4.30 + Apache2 + JK2 connector with multi IPs Joe Java 0 07-12-2004 03:06 PM
Apache Tomcat 4.1.24: problem with Tomcat Administration link Christos Gravvanis Java 0 07-07-2004 05:21 PM
[TOMCAT] Tomcat crashes %=zerointeractive.it% Java 1 01-22-2004 12:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57