Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Importing packages in jsps  RSS feed

 
Hannah Redmond
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
im kind of new to jsps, although i have done a lot of java programming before.
Basically, whenever i try to run a jsp which requires an import ( <% import java.io.* %> ),
it wont, and displays the compilation errors where it says 'no match for toString (for example)
I tried a couple of the examples that came with the book, and they wont work either, unless they dont require any imports.
The only thing i cant think of is that it needs to be actually on line when i run them (which i cant be, as I have no internet connection) OR, the classpaths are set up incorrectly.
If you can confirm that either of these suggestions might be the cause, or if its a completely different reason, id be grateful!!
Thanks,
Hannah
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a classpath problem. JSP should run just fine from http://localhost:yourpage
Just to be sure, the correct import syntax should be:
<% page import="java.util.Vector" %>
Or simply
<% import java.util.*; %>
NOTE the semicolon.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!