• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error in jsp page

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i'm trying to call the following into a jsp page



but i'm getting the error




class initialised at the top of the page



any ideas ?

cheers

chris
[ August 10, 2004: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Inside the expression tag (i.e. <%=%gt) you can have only expressions and not an ordinary statments like obj initialization, i/o etc. And also expression tag does not require semicolon at the end of expression. For normal statments use scriptlets (i.e <% %>).

Kalai Selvan T.
 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks

i changed it to scriptlets using the following



but get the following error



cheers

chris
[ August 10, 2004: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

edit$jsp.java:1108: ';' expected. list myClass = new list()



How much clearer could it be? Like any other Java statement, this one needs to be terminated with a semi-colon.

Btw, even in a JSP it's a great idea to follow normal Java naming conventions; including starting all class names with capital letters. So, I'd recommend List over list.
 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i thought that but when i put the semi colons in after both statements i get the following error





though i cant see why as i have the compiled file within the web-inf/classes directory.

[ August 10, 2004: Message edited by: Bear Bibeault ]
[ August 10, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, taking the semi-colon away just causes the compiler to fail before it can detect that the 'list' class does not exist.

Case counts. It should be WEB-INF not web-inf. And, as I said before, List rather than list (though the latter doesn't cause an error -- it's just good practice and helps make your code more readable).

Also please be sure NOT to enter your error messages as one long line. You can see you that screws up the page formatting making your topic even harder to read.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And... what package should the 'list' class come from. org.apache.jsp? Are you importing your package in the JSP page?
 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And... what package should the 'list' class come from. org.apache.jsp? Are you importing your package in the JSP page?

I'm using the following import statement in my file

<%@ page import="examples.list.*" %>

and the file is located in WEB-INF/classes/examples/list/ but still it cant find it and is giving me the error (i've chanegd its name to Listdrop)

Class org.apache.jsp.Listdrop not found. Listdrop myClass = new Listdrop(); ^ An error occurred between lines


??
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,

The name of your list object is called listvalue (conventionally listValue) in your <jsp:useBean>. As I said in another post you don't need to (and shouldn't) use both import and useBean - see what problems it causes!

As Bear says, get used to using conventions for Java code. They're used in almost any book or web tutorial you'll find and are available on Sun's website. You may also benefit from just refreshing you memory from your JSP book/tutorial by checking out the examples.

Jules
 
Yeah, but does being a ninja come with a dental plan? And what about this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic