IDE developing JSP And Hebrew  Encoding

Hi.
I�m using Sun One Studio 4 CE.
I�m new Java Programmer.
I create JSP that use Taglib and read XML file written in Hebrew (Encoding iso-8859-1);
When I run the file on a Tomcat I have no problems.
But when I run the file within the ide of Sun One Studio I get gibberish.
So. Do you know where I cane change the character settings so It work the same?
Thanks
Shimon

The default encodings specified by the JSP and Servlet spec are unfortunately no good for most of the world!
There are two issues you need to understand: page encoding, vs response encoding.
Page encoding defines what encoding was used to create a particular page (JSP, XML, HTML). Unless the page encoding is set correctly, the entity that reads the page (e.g. the JSP parser, the web container, or the web server) cannot understand the characters before they do anything with them.
Response encoding defines what encoding is used when the server sends the HTTP response to the browser. This is actually a separate issue from page encoding. For example, a JSP could have the page encoding set correctly (so that the JSP parser can read it), but if the response encoding is not set correctly, then what goes to the browser is still gibberish.
To set the page encoding of a JSP, use a page directive:
<%@page pageEncoding="UTF-8"%>
(UTF-8 will work in Studio, there is no need to pick another more specialized charset).
In a HTML file or XML file, use an XML directive to set the page encoding. The XML directive will not work in JSP though.
So now the parser can translate the JSP into a servlet. But that's not good enough, because we also have to produce a response that the browser can understand.
To set the response encoding from a servlet, you can use
response.setContentType("text/html;UTF-8")
In J2EE 1.4, you can also use response.setCharacterEncoding("UTF-8");
To set it from a JSP, use
<%@page contentType="text/html;UTF-8"%>
All modern web browsers understand UTF-8, so that is a safe encoding to pick for the response. (It is a good encoding at the page level too if you use Studio. If you use another tool for your JSPs and it prefers a different encoding, use that at the page level but stick to UTF-8 for the response unless you have wireless clients and know that you need something else).
Note that this can only be set before any of the response is written. So if this JSP is included into another one, and the response buffer size has been exceeded, it won't work. So the response encoding must be set as early as possible.
What if you have a servlet that forwards to a JSP? Well, if you consider how the response object works, you should only have to set it once and earlier is better, so the servlet controller would be the obvious place. However, in J2EE 1.3, the encoding model wasn't well spec'd out, so on some servers, even if you set the response in the servlet, the JSP will overwrite it with the default if you didn't specify the content type. So experiment and set it in both the servlet and the JSP if you have to.
From J2EE 1.4, it's OK to set the response encoding once, it the servlet - the JSP container doesn't overwrite it anymore.
Check out the following link for more on i18n in web apps:
http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/

Similar Messages

  • Please recommend IDE for JSP and Beans

    Hi guys,
    I am looking for a decent IDE to work with JSP and Beans. I have tried JBuilder which has too much going on at the same time and I find it to be an overkill for what I am doing; I find NetBeans kind of irritating. I develop web applications, hence I dont need any GUI stuff for beans.
    Just looking for something that will enable me to rapidly develop beans as a support system for JSP pages and at the same time, it should provide good support for coding JSP pages. Little bit of management functions wont hurt either, but are not required. I dont mind if I have to pay for the IDE. Any recommendations?

    I like Eclipse for Java Development, and I use the MyEclipse plug-in for J2EE development.
    There is a free J2EE plug-in (Lomboz) but I'd much rather pay the $29.99/year for MyEclipse. It's been perfect for me.

  • Working with JSP and Hebrew

    Hi, I have a form which calls a jsp page wich inserts the data to a DB. When I work in english I succed inserting data to the DB, but when trying to insert data in Hebrew I see ??? in the fields in the DB.
    The charset I use is Hebrew(windows) so the page is in Hebrew but in the DB I see ??????
    Can some one help me

    or maybe a more general search:
    http://search.java.sun.com/Search/java?qt=hebrew&col=javafrm&rf=0

  • Web component developer (JSPs and Servlets)

    Which jdk should I download for web component development
    Is it SE or EE?
    Do I need a application server to deploy web applications?
    Please advise.

    user10100078 wrote:
    which application server do you recommend?Well, I'm partial to JBoss, but Glassfish comes included in (at least some of) the installs.
    I don't know anything about application servers.
    please advise in detailThen learn, I don't have the time nor the character limit to explain to you about application servers. But they are documented.

  • JSP and HTTP return code

    I am new at developing jsp, and I am looking for a way to send an HTTP return code under a specific condition.
    for ex :
    if(data==ok)
    HTPP_return_code = 200;
    else
    HTPP_return_code = 500;
    Is it possible ?

    Within your JSP you can use the sendError method on the response object.
    e.g.
    if (data == ok) {
       response.sendError(HttpServletResponse.SC_OK);
    } else {
       response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    } See http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletResponse.html
    for possible HTTP return code constants.

  • JSF vs. JSP and IDE Question

    I'd like to get an opinion from the forum, I'm looking to build a web application that provides a front-end to a back-end, batch Java app. The back-end app has pre-existing common classes and methods with all of the essential business logic.
    My first question is, what platform should I be looking at, Javaserver Faces or JSP? JSF is so new and all of the bugs surely haven't been worked out, but it is the heir apparent new direction of J2EE. JSP is a little more proven, but a little more difficult to work in. This "more difficult" might not be so bad for us, because we've developed most of our back-end app without an IDE or drag-and-drop tools.
    My second question regards IDE's. I'm relatively new to OO programming, and I've never used an IDE. So, of the many free IDE's out there (Eclipse, Netbeans, etc.), are there any that you would recommend for your answer to the first question? How large of a process improvement would you judge from a move to an IDE with drag-and-drog functionality?
    So, in short, I would appreciate any of your opinions on moving to a new JSF standard as well as your thoughts on IDE's.
    Thanks.

    If you don't want to sepnd much time and want to do something in the middle between JSF and JSP, you can use JSTL. Lots of cool JSTL components are available for free. Using struts (which is timetested) is also a good idea.
    If you have never used any Java IDE, I would suggest you to use netbeans ide. Netbeans is really cool ide and has some good features like refactoring, jsp debugging etc. You will have to use Tomact as your server if you want to use JSP debugging effectively.
    Eclipse with right plugin (My Eclipse) would be the best choice but you will have to understand some eclipse concepts before jumping on eclipse. It took me little time to figure out view, perpectives, plugins jargon.
    Also My Eclipse is not free but it's very inexpensive - $30 per year.
    All these are my experiances. I hope it helps you.
    Vaibhav Puranik

  • Good IDE for JSP/Servlets Development

    Guys, I was looking for a good IDE for JSP/Sevlets development. I for myself wouldn't need or atleast wouldn't want to have one, but for our production they say they need one. So please can u guys advise one. I have downloaded and tried JDeveloper but it just hangs, dont know but looks like its too memory intensive. Any suggestions??? Thanks in advance

    IBM's Websphere Studio Application Developer (WSAD) is a good one. It can also connect to any CVS servers, which allows you to control the versions. Hope this may help you...

  • How to set default encoding and charsets for jsp and servlets.

    Hi,
    Is there any possibility to set default encoding or charset for jsps and servlest (for both request and response)?
    For example in Weblogic such parameters can be set in weblogic specific configuration files (weblogic.xml).
    Thanks in advance.

    Hi,
    I created one request with logo in the header an page in the footer etc. and called StyleSheet. After you can import this formats by each request.
    You can do this in compound layout.
    Regards,
    Stefan

  • I am using PP 2014 CC and it and or Encoder keep crashing.. using iMac computer with Yosemite OS anyone have any ideas about this issue?

    I am using PP 2014 CC and it and or Encoder keep crashing.. using iMac computer with Yosemite OS anyone have any ideas about this issue?

    Hi,
    Please give this a try: Premiere Pro CC, CC 2014, or 2014.1 freezing on startup or crashing while working (Mac OS X 10.9, and later)
    Thanks,
    Rameez

  • Character Encoding for JSPs and HTML forms

    After having read loads of postings on character encoding problems I'm still puzzled about the following problem:
    I have an instance (A) of WL 8.1 SP3 on a WinXP machine and another instance (B) of WL 8.1 without any SP on a Win2K machine. The underlying Windows locale is english(US) in both cases.
    The same application deployed as a war file to these instances does not behave in the same way when it comes to displaying non-Latin1-characters like the Euro symbol: Whereas (A) shows and accepts these characters as request-parameters, (B) does not.
    Since the war file is the same (weblogic.xml, jsps and everything), the reason for this must either be the service-pack-level or some other configuration setting I overlooked.
    Any hints are appreciated!

    Try this:
    Prefrences -> Content -> Fonts & Color -> Advanced
    At the bottom, choose your Encoding.

  • I have lost my "Basic" panel in the Develop module and can't figure out how to get it back. My right panel goes from the Histogram straight to the Tone Curve panel.  My Basic panel should be below the Histogram.  Any ideas how to get it back.  I have even

    I have lost my "Basic" panel in the Develop module and can't figure out how to get it back. My right panel goes from the Histogram straight to the Tone Curve panel.  My Basic panel should be below the Histogram.  Any ideas how to get it back.  I have even uninstalled my lightroom and reinstalled it with same issue.  Help!!!

    Right click on or near one of the other headers and a pop-up will appear and you will be able to select the Basic Panel for viewing.

  • Tree View through JSP and Java Script

    Hi,
    I am looking for code or ideas of a Tree Structure as shown in in the left side frame of admin console of Sun App server 7 on the browser. I need to create a tree structure which will work on the browser like it works on the Sun App Server 7 admin console. If you had any idea or code, please share with me. I would like to have some idea before I start building it. The tree will be build from the database. So any database design is also helpful. I am planning to have that tree using JSP and EJB.
    Please help. If you are not clear what I am looking for, then please drop a line in this forum, so that I can explain it fine.
    Thanks in advance.
    Amit

    You can use the JSP Tree Tag I have developed. This helps you both structuring the tree model itself + it takes care of displaying the tree in a nice way. You can change all HTML code used to display the tree. Also you can build trees dynamically instead of just displaying static trees. Take a look at it here:
    http://www.jenkov.dk/projects/treetag/treetag.jsp
    Kind Regards,
    Jakob Jenkov

  • Jsp and corba :help !!!

    Hi,
    i am working about a web application which is willing to extend, so we want to fix in the cleanest way, the architecture. we think for example about CORBA, have you got a better idea, could you send me some addresses where i could find very clear examples about applications using jsp and corba or something else!
    thank you very much if you can help me
    cris

    Hi bx1,
    here iam giving you some example jsp with corba it will help you
    I got from wrox book
    <!-- WroxQuotes.jsp -->
    <html>
    <head>
    <title>
    WroxStocks Quote Service
    </title>
    </head>
    <body bgcolor="#CAFD90">
    <%@ page import="WroxStocks.WroxQuotesPackage.Quote"
    errorPage="WroxQuotesError.jsp"%>
    <jsp:useBean id="WroxQuotesBean" scope="application"
    class="WroxQuotesBean" >
    <%
    String port = application.getInitParameter("ORBInitialPort" );
    String host = application.getInitParameter("ORBInitialHost" );
    WroxQuotesBean.init(port, host );
    %>
    </jsp:useBean>
    <%
    String symbols = request.getParameter( "Symbols" );
    Quote[] quotes = null;
    try {
    quotes = WroxQuotesBean.getQuotes( symbols );
    } catch( WroxStocks.UnknownSymbol us ) {
    response.sendError( 202, "Unknown symbol: " + us.unknown );
    %>
    <table border align="center">
    <tr align="center" bgcolor="FFFFFF">
    <td>
    <table>
    <caption align="top" style="font:14pt">
    <b>WroxStocks Stock Quotes</b>
    </caption>
    <tr align="center" bgcolor=Silver>
    <th width=100>SYMBOL</th>
    <th width=100>VOLUME</th>
    <th width=100>BID</th>
    <th width=100>ASK</th>
    <th width=260>AS OF</th>
    </tr>
    <%
    for(int i = 0; i < quotes.length; i++) {
    if( ( i % 2 ) == 0 ) {
    %>
    <tr align="right" bgcolor="#FFFFFF">
    <%
    } else{
    %>
    <tr align="right" bgcolor="#E0E0E0">
    <%
    %>
    <td align="center"> <%= quotes.symb %> </td>
    <td> <%= quotes[i].volume %> </td>
    <td> <%= quotes[i].bid %> </td>
    <td> <%= quotes[i].ask %> </td>
    <td align="center">6/28/2000 19:59:00</td>
    </tr>
    <%
    } // END: for
    %>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
    Regards,
    Tirumalarao
    Developer TechnicalSupport,
    Sun MicroSystem,India.

  • Invoking Forms from JSP and Vice versa

    Hi,
    I am in to a requirement like invoking a screen developed using Oracle Forms 6i from JSP and vice versa.
    1. Could you please anybody help to get the documents to be refered to get more idea on this?
    2. Is it possible only by Oracle ADF?
    Please help me on this.
    Thanks & Regards
    M Thiyagarajan

    Hi All,
    Thanks a lot for the clarifications.
    Actually, integration should happen between forms and JSP. Parameters need to be passed to and forth. I will go through the specified link.
    Also could you please clarify me where exactly, ADF comes into picture? or what are all the advantages when we go for ADF?
    Thanks & Regards
    M Thiyagarajan

  • Developing JSP pages using Eclipse 3.6

    i want to build a web application using JSP pages and oracle 11i databse, so i install and configure eclipse 3.2.2 and i installed the plugin to support creating a dynamic web project and i have installed jboss 6 to be the server.
    so on the eclipse i clikc new "dynamic web project" , then inside this new project i create a new JSP pages , then i write a simple code inside the jsp and i run the project using jboss and every thing went smootly.
    but let say now that i want to develop a more complicated pages to add buttons , to have tabs on my page.
    1. so my question is does eclipse provide a visual develpment tools ot plug-in for developing JSP?
    2. where i can find some good tutorilas regarding developing JSP using eclipse 3.2.2
    Thanks
    Edited by: 812643 on 20-Nov-2010 17:42

    Confusing isn't it? You can post questions here for specific problems you need to solve and usually get an answer (eventually). However, asking for which technologies are better will probably only provide you with biased opinions. There are many alternatives, each providing its own trade offs. I suggest searching google for articles from respected sources such as 'theserverside' rather than depend on individuals. Also, limit your search to articles that are no older than about 1 year. Lastly, try to stick with technologies that are used by the bulk of the developers and are considered almost an industry standard. No point learning some good yet obscure technology.
    As far as not considering a career as a developer, I suggest you stick to it no matter what. Anything you want to be good at takes years of practice and study
    (http://365pwords.wordpress.com/2009/01/25/practice-practice-practice-the-theory-of-10000-hours).
    No one has a 'knack' or is born good at it (even if they claim to be), and everyone experiences frustration (20 years later, I'm still frustrated!). You advance by making countless mistakes, and refactoring over and over again. Ignore anyone who discourages you no matter what.
    I think your quest should be limited to what you should learn when just starting out and not what is the best technologies for experienced users. Personally, I think learning JSP/Servlets is foundation that you should know well before considering alternatives. Also, many alternatives are based on extending JSPs and therefore you should know them well. I've always used JSP and not alternatives, so I can't comment further on that topic.
    If your just starting out in web design, here are my recommendations (in roughly this order):
    java -book (search amazon.com for books and reviews of what others have said in them).
    practice compiling java classes from the book on the dos command line and using a text editor before moving on to
    an IDE.
    Eclipse IDE - just an on-line tutorial may be ok. Learn to compile code, run it, debug it.
    JSP - book
    Servlets - book
    JUnit - just an on-line tutorial may be ok
    JSTL - just an on-line tutorial may be ok (use JSTL with JSP, not scriptlets)
    XHTML - just an on-line tutorial may be ok
    Javascript - book
    CSS - on line tutorial may be ok
    Tomcat - just an on-line tutorial may be ok. You can move onto JBoss, etc later.
    JDBC - book
    A free database such as Oracle Lite or MySql installed. Learn how to create tables.
    MVC design - read up on separation of concerns on a design (presentation,control,business, and database layer).
    SQL - book
    JQuery - book
    Hibernate -book
    Spring framework - book (only after creating an MVC web application with a single servlet as the control layer)
    AJax

Maybe you are looking for