Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Invalid character constant" with ResourceBundle

843838Nov 9 2006 — edited Nov 9 2006
Hi to everybody:

I got a jsp than catch two cookies, one of them to set a Locale variable that I use it to load a ResourceBundle. I deploy it, but when loading the jsp with Tomcat webserver, i got this error.

Here is my code:

<%@page language="java" import="java.util.*" import="java.lang.Object" pageEncoding="Cp1252" contentType="text/html; charset=Cp1252" %>

<%

String cookie1="nomCookie";
String cookie2="idiomaCookie";

Cookie galetes[] = request.getCookies();
Cookie nomCoo = null;
Cookie idiCoo = null;

for (int i=0;i<galetes.length;i++)
{
if(galetes[i].getName().equals(cookie1))
{
nomCoo=galetes[i];
break;
}
}

for (int i=0;i<galetes.length;i++)
{
if(galetes[i].getName().equals(cookie2))
{
idiCoo=galetes[i];
break;
}
}

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252"/>
<title></title>
</head>
<body>

<%

Locale idioma = null;
String p = idiCoo.getValue();
idioma = new Locale(p);
Locale.setDefault(idioma);

ResourceBundle missatges = ResourceBundle.getBundle('idiomes',idioma);
//Enumeration clausBundle = missatges.getKeys();
//String frase1 = missatges.getString("nom");
//String frase2 = missatges.getString("frase");

%>
Nom: <%= nomCoo.getValue() %><br>
Info cookie: <%= idiCoo.getValue() %><br>
Valor p: <%= p %><br>
Valor Idioma: <%= idioma.getDefault() %>

</body>
</html>


and the error is this one:

Ha tenido lugar un error en la l�nea: 39 en el archivo jsp: /6-3.jsp
Error de servlet generado:
Invalid character constant.

What am I doing wrong?? I have found that if I comment line: "ResourceBundle missatges = ResourceBundle.getBundle('idiomes',idioma);", the jsp loads right.


Any idea? thanks to everybody
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2006
Added on Nov 9 2006
1 comment
311 views