This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes VariableDeclaratorId expected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "VariableDeclaratorId expected" Watch "VariableDeclaratorId expected" New topic
Author

VariableDeclaratorId expected

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Hi
in the process of reading this article: Character Conversions from Browser to Database, i used this jsp directive as in the article:
but i get an error message, saying:
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the jsp file: /jsp/sayhello.jsp
Syntax error on token "pageEncoding", VariableDeclaratorId expected after this token
1: <% @page pageEncoding="ISO-8859-1" contentType="text/html; charset=ISO-8859-1" %>

as i dont know how to sort this out, here i am asking for help

(as a curiosity, if i comment that line out, i can run the code without any problem)

thanks in advance


java amateur
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Bear Bibeault wrote:Please take the time to choose an appropriate forum for your posts. This forum is for questions on HTML and JavaScript. For more information, please click this link ⇒ CarefullyChooseOneForum.

This post has been moved to a more appropriate forum.

you'r right: i was induced in error because of the nature of the article i point to, as it deals with encoding and so its html related, i guess
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Nope. Nothing at all to do with HTML. That's an error with the JSP translator.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Bear Bibeault wrote: That's an error with the JSP translator.

so, if it is a jsp translator error, how can one fix it?
is there another way of implementing that jsp directive?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Sorry, I don't know what it's complaining about. I have rarely used the page directive as the defaults are almost always sufficient.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
ok, thank you
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
if i eliminate the space right before the @, i get no complaints at all:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Ha! Yeah, I missed that. The error message (rather poor, if you ask me) directed attention to the attributes. I missed the erroneous space. Doh!

Similarly you can't put a space in scriptlets like <% = and <% !. But then again, one shouldn't be using scriptlets at all anymore.
 
 
subject: VariableDeclaratorId expected
 
Similar Threads
Problem in setting character encoding in JSP
java.lang.NullPointerException on a jsp page
Scripting Invalid
cannot resolve symbol error when a class is imported from another project
problem with EL in my JSP page