You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nikola Stefanovski <ni...@gmx.net> on 2002/09/20 18:49:31 UTC
encoding problem
hello.
i'm working with cyrillic characters and i can't get them to show ok.
i'm working on win2000 and i've tried tomcat versions 3.2.3, 3.3a and 4.0.1.
the page directive is specified as:
<%@ page contentType="text/html; charset=windows-1251"
pageEncoding="windows-1251"%>
this makes the static content of the jsp appear correctly, but the strings
retrieved through an expression (<%=bean.getString()%>) are just
question-marks. if i take out the page attribute, the browser shows some
funny characters as it doesn't recognise the encoding. but if i then switch
to cyrillic (windows) encoding manually, everything appears fine.
i can't figure out where the catch is, any help?
i'm sorry if this has already been an issue on the list, but i could not
find an answer in the archive.
greetings,
nikola.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: configuration problem
Posted by Atif Shahab <as...@mail.bii-sg.org>.
It worked. Thanks
On Sat, 21 Sep 2002, Jacob Kjome wrote:
> You should probably put CartItem in a package. When you say "import
> CartItem", the class file generated by the automated JSP compile is going
> to look for CartItem.class in the same package as it is in which isn't the
> case. The default package won't work unless the class you are using is one
> that you are directly running. Importing classes from the default package
> will not work unless both the class and the imports all exist in the
> default package. This is almost never the case. Just avoid the default
> package if you can.
>
> So, add something like the following in CartItem....
>
> package org.atif.cart.CartItem;
>
> put CartItem.class into WEB-INF/classes/org/atif/cart/
>
> finally, import org.atif.cart.CartItem in your JSP
>
> That should get things going.
>
> Jake
>
> At 07:25 PM 9/21/2002 +0800, you wrote:
>
> >tried it but still the same problem.
> >
> >On Sat, 21 Sep 2002, Jacob Kjome wrote:
> >
> > > Your docBase in the <Context ...> element only needs a relative location of
> > > "Book". Also, your "path" attribute requires a forward slash prefix. So,
> > > rewrite it like this:
> > >
> > > <Context path="/Book" docBase="Book">
> > >
> > > Should work now.
> > >
> > > You only need to provide a fully qualified path in docBase if your app
> > > exists outside the defined "appBase" directoy defined in the parent
> > > <Host ...> element.
> > >
> > > Also, if you are literally using "$CATALINA_HOME" in your server.xml, I
> > > don't think that will be expanded to the actual value of that system
> > > variable, but I could be wrong. If I'm right, using it will not work any
> > > way you look at it. You'd probably have to replace $CATALNA_HOME with the
> > > actual path to where $CATALINA_HOME exists.
> > >
> > >
> > > jake
> > >
> > > At 06:26 PM 9/21/2002 +0800, you wrote:
> > >
> > > >I'm having problems configuring the tomcat server.
> > > >
> > > >I've created a directory 'Book' in $CATALINA_HOME/webapps
> > > > $CATALINA_HOME/webapps/Book
> > > > /WEB-INF/classes
> > > >
> > > >I've added the following line in server.xml
> > > >
> > > > <Context docBase="$CATALINA_HOME/webapps/Book"
> > > >path="Book">
> > > > </Context>
> > > >
> > > >I've placed a class file called CartItem.class in Book/WEB-INF/classes
> > > >
> > > >I've got a directory Book/jsp that contains a file called
> > > >ShoppingCart.jsp.
> > > >
> > > >I've restarted tomcat
> > > >
> > > >Now when I access http://localhost:8080/Book/jsp/ShoppingCart.jsp I get
> > > >errors
> > > >
> > > >ShoppingCart_jsp.java:7: '.' expected
> > > >import CartItem;
> > > > ^
> > > >
> > > >These are examples are from a book so I'm wondering what is wrong. The
> > > >book was written with Tomcat3.x in mind so not sure whether this is my
> > > >configuration problem or wrong code.
> > > >
> > > > >From Tomcat Web Application Manager I can see that the configuration is
> > > >somewhat correct since it's running.
> > > >
> > > >
> > > >--
> > > >To unsubscribe,
> > e-mail: <ma...@jakarta.apache.org>
> > > >For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> >
> >
> >--
> >To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> >For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: configuration problem
Posted by Jacob Kjome <ho...@visi.com>.
You should probably put CartItem in a package. When you say "import
CartItem", the class file generated by the automated JSP compile is going
to look for CartItem.class in the same package as it is in which isn't the
case. The default package won't work unless the class you are using is one
that you are directly running. Importing classes from the default package
will not work unless both the class and the imports all exist in the
default package. This is almost never the case. Just avoid the default
package if you can.
So, add something like the following in CartItem....
package org.atif.cart.CartItem;
put CartItem.class into WEB-INF/classes/org/atif/cart/
finally, import org.atif.cart.CartItem in your JSP
That should get things going.
Jake
At 07:25 PM 9/21/2002 +0800, you wrote:
>tried it but still the same problem.
>
>On Sat, 21 Sep 2002, Jacob Kjome wrote:
>
> > Your docBase in the <Context ...> element only needs a relative location of
> > "Book". Also, your "path" attribute requires a forward slash prefix. So,
> > rewrite it like this:
> >
> > <Context path="/Book" docBase="Book">
> >
> > Should work now.
> >
> > You only need to provide a fully qualified path in docBase if your app
> > exists outside the defined "appBase" directoy defined in the parent
> > <Host ...> element.
> >
> > Also, if you are literally using "$CATALINA_HOME" in your server.xml, I
> > don't think that will be expanded to the actual value of that system
> > variable, but I could be wrong. If I'm right, using it will not work any
> > way you look at it. You'd probably have to replace $CATALNA_HOME with the
> > actual path to where $CATALINA_HOME exists.
> >
> >
> > jake
> >
> > At 06:26 PM 9/21/2002 +0800, you wrote:
> >
> > >I'm having problems configuring the tomcat server.
> > >
> > >I've created a directory 'Book' in $CATALINA_HOME/webapps
> > > $CATALINA_HOME/webapps/Book
> > > /WEB-INF/classes
> > >
> > >I've added the following line in server.xml
> > >
> > > <Context docBase="$CATALINA_HOME/webapps/Book"
> > >path="Book">
> > > </Context>
> > >
> > >I've placed a class file called CartItem.class in Book/WEB-INF/classes
> > >
> > >I've got a directory Book/jsp that contains a file called
> > >ShoppingCart.jsp.
> > >
> > >I've restarted tomcat
> > >
> > >Now when I access http://localhost:8080/Book/jsp/ShoppingCart.jsp I get
> > >errors
> > >
> > >ShoppingCart_jsp.java:7: '.' expected
> > >import CartItem;
> > > ^
> > >
> > >These are examples are from a book so I'm wondering what is wrong. The
> > >book was written with Tomcat3.x in mind so not sure whether this is my
> > >configuration problem or wrong code.
> > >
> > > >From Tomcat Web Application Manager I can see that the configuration is
> > >somewhat correct since it's running.
> > >
> > >
> > >--
> > >To unsubscribe,
> e-mail: <ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: configuration problem
Posted by Atif Shahab <as...@mail.bii-sg.org>.
tried it but still the same problem.
On Sat, 21 Sep 2002, Jacob Kjome wrote:
> Your docBase in the <Context ...> element only needs a relative location of
> "Book". Also, your "path" attribute requires a forward slash prefix. So,
> rewrite it like this:
>
> <Context path="/Book" docBase="Book">
>
> Should work now.
>
> You only need to provide a fully qualified path in docBase if your app
> exists outside the defined "appBase" directoy defined in the parent
> <Host ...> element.
>
> Also, if you are literally using "$CATALINA_HOME" in your server.xml, I
> don't think that will be expanded to the actual value of that system
> variable, but I could be wrong. If I'm right, using it will not work any
> way you look at it. You'd probably have to replace $CATALNA_HOME with the
> actual path to where $CATALINA_HOME exists.
>
>
> jake
>
> At 06:26 PM 9/21/2002 +0800, you wrote:
>
> >I'm having problems configuring the tomcat server.
> >
> >I've created a directory 'Book' in $CATALINA_HOME/webapps
> > $CATALINA_HOME/webapps/Book
> > /WEB-INF/classes
> >
> >I've added the following line in server.xml
> >
> > <Context docBase="$CATALINA_HOME/webapps/Book"
> >path="Book">
> > </Context>
> >
> >I've placed a class file called CartItem.class in Book/WEB-INF/classes
> >
> >I've got a directory Book/jsp that contains a file called
> >ShoppingCart.jsp.
> >
> >I've restarted tomcat
> >
> >Now when I access http://localhost:8080/Book/jsp/ShoppingCart.jsp I get
> >errors
> >
> >ShoppingCart_jsp.java:7: '.' expected
> >import CartItem;
> > ^
> >
> >These are examples are from a book so I'm wondering what is wrong. The
> >book was written with Tomcat3.x in mind so not sure whether this is my
> >configuration problem or wrong code.
> >
> > >From Tomcat Web Application Manager I can see that the configuration is
> >somewhat correct since it's running.
> >
> >
> >--
> >To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> >For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: configuration problem
Posted by Jacob Kjome <ho...@visi.com>.
Your docBase in the <Context ...> element only needs a relative location of
"Book". Also, your "path" attribute requires a forward slash prefix. So,
rewrite it like this:
<Context path="/Book" docBase="Book">
Should work now.
You only need to provide a fully qualified path in docBase if your app
exists outside the defined "appBase" directoy defined in the parent
<Host ...> element.
Also, if you are literally using "$CATALINA_HOME" in your server.xml, I
don't think that will be expanded to the actual value of that system
variable, but I could be wrong. If I'm right, using it will not work any
way you look at it. You'd probably have to replace $CATALNA_HOME with the
actual path to where $CATALINA_HOME exists.
jake
At 06:26 PM 9/21/2002 +0800, you wrote:
>I'm having problems configuring the tomcat server.
>
>I've created a directory 'Book' in $CATALINA_HOME/webapps
> $CATALINA_HOME/webapps/Book
> /WEB-INF/classes
>
>I've added the following line in server.xml
>
> <Context docBase="$CATALINA_HOME/webapps/Book"
>path="Book">
> </Context>
>
>I've placed a class file called CartItem.class in Book/WEB-INF/classes
>
>I've got a directory Book/jsp that contains a file called
>ShoppingCart.jsp.
>
>I've restarted tomcat
>
>Now when I access http://localhost:8080/Book/jsp/ShoppingCart.jsp I get
>errors
>
>ShoppingCart_jsp.java:7: '.' expected
>import CartItem;
> ^
>
>These are examples are from a book so I'm wondering what is wrong. The
>book was written with Tomcat3.x in mind so not sure whether this is my
>configuration problem or wrong code.
>
> >From Tomcat Web Application Manager I can see that the configuration is
>somewhat correct since it's running.
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
configuration problem
Posted by Atif Shahab <as...@mail.bii-sg.org>.
I'm having problems configuring the tomcat server.
I've created a directory 'Book' in $CATALINA_HOME/webapps
$CATALINA_HOME/webapps/Book
/WEB-INF/classes
I've added the following line in server.xml
<Context docBase="$CATALINA_HOME/webapps/Book"
path="Book">
</Context>
I've placed a class file called CartItem.class in Book/WEB-INF/classes
I've got a directory Book/jsp that contains a file called
ShoppingCart.jsp.
I've restarted tomcat
Now when I access http://localhost:8080/Book/jsp/ShoppingCart.jsp I get
errors
ShoppingCart_jsp.java:7: '.' expected
import CartItem;
^
These are examples are from a book so I'm wondering what is wrong. The
book was written with Tomcat3.x in mind so not sure whether this is my
configuration problem or wrong code.
>From Tomcat Web Application Manager I can see that the configuration is
somewhat correct since it's running.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: encoding problem
Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Nikola Stefanovski wrote:
> hello.
>
> i'm working with cyrillic characters and i can't get them to show ok.
> i'm working on win2000 and i've tried tomcat versions 3.2.3, 3.3a and 4.0.1.
> the page directive is specified as:
>
> <%@ page contentType="text/html; charset=windows-1251"
> pageEncoding="windows-1251"%>
>
> this makes the static content of the jsp appear correctly, but the strings
> retrieved through an expression (<%=bean.getString()%>) are just
> question-marks. if i take out the page attribute, the browser shows some
> funny characters as it doesn't recognise the encoding. but if i then switch
> to cyrillic (windows) encoding manually, everything appears fine.
> i can't figure out where the catch is, any help?
Sounds like you got something wrong in the database part of your web
application. From what you've said, I can only conclude that what your
JSP/Servlet reads is a totally incorrect string.
Java supports only UNICODE, as it's internal character encoding. So, if you have
an architecture like this:
RDBMS <-> JDBC <-> JRE <-> Tomcat <-> Servlet(JSP) <-> HTTP
then JDBC must read characters INTO the Unicode encoding. ServletResponse class
will translate Unicode into specified HTTP encoding. Given your description of
the problem, I'd say you have CP-1251 encoded text that gets just pasted into
Unicode. This is irregular, since CP-1251 is not getting translated into proper
Unicode characters. I'd say you have wrong setup of your DB.
I've had similar problems with PostgreSQL and Tomcat, my data was CP-1250 and I
was forcing it as Unicode. My problems went away when I translated CP-1250 into
Unicode on the DB side and set DB encoding to UTF-8. I believe things would be
OK if I switched to any other supported encoding of the DB.
I'd say you have the same problem as I did - DB was of one encoding and data of
the other.
Nix.
P.S. I'm on a vacation for the next ten days, so I won't be answering my mails.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>