Current Position:Home > How can i passing chinese word parameter within jsp

How can i passing chinese word parameter within jsp

Update:10-11Source: network consolidation
Advertisement
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

The Best Answer

Advertisement
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 can i passing chinese word parameter within jsp Update:10-11

    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

  • How to pass a date parameter(from a procedure IN) to a API Update:10-11

    Hi, CREATE OR REPLACE package body xxal_basic_sal_increment_pkg1 as procedure emp_pro_inc1(ERRBUF VARCHAR2,RETCODE OUT NUMBER, p_business_group_id_enter in number,p_change_date in varchar2) is CURSOR STAFF IS SELECT pp.ASSIGNMENT_ID ,peo.EMPLOYEE_NUM

  • How to pass a date parameter from report builder query designer to oracle database Update:10-11

    i'm using report builder 3.0 connected to oracle database. i'm trying to pass a date parameter in the query with no success, i don't know the exact syntax. I've tried : SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEA

  • Pass multi value parameter to sub report in Drill through report, ssrs Update:10-11

    I have two reports 1 is subreport and other is main report. Date Field are placed in both reports. i have groups in main report, one group is task. In the task fields one persons is working in 3 project, two project are same company and 1 is for othe

  • Passing multi value parameter to the Drill through report Update:10-11

    Hi I have two reports say Report A and Report B. Both reports using same parameters. I am Navigating from Report A to Report B using Jump to Report option. Now when I pass multiple parameter to the Report B it only displays first parameter results. I

  • Passing multi-value parameter from BIEE dashboard to BIP report Update:10-11

    It is possibile passing multi-value parameter from BIEE dashboard prompt to BI Publisher integrated report? (BIP report has a DB data source (not a answers)) Thank you R.Hi Rajkm, In order to pass a multi-value parameter through the Reporting Service

  • OpenDocument.aspx - pass multi value parameter when report type is actx Update:10-11

    We are running Crystal Reports XI R2 against a business objects infoview server. We have been successfully using the OpenDocuments method for opening crystal reports but have run into a snag.  When using a multi-value parameter, we can only get it to

  • Problem when using WEB.SHOW_DOCUMENT and passing in lexical parameter Update:10-11

    Hi, I got a blank page with error "An error has occured while trying to use this document" when I tried to use web.show_document and passing a lexical parameter to 10g report on 10gAS. The URL in the web.show_document is: http://<srvname>:

  • Pass a date parameter to Stored Procedure Update:10-11

    Hello friends, Can you help to pass a date parameter to Stored procedure from JSP. This is my code: In Oracle 9i I have this: PROCEDURE SP_EDORES( pfechaini IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field pfechafin IN hist_p

  • How to pass in a parameter into a report viewer on a jsp - and hidden Update:10-11

    Hi, I've built a php application and am using the java environment to enable the crystal report/viewer.  The developer was looking how to pass in a parameter into a report viewer on a jsp. Ultimately the end product we need is to get an HTML report v