How to show simple chinese in jsp

when I use simple chinese in jsp,in the portlet all the char convert into B>B-C“B*B;C.B6B/,but in the servlet,all the simple chinese char it right,I have set the conentType = "text/html;gb2312",but the problem is still.
somebody can help me!
thanks!

You have to set the content type on your response firts.
eg; response.setContentType("image/gif");

Similar Messages

  • How to show an image in JSP given the bytes[] of the photo?

    Hi all,
    I stored a user's picture in the db as text. For this I simply converted the JPG to bytes[] and from bytes to string: Base64.encode(bytes)
    Now I wish to do the reverse - to 'output' the image on the screen. So given the bytes[] of the image with
              byte[] bytesDB = Base64.decode(userPhotoStr); //userPhotoStr is something like this: /9j/4AAQSkZJRgA...Question: How can I show the image in the JSP page embedded in the page not as download?
    I'm using struts with JSP pages.
    Thank you!!!!

    Images in HTML are to be displayed using <img> element. All what an <img> element can take as image is an URL pointing to the image in question.
    If the image is dynamic, then you can just let that URL point to some Servlet which takes some request parameter or reads the path info, reads/gets the image as byte array or (much more efficient) as inputstream and writes it to the outputstream of the response.
    You may get some ideas out of this: [http://balusc.blogspot.com/2007/04/imageservlet.html].
    By the way, massaging the byte array from/to a String is a terribly bad idea. Just store bytes as computer readable bytes, not as human readable characters, this makes completely no sense. Characters on its turn have to be converted to bytes again after all, but now you've let the DB do the work. All with all a performance pain. Bytes > Chars > Bytes > Chars > Bytes instead of just Byes > Bytes. In database you normally use BLOB, BINARY or equivalent for this in combination with JDBC's PreparedStatement#setBinaryStream() and ResultSet#getBinaryStream().

  • How to show gif attachment in jsp

    now the MimeMessage has a MultipartBody containing a gif picture,how can I show it in
    jsp? only just using this code does not work:
    BodyPart p=/*get the MultipartBody;*/
    p.getDataHandler().writeTo(respone.getOutputStream());
    out.flush();

    You have to set the content type on your response firts.
    eg; response.setContentType("image/gif");

  • How to show database data in jsp page?

    actually i m doing a small appliaction of quiz test.
    where i m keeping my question and answers in the database.
    now i want to pull questions from the database and display in the jsp or html page.for each question i m having 4 options 4 them.
    like this user has to answer the question and display the resuklt in the end.
    so how can i do this?
    can i get any example or source code for this from any sites?

    Hope this will be ur assignment. Pls try to start ur assignment and post ur doubts with ur code. So that some one can help u.
    Cheers.

  • How can show the Chinese character in Oracle Report Graph on RedHat Linux?

    The OS is RedHat Linux and I set NLS="SIMPLIED CHINESE_CHINA.ZHS16GBK" in %ORA_AS_HOME%/bin/reports.sh
    The report file is a JSP Web Report, including Chinese character in web HTML text and graph.
    Now Chinese character in HTML text can be displayed correctly but the Chinese character in graph can not be display.
    Anybody can help me? thanks a lot.

    The report server is 9i and it is running in Oracle AS 904.
    And set NLS_LANG="SIMPLIED CHINESE_CHINA.ZHS16GBK" in %ORA_AS_HOME%/bin/reports.sh

  • How deploying a simple report as .jsp

    Hi,
    i have read the last days many document, and messages on this board.
    But I could not find answers.
    My problem is:
    I create a simple report with reportbuilder and save this to mysample.jsp.
    I copy this file to Oracle Application Server j2ee\OC4J_BI_Forms\applications\reports\web\.
    When i call the report from web http://myservername/reports/mysample.jsp?userid=.
    The server return follow error:
    Anforderungs-URI:/reports/JSP_Demo.jsp
    Exception:
    java.io.FileNotFoundException
    Oracle Application Server Forms and Reports Services 10g (9.0.4.0.1) for Microsoft Windows with Patch Set 2 (9.0.4.2.0)

    Are you sure you're copting the Reports to the right place. There's a difference running Developer Suite and Application Server. Check documentation and/or Metalink. Also, I would place this question next time in the Reports forum, not in the Application Server (General) forum:
    Reports
    Martin

  • How to show PinYin (Chinese Phonetic Tone) mark?

    I am hoping to create a ebook to teach chinese pronouciation through PinYin.
    In Pages (IOS) it is as simple as type the "word", highlight it and and select "phonetic" and that's it. I notice that when I import document created in Pages (IOS), all the phonetic marks are gone.
    I understand that some suggestion made in the internet world has been to use US Extended language and insert the indivudal phonetic.
    This is ok if you are entering a few words but if i need to convert the whole pages, it will be a really really painful exercise.
    Last resort will be potentially a PDF plug in?
    Any help or advice or update?
    Cheers,
    Josh

    PS  Perhaps these special fonts would work for what you want to do
    http://www.yale.edu/chinesemac/pages/romanization.html#hanzi

  • Urgent Help Please..How to show an alert in jsp if servlet has an exception

    Hi
    I am calling a servlet from popup jsp.
    When the values are submitted from the jsp I am calling the servlet where i have functionality to send an email. But if email fails in the servlet I have to return to the popupjsp and show an alert to the user.
    If any body knows please help.
    thanks in advance.

    Hi,
    Do like this :
    In the servlet's doPost() method, add codes in the manner
    mentioned below.
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
    PrintWriter out = response.getWriter();
    try{
    //throw new Exception();
    catch(Exception ex){
    out.println("<html><body>");
    out.println("<script language='javaScript'>");
    out.println("alert('Exception Occured Servlet...');</script>");
    out.println("</body></html>");
    Hope it helps.
    Regards,
    Sudhir

  • How to show JTree on html,jsp

    Any help?What to use JFrame, scrollpane or what?
    Thanxs

    1. You could use an applet
    2. You could transform your JTree into javascript

  • How to show chinese char form db in my jsp portlet?

    How to show chinese char form db in my jsp portlet?
    I had tried to set contentType in renderResponse, but itn't work ..

    Bent,
    You can access the database from your Java portlet, just like from any other Java/JSP environment. Yes, you can use JDBC, as well as BC4J.
    The Discussion Forum portlet was built using BC4J, take a look at it's source to see how it was done.
    Also, check out Re: BC4J Java portlet anyone?, it contains a lot of useful information too.
    Peter

  • How can i passing chinese word parameter within jsp

    i got the issue of passing chinese parameter from one jsp to another jsp.
    my scenario is this : <br>
    i store the unicode(\u521B\u9020\u7528\u6237)in the .properties file. in 1.jsp i call the java to get the unicode from .properties file and it shows properly in 1.jsp(shows the chinese word - &#24744;&#30340;&#21517;&#23383;&#24050;&#32147;&#34987;&#20182;&#20154;&#20351;&#29992;!). then 1.jsp redirect to 2.jsp. i use request.getParameter("message") to get the chinese word. 2.jsp shows me the funny symbols(1�?). i need someone help me. below are the code of each jsp file.
    1.jsp
    %@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="java.util.Locale"%>
    <%@ page import="org.apache.commons.codec.binary.Base64"%>
    <%
         Locale.setDefault(Locale.SIMPLIFIED_CHINESE);
         request.setCharacterEncoding("UTF-8");
         response.setContentType("text/html;charset=UTF-8"); //this is redundant
         request.getCharacterEncoding();
         response.getCharacterEncoding();     
         try {
             if (user1 != null) {
                   message+="1"+mpmservice.getLang(user.getLang(), "errmsg_username_exist")+"<br>";
                   bError=true;
              if(bError) {
                   response.sendRedirect("create_user.jsp?s=" + request.getParameter("s") + "&msg=" + message + "&name=" + name + "&description=" + description + "&phonenumber=" + request.getParameter("phonenumber") + privStr);
              %>
              <html>
              <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              </head>     
              <body>     
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "create_user_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="create_user_do.jsp">
                   <input type=hidden name=msg value="<%=message%>">
                   <table class="infotable" id="report">
                        <tr>
                             <td class="left"><%=mpmservice.getLang(user.getLang(), "create_user_label_name")%></td>
                             <td class="middle" colspan="2"><%=name%></td>
                             <td class="right"> </td>
                        </tr>
                        <tr>
                             <td class="left"> </td>
                             <td class="halfmiddle">
                                  <input class="halfmiddle" name="Create" type="submit" id="Create" value="<%=mpmservice.getLang(user.getLang(), "create_user")%>" />
                             </td>
                             <td class="halfmiddle">
                                  <input class="halfmiddle" name="Cancel" type="button" id="Cancel" value="<%=mpmservice.getLang(user.getLang(), "cancel")%>" onClick="location='create_user.jsp?s=<%=request.getParameter("s")%>&msg=<%=message%>&name=<%=name%>&description=<%=description%>&phonenumber=<%=request.getParameter("phonenumber")%><%=privStr%>'" />
                             </td>
                             <td class="right"> </td>
                        </tr>
                   </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
         </body>
    </html>
    [[u]b]2.jsp[/b][/u]
    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="java.util.Locale"%>
    <%@ page import="org.apache.commons.codec.binary.Base64"%>
    <%
         Locale.setDefault(Locale.SIMPLIFIED_CHINESE);
      request.setCharacterEncoding("UTF-8");
         response.setContentType("text/html;charset=UTF-8"); //this is redundant
         request.getCharacterEncoding();
         response.getCharacterEncoding();
         try {
             String message = request.getParameter("msg");
             System.out.println("in create_user.jsp  message>>>>>"+message);
              %>
              <html>
              <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              </head>     
              <body>               
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "create_user_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="create_user_confirm.jsp">
                   <input type=hidden name=s value="<%=request.getParameter("s")%>">
                   <table class="infotable" id="report">
                        <tr>
                             <td class="left"><%=mpmservice.getLang(user.getLang(), "create_user_label_name")%></td>
                             <td class="middle" colspan="2"><input class="middle" name="name" type="text" id="name" size="35" value="<%=name%>" /></td>
                             <td class="right">
                             <% if (message!=null && message!="" && message.startsWith("1") ) { %>
                                  <%=message.substring(1,message.indexOf("<br>")) %>
                                  <% message=message.substring(message.indexOf("<br>")+4,message.length()); %>
                             <% } %>
                              </td>
                        </tr>
                   </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
         </body>
    </html>
    [u].properties file[/u]
    errmsg_username_exist=\u60A8\u7684\u540D\u5B57\u5DF2\u7D93\u88AB\u4ED6\u4EBA\u4F7F\u7528!
    [\code]
    i really appreciate whoever reply this issue.
    thanks a lot

    i got the issue of passing chinese parameter from one jsp to another jsp.
    my scenario is this : <br>
    i store the unicode(\u521B\u9020\u7528\u6237)in the .properties file. in 1.jsp i call the java to get the unicode from .properties file and it shows properly in 1.jsp(shows the chinese word - &#24744;&#30340;&#21517;&#23383;&#24050;&#32147;&#34987;&#20182;&#20154;&#20351;&#29992;!). then 1.jsp redirect to 2.jsp. i use request.getParameter("message") to get the chinese word. 2.jsp shows me the funny symbols(1�?). i need someone help me. below are the code of each jsp file.
    1.jsp
    %@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="java.util.Locale"%>
    <%@ page import="org.apache.commons.codec.binary.Base64"%>
    <%
         Locale.setDefault(Locale.SIMPLIFIED_CHINESE);
         request.setCharacterEncoding("UTF-8");
         response.setContentType("text/html;charset=UTF-8"); //this is redundant
         request.getCharacterEncoding();
         response.getCharacterEncoding();     
         try {
             if (user1 != null) {
                   message+="1"+mpmservice.getLang(user.getLang(), "errmsg_username_exist")+"<br>";
                   bError=true;
              if(bError) {
                   response.sendRedirect("create_user.jsp?s=" + request.getParameter("s") + "&msg=" + message + "&name=" + name + "&description=" + description + "&phonenumber=" + request.getParameter("phonenumber") + privStr);
              %>
              <html>
              <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              </head>     
              <body>     
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "create_user_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="create_user_do.jsp">
                   <input type=hidden name=msg value="<%=message%>">
                   <table class="infotable" id="report">
                        <tr>
                             <td class="left"><%=mpmservice.getLang(user.getLang(), "create_user_label_name")%></td>
                             <td class="middle" colspan="2"><%=name%></td>
                             <td class="right"> </td>
                        </tr>
                        <tr>
                             <td class="left"> </td>
                             <td class="halfmiddle">
                                  <input class="halfmiddle" name="Create" type="submit" id="Create" value="<%=mpmservice.getLang(user.getLang(), "create_user")%>" />
                             </td>
                             <td class="halfmiddle">
                                  <input class="halfmiddle" name="Cancel" type="button" id="Cancel" value="<%=mpmservice.getLang(user.getLang(), "cancel")%>" onClick="location='create_user.jsp?s=<%=request.getParameter("s")%>&msg=<%=message%>&name=<%=name%>&description=<%=description%>&phonenumber=<%=request.getParameter("phonenumber")%><%=privStr%>'" />
                             </td>
                             <td class="right"> </td>
                        </tr>
                   </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
         </body>
    </html>
    [[u]b]2.jsp[/b][/u]
    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="java.util.Locale"%>
    <%@ page import="org.apache.commons.codec.binary.Base64"%>
    <%
         Locale.setDefault(Locale.SIMPLIFIED_CHINESE);
      request.setCharacterEncoding("UTF-8");
         response.setContentType("text/html;charset=UTF-8"); //this is redundant
         request.getCharacterEncoding();
         response.getCharacterEncoding();
         try {
             String message = request.getParameter("msg");
             System.out.println("in create_user.jsp  message>>>>>"+message);
              %>
              <html>
              <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
              </head>     
              <body>               
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "create_user_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="create_user_confirm.jsp">
                   <input type=hidden name=s value="<%=request.getParameter("s")%>">
                   <table class="infotable" id="report">
                        <tr>
                             <td class="left"><%=mpmservice.getLang(user.getLang(), "create_user_label_name")%></td>
                             <td class="middle" colspan="2"><input class="middle" name="name" type="text" id="name" size="35" value="<%=name%>" /></td>
                             <td class="right">
                             <% if (message!=null && message!="" && message.startsWith("1") ) { %>
                                  <%=message.substring(1,message.indexOf("<br>")) %>
                                  <% message=message.substring(message.indexOf("<br>")+4,message.length()); %>
                             <% } %>
                              </td>
                        </tr>
                   </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
         </body>
    </html>
    [u].properties file[/u]
    errmsg_username_exist=\u60A8\u7684\u540D\u5B57\u5DF2\u7D93\u88AB\u4ED6\u4EBA\u4F7F\u7528!
    [\code]
    i really appreciate whoever reply this issue.
    thanks a lot

  • How to show a picture from my database (BLOB field) Oracle into my JSP

    Hi all, i got a problem trying to show a picture in my JSP.
    I have a servlet which loads my picture, the problem is that i dont know how to set into a session// session.setAttribute("xxx","aaa") // or if there is another way to set it up, in order to show it in my JSP, if someone could help me i really appreciate it... thanks

    The way you include it in your jsp is the standard way you download any image.
    With an image tag
    <img src="myImageServlet?imageId=42"/>
    and your imageServlet actually returns the picture via its output stream.
    ie it makes 2 requests. One for the jsp page, and then when it receives and parses the html, one to the servlet to get the image.

  • How to communicate between Flex and JSP and show the result in an Iframe

    Hi all
    I am trying to send some data from flex to one HTTPService and trying to show the same response jsp in an Iframe. But unfortunately i am unable to get the responce Jsp's url to set as a source for iframe.
    let me explain you clearly...I have a mxml where i am having a text box and a button in the left panel and in the right panel i am having an Iframe to display jsp. So once user enters some value in the text box and clicks button then HTTPservice's send method will be called with text box's content as an arguement. So i can fetch that value from request object in jsp and display the value in jsp. So the problem here is i want display that result jsp in my Iframe. I know that , we need that result jsp URL to display in Iframe . But as i am sending POST request to HTTPservice, i am not able to get the result jsp's URL in flex side.
    So i need help desperately from great minds.So anyone of you can give me some suggestions!!!!
    Regards

    Hi all can some one please give a solution ...Any suggestions would be greatly appreciated

  • How to show chinese characters in Itunes.

    I downloaded Itunes for windows XP on my work desktop but it doesn't show the chinese characters instead it shows boxes. I have Itunes on my Powerbook and I didn't have to do anything special and the chinese characters are shown.

    I downloaded Itunes for windows XP on my work desktop
    but it doesn't show the chinese characters instead it
    shows boxes. I have Itunes on my Powerbook and I
    didn't have to do anything special and the chinese
    characters are shown.
    In WinXP, you do need to do something special to enable Chinese support. See this page:
    http://www.microsoft.com/globaldev/handson/user/xpintlsupp.mspx

  • Hi... A simple question of JSP...

    Hi All,
    Do anybody know how can I pass chinese character from a html to JSP???
    should I encode it first?
    I have tried to pass it as normal character.. but the JSP can't get it correctly...
    Vincent

    Question is: if your chinense character (in html) is in unicode(UTF-8)
    ,or it is char from special chinense character set,or html special char.
    If it is html special char->jsp will show it correctly.
    If not:
    To head of jsp give:
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    If this character is in utf-8 it will be ok.
    If this char is from chinense charset you must decode it to utf-8.
    Hi All,
    Do anybody know how can I pass chinese character from
    a html to JSP???
    should I encode it first?
    I have tried to pass it as normal character.. but the
    JSP can't get it correctly...
    Vincent

Maybe you are looking for