Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error in jsp page  RSS feed

 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • 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 ]
 
Kalai Selvan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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


??
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!