Help with UTF-8 / Working in JSP not in a Bean Help

I am struggling with for last few hours. All I am doing is
public class Text extends Object implements Serializable {
public static Hashtable ht = new Hashtable();
public static void initL10N(){
public static String xyz = "आपके";
ht.put("hindi",xyz);
in a JavaBean and trying to access the string in a Jsp Out.jsp as <%=Text.ht.get("hindi")%> I am getting Junk characters.
But to my surprise: If I do that in a jsp: as (since I declared the ht as public static it's accessable to the new JSP called L10NInit.jsp
<%
Text.ht.put("hindi2","&#2310;&#2346;&#2325;&#2375;")l
%>
and execute the Out.jsp and then execute my orginal jsp to get the string as <%=Text.ht.get("hindi2")%> it displays beautifully.
I tried every thing else before turning to this forum. Please help.
Environment: NetBeans5.5

You need to use exact the same and the correct charset encoding thoroughout the whole process. Maybe your JSP or response headers used/contained the wrong encoding.
[Read this important article about unicode|http://www.joelonsoftware.com/articles/Unicode.html].

Similar Messages

  • UTF-8 working in JSP not in JavaBean (when assigned to a simple String)

    I am struggling with for last few hours. All I am doing is
    public class Text extends Object implements Serializable {
    public static Hashtable ht = new Hashtable();
    public static void initL10N(){
    public static String xyz = "&#2310;&#2346;&#2325;&#2375;";
    ht.put("hindi",xyz);
    in a JavaBean and trying to access the string in a Jsp Out.jsp as <%=Text.ht.get("hindi")%> I am getting Junk characters.
    But to my surprise: If I do that in a jsp: as (since I declared the ht as public static it's accessable to the new JSP called L10NInit.jsp
    <%
    Text.ht.put("hindi2","&#2310;&#2346;&#2325;&#2375;")l
    %>
    and execute the Out.jsp and then execute my orginal jsp to get the string as <%=Text.ht.get("hindi2")%> it displays beautifully.
    I tried every thing else before turning to this forum. Please help.
    Environment: NetBeans5.5

    In the JSP also I am assigining straignt hindi chars (some how forum displayed entities) as &#2357;&#2376;&#2358;&#2381;&#2357;&#2367;&#2325;

  • Delta with data field works if delta not run everyday?

    Hello,
    I have a doubt related with how delta works,
    I have a generic datasource with delta behaviour. In delta, i selected a date field to control delta and i put one day for limit.
    So, my doubt is:
    I have a table with records with delta date 24.05.2007.
    Last delta extraction were at 23.04.2007.
    When i execute delta infopackage at 26.04.2007, i'm i going to get all records since 23.04.2007?
    Thanks
    Best Regards,
    Maria

    Hi,
    if delta initialisation was done you'll get the diff between current run date and last delta run
    /manfred

  • How to use class in JSP page ? In java works in JSP not...

    Hello developers,
    I need check if URL exists.. i use this code in java.. it works fine..
    import java.net.*;
    import java.io.*;
    public class Check {
    public static void main(String s[]) {
        System.out.println(exists("http://www.google.com"));
        System.out.println(exists("http://www.thisURLdoesntexis.com"));
    static boolean exists(String URLName){
      try {
        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        //        HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con =
           (HttpURLConnection) new URL(URLName).openConnection();
        con.setRequestMethod("HEAD");
        return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
      catch (Exception e) {
           e.printStackTrace();
           return false;
    }in java all works fine.. it shows
    TRUE
    FALSE
    but i have no idea how can i implement this java code to my check.jsp page..
    i tried something like this..
    <%@ page import="java.io.*" %>
    <%@ page import ="java.net.*" %>
    <BODY>
    <%
    static boolean exists(String URLName){
      try {
        HttpURLConnection.setFollowRedirects(false);
        // note : you may also need
        //        HttpURLConnection.setInstanceFollowRedirects(false)
        HttpURLConnection con =
           (HttpURLConnection) new URL(URLName).openConnection();
        con.setRequestMethod("HEAD");
        return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
      catch (Exception e) {
           e.printStackTrace();
           return false;
    String a="http://www.google.com";
    %>
    <%= exists(a)%>and i want to see in my jsp page the result.. it means that JSP page shows
    TRUE
    Thanks in advance,

    Hi there,
    One solution is to use JavaBeans and call the methods for the JavaBean from the JSP page.
    Suppose you have a JavaBean called TestConnectionBean as follows:
    package test22;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
      Set the testUrl before checking if connection exists.
    public class TestConnectionBean {
        String testUrl;
        boolean connectionExists;
        public TestConnectionBean() {
        public String getTestUrl() {
            return testUrl;
        public void setTestUrl(String testUrl) {
            this.testUrl = testUrl;
        public boolean getConnectionExists() throws IOException, MalformedURLException {
            HttpURLConnection.setFollowRedirects(false);
            // note : you may also need
            //        HttpURLConnection.setInstanceFollowRedirects(false)
            HttpURLConnection con = null;
            con = (HttpURLConnection) new URL(this.testUrl).openConnection();
            con.setRequestMethod("HEAD");
            return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
        public void setConnectionExists(boolean connectionExists) {
            this.connectionExists = connectionExists;
    }Then you can create a JSP page like this:
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
      <head><title></title></head>
      <body>
      <jsp:useBean id="testConnectionBean" class="test22.TestConnectionBean"/>
      <jsp:setProperty name="testConnectionBean" property="testUrl" value="http://www.google.com" />
      <br/><br/>
      Does the connection exist for http://www.google.com : <jsp:getProperty name="testConnectionBean" property="connectionExists"/>
      <br/><br/>
      <jsp:setProperty name="testConnectionBean" property="testUrl" value="http://www.thisURLdoesntexis.com" />
      <br/><br/>
      <%-- The following will give an exception : java.net.UnknownHostException: www.thisURLdoesntexis.com since the URL doesn't exist. 
      --%>
      <%--
      Does the connection exist for http://www.thisURLdoesntexis.com : <jsp:getProperty name="testConnectionBean" property="connectionExists"/>
      --%>
      </body>
    </html>The output you see looks like:
    Does the connection exist for http://www.google.com : true
    I think it is better to handle the exceptions in the JavaBean itself, so now yyou can change the method signature of getConnectionExists , remove all exceptions from method signature but handle them with a try/catch inside the method itself.

  • File sharing with 3 computers, working partially but not entirely

    I have three computers on my network and file sharing works only partially. Here's my problem:
    Computer 1 can connect to Computer 2 and 3
    And, vice versa, Computers 2 and 3 can connect to Computer 1
    So file sharing is obviously working, to a certain extent, on all three.
    BUT ... I cannot get file sharing to cooperate between Computers 2 and 3. i.e. I browse for networks on 2 or 3, and the only thing that appears is Computer 1.
    Computer 1 (the cooperative one) is an iMac 10.5.8. The other two (naughty) ones are Mac Pros, on Mountain Lion.
    Thoughts anyone?

    I have a similar setup.  One iMac with 10.5.8 and 2 Mac Pros running Mavericks.
    Networking the three of them with OS X has not been problematic in my case.  I can't imagine why the 2 Mac Pros won't see one another.
    Have you tried adding 'shared folders' in the System Preferences/Sharing/File Sharing for both Mac Pros?
    You could also try to 'force' a connection with Finder's 'Connect to Server' (Command-K).  Just enter AFP:\\your_mac's_IP_address.
    I've even managed to get all three macs to network with Windows and Linux (though it's not as smooth as connecting to other Macs, obviously).
    Best of luck.

  • Problem with slideshow basic, works locally but not remotely

    Hi, I've noticed many threads on this issue and I have tried many fixes but no success. Most seems to revolve around the SpryWidget.js file so I've loaded it directly from AdobeLabs file. In fact, have loaded all .js files directly via my hosting server in case was a problem with binary/ASCII loading through Dreamweaver Mac.
    My .js file is here:
    http://www.keishahulsey.com/Spry-UI-1.7/includes/SpryWidget.js
    And this is the page I'm having problems with...
    http://www.keishahulsey.com/thesis/MA-2-10.php
    I so rarely post on these forums only read them but am desperate. Would greatly appreciate any help as this is my presentation website for thesis due in one week.

    The link to the main images is incorrect.
    If I go to http://www.keishahulsey.com/_images/_slideshows/thesis-1-60/160smithfield1.jpg, I see the thumbnail, but if I go to http://www.keishahulsey.com/_images/_thesis/_content/1-60-smithfield-1.jpg, instead of the main image, I get a page with markup.
    Simply correct the path and all is well.
    Gramps

  • Problem with html link in my jsp----Not showing

    Hii frnd ,i m trying to put a <hhtml:link> tag in my jsp ,
    the tag is not showing up.
    Wht can be the possible reason for tht.

    You would probably increase the chances of getting a reply if you posted the code you use. There could be a hundred different reasons.

  • [svn:fx-trunk] 7661: Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.

    Revision: 7661
    Author:   [email protected]
    Date:     2009-06-08 17:50:12 -0700 (Mon, 08 Jun 2009)
    Log Message:
    Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.
    QA Notes:
    Doc Notes:
    Bugs: SDK-21636
    Reviewers: Corey
    Ticket Links:
        http://bugs.adobe.com/jira/browse/iso-8859
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/SDK-21636
    Modified Paths:
        flex/sdk/trunk/templates/swfobject/index.template.html

    same problem here with wl8.1
    have you sold it and if yes, how?
    thanks

  • Archive file with errors in sender file adapter not working! please help!

    Hi Experts,
       I have a file to RFC scenario. the input is a XML file. I have setup the flag in sender file adapter channel for archiving the input files with errors. But it is not working.
    For testing I have used an invalid xML file for example without the main XML tag. I have also tested with a MSWORD file saved with.xml extension. But in both the cases the files are not getting archived.
    My archive location permissions are fine and in fact normal archive operation is happening. That is, if I select the processing mode as "Archive" and gave the Archive directory then files are getting archived. The problem is only with the "Archive faulty source files" option.
    What am I missing? DO I need to do some more configurations?
    What are the prerequisites if any for this option?
    How to test this?
    Please help me! I will be greatfull to you all!
    Thanks & Regards
    Gopal

    and go thru this links
    Creating a Single Archive of the Version Files
    http://help.sap.com/saphelp_nw04/helpdata/en/79/1e7aecc315004fb4966d1548447675/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/31/8aed3ea86d3d67e10000000a114084/frameset.htm
    Note: reward points if solution found helpfull
    Regards
    Chandrakanth.k

  • My ipad mini is not syncing music onto in, my ipad has been replaced to see whether the issue is to do with the ipad but its still not working. i have a a windows PC please help thanks

    my ipad mini is not syncing music onto in, my ipad has been replaced to see whether the issue is to do with the ipad but its still not working.
    ive tried everything and ive been to the store which was when i was given a new ipad mini. i have a a windows PC please help thanks

    Are you attempting to sync music from your iTunes Music Library on your PC?
    What options do you have set on the Music Tab for your iPad in iTunes?
    What happens when you sync?
    Any error messages?

  • Just bought a mac air with OS X v.10.7 Lion, for work I need to read and write NTFS drives, I install MacFuse and NTFS-3G, but it can not mount (recognize?) External HDD, in my MBP with Lion it work just perfectly... help please.

    Just bought a mac air with OS X v.10.7 Lion, for work I need to read and write NTFS drives, I install MacFuse and NTFS-3G, but it can not mount (recognize?) External HDD, in my MBP with Lion it work just perfectly... help please.

    Sorry in my MBP Snow lepard it work.. don't have Lion In MBP

  • There is a problem with my apple watch.it is not working well .There is a problem in its charging .The repairers says that contact to your company and ask them to provide you its software. Please help me.

    There is a problem with my apple watch.it is not working well .There is a problem in its charging .The repairers says that contact to your company and ask them to provide you its software.
    Please help me.

    Please be aware that you are not communicating with Apple when you post in these forums. These are user-to-user support forums, so in almost all cases the only people who will reply to your posts are, like me, your fellow users.
    As to your issue, Apple does not and never has made a wristwatch as such. The only thing close to a watch that they have made was the 6th-generation iPod nano:
    http://support.apple.com/kb/ht1353#iPod_Nano_6G
    which has a clock feature and which some people have worn as a wristwatch. Is that what you mean?
    Message was edited by: varjak paw

  • JSP: work with TomCat 5.5.9 and NOT work with TomCat 6.0.16

    Hi all,
    I'm Antony and I have a problem with a .JSP page of my server.
    In my server there are 2 users: "u1" and "u2"; there are 2 TomCat, version 5.5.9 and version 6.0.16. There is Apache WebServer version 2. The 2 TomCat servers have the same configuration files: server.xml and web.xml (in the dir /conf of the main server's root). They not work simultaneously.
    When the user "root" launch the TomCat 5.5.9 all work fine: the server will show correctly the JSP pages of "u1" and the pages of "u2".
    When the user "root" launch the TomCat 6.0.16 the JSP pages of "u1" work fine but the JSP pages of "u2" not work: it seems that there are problems with the path where the server want to search the pages of u2.
    In the server.xml there is this code (for the handle of u2's site):
    <Host name="u2site.com" appBase="/home/u2/public_html/">
      <Alias>www.u2site.com</Alias>
      <Context path="" reloadable="false" docBase="/home/u2/public_html/" debug="0"/>
              <Context path="/manager" debug="0" privileged="true"
                  docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
              </Context>
    </Host>and this code (for the u1's site)
    <Host name="u1site.com" appBase="/home/u1/public_html/">
      <Context path="" reloadable="false" docBase="/home/u1/public_html" debug="1"/>
              <Context path="/manager" debug="0" privileged="true"
                  docBase="/usr/local/jakarta/tomcat/server/webapps/manager">
              </Context>
    </Host>The problems with the JSP pages of u2 are one of the following:
    org.apache.jasper.JasperException: /login2.jsp(4,0) The value for the useBean class attribute com.u2.beans.access.Autenticator is invalid.and this one that appear with the pages that have the inclusion of another JSP page
    /u2page.jsp(3,0) File "/../support/_formatting.jsp" not foundI think that the TomCat know how to find the page that the browser request to Apache WebServer (and that the webserver request to Tomcat by the connector) 'cause for pages that haven't inclusion or call to method in packages all work fine...but the TomCat have problems to locate the pages included or the method located in a JAR (the jars are located in WEB-INF/lib/ of the u2's site).
    How I can resolve this problem with TomCat 6.0.16? I repeat that with TomCat 5.5.9 all work fine...same configuration!
    Any ideas?
    Thank you very much,
    Antony.

    Hi stevejluke, 'cause in the page "/supporto/_formatting.jsp" there are only the definition of some variables it's normal that the output at the browser it's a blank page.
    The problem it's that Tomcat 6.0.16 cannot know how "navigate" the pages beginning from one...it know where is the "x.jsp" page requested directly by Apache WebServer, where is "y.jsp" request directly by Apache, where is "z.jsp" requested directly by Apache but if "x.jsp" request, includes, "y.jsp" Tomcat cannot know where "y.jsp" is located. There is some file where I can "say" this to Tomcat?
    The page "/mostre/elenco_mostre.jsp" includes directly the "/supporto/_formatting.jsp".
    Another thing: in /mostre/elenco_mostre.jsp there is an inclusion directive for /supporto/_formatting.jsp that is so:
    <%@ include file="../supporto/_formatting.jsp"%>you can see that the included file is "../supporto/_formatting.jsp" and NOT "/../supporto/_formatting.jsp"...the "/" at the begin of the path is included by Tomcat!
    In the catalina.out there are this lines, when the page is called:
    Jul 6, 2008 3:15:00 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: /elenco_mostre.jsp(3,0) File "/../supporto/_formatting.jsp" not found
      In catalina.out before server start there are this lines:
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '1' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
    Jul 6, 2008 1:43:49 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 358 ms
    Jul 6, 2008 1:43:49 AM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    Jul 6, 2008 1:43:49 AM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
    Jul 6, 2008 1:43:52 AM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/23  config=null
    Jul 6, 2008 1:43:52 AM org.apache.catalina.connector.MapperListener registerEngine
    WARNING: Unknown default host: localhost
    Jul 6, 2008 1:43:52 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 2512 msThe file "web.xml" is located in "$Tomcat_home/conf" and it's:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
          <param-name>fork</param-name>
          <param-value>false</param-value>
        </init-param>
        <init-param>
          <param-name>xpoweredBy</param-name>
          <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>jsp</servlet-name>
        <url-pattern>*.jspx</url-pattern>
      </servlet-mapping>
      <session-config>
        <session-timeout>30</session-timeout>
      </session-config>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
    </web-app>there are not web.xml file in /WEB-INF/ of the web application.
    Maybe the problem it's that Tomcat want the conf file in "Server/Service/Engine/Host/Context" ? I must move the block HOST of the server.xml file in this path?
    Good Sunday and thank you!
    Antony.

  • My ipod touch only connects via wifi, not via cable. The cable works with my iPad, so it's not that.  Help?

    My ipod touch (4th G) only connects via wifi, not via cable. The cable works with my iPad, so it's not that.  Help?

    1. Turn the router, iPad and printer off.
    2. Turn on the router and then wait 30 seconds to let it complete its start-up process.
    3. Turn on printer and then wait 30 seconds to let it complete its start-up process.
    4. Turn on your iPad and test print.

  • My new I phone 4s does not ring when someone calls. Speakers works with music, it works with headphones, it works with the ringtones in the setting mode but it does not ring when is in normal mode...Please HELP!!!!

    Speakers works with music, it works with headphones, it works with the ringtones in the setting mode but it does not ring when is in normal mode...Please HELP!!!!

    Try a different ringtone.
    Reset or restart the device.

Maybe you are looking for