Getting chinese charaters from Form using request.getParameter()

Hi,
I want my JSPs to be unicode enabled. In HTML forms user can enter any characters like japnese, chinese etc. But on the server side if user enters any such characters i am getting decimal equivalent of that character in the form of &#{decimal equivalent}; in the request.egetParameter() method.
For ex if I enter �覢覣觇觉訅 then i get "╢&# 35234;&# 35235;&# 35271;&# 35273;&# 35333;" in request.getPrameter().
I have given the charset "UTF-8" in the header of my JSPs.
I tried to decode it with URLDecoder but it fails then i tried to read these parameters using reader but it also fails, then
String para = request.getParameter("para"); // where para is name of received parameter
byte[] bytes = para.getBytes();
para = new String(bytes, "UTF-8");
This also fails.
Can anyone please tell me how to handel this problem?
Thanx
-Vaijayanti

Hi,
I have tried this in my jsp and it works for me, assuming that the form is submitted with encoding UTF-8 :
Submitting JSP :
<form action="test.jsp">
<input type="text" name="a">
</form>
This is test.jsp :
<%
String a = new String (request.getParameter ("a").getBytes (), "UTF-8");
%>
Passed Parameter = <%=a%>
Hope that helps
Thanks
Amit

Similar Messages

  • Unable get complete filepath from jsp page using request.getParameter()

    Hey all,
    i am actually trying to get the selected file path value using request.getParameter into the servlet where i will read the (csv or txt) file but i dont get the full path but only the file name(test.txt) not the complete path(C:\\Temp\\test.txt) i selected in JSP page using browse file.
    Output :
    FILE NAME : TEST
    FILE PATH : test.txt
    Error : java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at com.test.TestServlet.processRequest(TestServlet.java:39)
    at com.test.TestServlet.doPost(TestServlet.java:75)
    JSP CODE:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>DEMO SERVLET</title>
    </script>
    </head>
    <body>
    <h2>Hello World!</h2>
    <form name="myform" action="TestServlet" method="POST"
    FILE NAME : <input type="text" name="filename" value="" size="25" /><br><br>
    FILE SELECT : <input type="file" name="myfile" value="" width="25" /><br><br>
    <input type="submit" value="Submit" name="submit" />
    </form>
    </body>
    </html>
    Servlet Code :
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException, FileNotFoundException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    String filename = request.getParameter("filename");
    out.println(filename);
    String filepath = request.getParameter("myfile");
    out.println(filepath);
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet TestServlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
    if (filepath != null) {
    File f = new File(filepath);
    BufferedReader br = new BufferedReader(new FileReader(f));
    String strLine;
    String[] tokens;
    while ((strLine = br.readLine()) != null) {
    tokens = strLine.split(",");
    for (int i = 0; i < tokens.length; i++) {
    out.println("<h1>Servlet TestServlet at " + tokens[i] + "</h1>");
    out.println("----------------");
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    Needed Output :
    FILE NAME : TEST
    FILE PATH : C:\\Temp\\test.txt
    Any suggestions Plz??

    As the [HTML specification|http://www.w3.org/TR/html401/interact/forms.html] states, you should be setting the enctype to multipart/form-data to be able to upload files to the server. In the server side, you need to process the multipart/form-data binary stream by parsing the HttpServletRequest#getInputStream(). It is a lot of work to get it to work flawlessly. There are 3rd party API's around which can do that for you, such as [Apache Commons FileUpload|http://commons.apache.org/fileupload] (carefully read the User Guide how to use it).
    You can also consider to use a Filter which makes use of the FileUpload API to preprocess the request so that you can continue writing the servlet code as usual. Here is an example: [http://balusc.blogspot.com/2007/11/multipartfilter.html].

  • Opening .pdf files from forms using OLE

    Hi,
    I want to open, print , save and save as pdf files from forms using OLE . Please help me with the same.
    Thanks
    Vidya

    If you are in client/server mode, you can put an OLE container component on your form. However, be warned that this method does not work when you convert to the forms server web enabled mode. If you anticipate moving your application to the web anytime soon, my advice would be to web-enable first and then add in the feature to view .pdf (or other) files. In our client/server app, I went to a lot of trouble to add in OLE features such as you describe, and now I have to completely re-write those features for the web.

  • Could not getting field values from form

    hi,
    hellow, can you help me for solving the bellow problem
    i have form its enctype attribute of form tag is setted as multipart/form-data. when i am submiting this form, i call a request.getParameter(); in the submitting jsp file. But for any controls such as text,checkbox,select box etc could not get its corresponding value.

    Its obvious why its not picking up the change in the second action.
    Lets see...
    Here is your case I
    You get the populated form which is also put in the request with updated value from the JSP....
    (1)
    protected Forward updateGoalObjective(GoalsForm form)
    form.setGoalId(44); //int field set to 44
    return new Forward("success");
    You set one of the fields some other value....in one but how will the second action know about it???
    You try to execute the second action and the action grabs the form from the request again. This is the original form submitted by the JSP so you still see that value...
    You will have to pass in the customized or processed form for the form to be able to get it...
    protected Forward showGoal(GoalsForm form)
    System.out.println(form.getGoalId()); //prints 68
    return new Forward("success");
    In your second case you create a new form...why would you want to do that if you have a form value being set in JSP??
    The answer is you should be doing something Like this:
    * @jpf:action form="goalsForm"
    * @jpf:forward name="success" path="showGoal.do"
    protected Forward updateGoalObjective(GoalsForm form)
    //other code
    form.setGoalId(44); //int field set to 44
    return new Forward("success", form);
    * @jpf:action form="goalsForm"
    * @jpf:forward name="success" path="Goal.jsp"
    protected Forward showGoal(GoalsForm form)
    System.out.println(form.getGoalId()); //prints 68
    return new Forward("success");
    }

  • How to polulate data from lookup using request dataset in OIM 11g

    Hi,
    Using Request dataset in OIM 11g, I need to display one dropdown with the roles those need to come from Lookup.
    For Ex; I have 2 resources,i.e Resource A and Resource B. Resource A has 5 roles and Resource B has 3 Roles.
    While creating a request, If I select Resource A, then I should be able to get 5 Roles and if I select Resource B then I should be able to see corresponding 3 roles.
    Pls. note I have only one Look up definition , where I have roles for both Resource A and B.
    I have done simillar thing in OIM 10g , however I am unable to do it using OIM 11g Request dataset.
    Pls suggest.

    Hi BB,
    I am trying to follow up your response.
    You are suggestng to use prepopulate adapter for to populate respource object name, that means We have to just use an sql query from obj tabke to get the resource object name. right ?? it could be like below, what should I have entity-type value here ??
    <AttributeReference name="Field1" attr-ref="act_key"
    available-in-bulk="false" type="Long" length="20" widget="ENTITY" required="true"
    entity-type="????"/>
    <PrePopulationAdapter name="prepopulateResurceObject"
    classname="my.sample.package.prepopulateResurceObject" />
    </AttributeReference>
    <AttributeReference name="Field2" attr-ref="Field2" type="String" length="256" widget="lookup-query"
    available-in-bulk="true" required="true">
    <lookupQuery lookup-query="select lkv_encoded as Value,lkv_decoded as Description from lkv lkv,lku lku
    where lkv.lku_key=lku.lku_key and lku_type_string_key='Lookup.xxx.BO.Field2'
    and instr(lkv_encoded,concat('$Form data.Field1', '~'))>0" display-field="Description" save-field="Value" />
    </AttributeReference>
    Then I need think about the 'Lookup.xxx.BO.Field2' format.
    Could you please let me know if my understanding is correct?? What is the entity-type value of the first attribute reference value?
    Thanks for your all help.

  • How get all components from form Jdev10.1.3.4

    hi
    I have a form on her field is not related to VO. Pagedef empty.
    each element has the id and Binding.
    <af:inputText label="#{r['questionnaire.surname']}"
                                  required="true" id="surname"
                                  binding="#{QuestionnaireBean.surname}"
                                  />I want to get an array of elements.
    in obtaining a list of bindings
             BindingContainer bindings = getBindings ();
             bindings.getAttributeBindings ();null ((((((

    As you are asking your empty pagedef, which is what you do with
    BindingContainer bindings = getBindings ();
    bindings.getAttributeBindings ();it returns null. This is expected behavior.
    You have to walk the component tree to get all components check each for it's type and get the information from the component itself. You can use something like
    // reset all the child uicomponents
    private void getAllUIItems(AdfFacesContext adfFacesContext,
                                     UIComponent component){
       List<UIComponent> items = component.getChildren();
       for ( UIComponent item : items ) {
           getAllUIItems(adfFacesContext,item);
           if ( item instanceof RichInputText  ) {
               RichInputText input = (RichInputText)item;
               //do your work here e.g. store id in an array
           } else if ( item instanceof RichInputDate ) {
               RichInputDate input = (RichInputDate)item;
               //do your work here e.g. store id in an array
    }you may have to alter the signature of the method to return the array of ids ...
    Timo

  • How to get all events from calendar using calcalendar store framework.

    Hello,
    I have two problems with calcalendar store framework programming.
    1. I need all the event which are present in iCal calendar.Event may be present in year 2025 or 2050. and if the event is recurring then i need only one event.
    2. if the event is recurring then i need only one event within the calendar event predicates (start date and end date). I am not suppose to give the occurrence date for event.
    How can I implement this with CalCalendar store framework.
    Thanks And Regards,
    xmax.

    Hi,
    Per my knowledge, there is not a method to get all the recurring events using CAML query in one request.
    Here is a thread with the similar question for your reference:
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/eed6be6d-c9ff-4d01-80de-8a4b67d3d7a5/use-caml-to-get-all-recurring-events-from-a-calendar
    We can get all the calendar list events at first, then filter all the recurring event from the result set.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Unable to run reports from forms using run_report_object

    Hi All,
    I am unable to run a report(9i) from forms(9i) in client side.
    I used the following code
    Declare
         repid REPORT_OBJECT;
         v_rep varchar2(100);
         rep_status varchar2(20);
    Begin     
         repid := FIND_REPORT_OBJECT('report4');
         v_rep := RUN_REPORT_OBJECT(repid);
    End;
    I get the following error
    FRM-41219 : Cannot find report:invalid ID.
    Any help will be highly appreciated.
    Thanks,
    Sanjay

    Hi All,
    I am unable to run a report(9i) from forms(9i) in client side.
    I used the following code
    Declare
         repid REPORT_OBJECT;
         v_rep varchar2(100);
         rep_status varchar2(20);
    Begin     
         repid := FIND_REPORT_OBJECT('report4');
         v_rep := RUN_REPORT_OBJECT(repid);
    End;
    I get the following error
    FRM-41219 : Cannot find report:invalid ID.
    Any help will be highly appreciated.
    Thanks,
    Sanjay Hi
    You have to create a report object within the form.
    If you look at the Object NAvigator in the Form Builder right below Record Group
    tou would see an option for Report. Create a new report object.
    Set the following properties for that object
    Filename - This should be the name of your RDF file you created from Report Builder along with the full path.
    Set the Execution Mode, Communication Mode and Report Destination Type as per your requirements.
    In the parameter for find_report_object() pass the name of the report object you created.
    eg.
    if the name of the report object you created is Report2 then
    your call should be rep_id := find_report_object('Report2') .
    You are calling the report object which has been created in your form builder and through that call you are running the report file specified in the Filename property of that report object.
    Regards
    Poorvi

  • Passing parameter to report from form using RUN_REPORT_OBJECT method

    Will you please let me know how to do this. I tried using run_product but it is giving error as too many declarations. So I decided to use RUN_REPORT_OBJECT, but no help is provided how to pass paramters to this routine from FORMS to REPORTS.

    If you just want to change the heading of a column dynamically, you can go with any of the two options. For both the options, you need to remove the static text and replace it with any dummy field (ensure the reference of field w.r. to repeating frame)
    1. Use the Format Trigger and change the heading to either "school" or "college" based on your field value.
    Ex.
    If :<field_name> = 'S'
    then :dummy_field := 'School'
    Else
    :dummy_field := 'College'
    End If;
    Return (true)
    2. Another option is similar to this and uses a CF.
    (I would prefer CF).
    Warm Regards,
    Raja.

  • File upload from form using cf8 file functions within cfscript?

    essentially, i'm wondering if anyone can give me an example
    of a way to replicate cffile upload using cf8's native file
    manipulation functions within a cfscript tag?
    more specifically, i am wondering if anyone had any code
    examples for uploading a file specified by a user on an html form
    using cf8's file functions (fileOpen, fileCopy, fileDelete,
    fileMove, fileClose, etc....) within a cfscript tag. i've done this
    a number of times in the past using upload through cffile, but i'd
    like to take advantage of cf8's new native file functions and be
    able to deploy the code within a cfscript block.
    i've found some simple examples of the file functions within
    the docs and online, but nothing showing me how to take a file from
    an html form and upload it where i want it, as cffile will do.
    thanks in advance for any help.

    those cf8 file functions are for manipulating files on the
    server.
    you still need to upload the file in one way or another.
    as for replicating cffile action=upload in cfscript: just
    write a
    function that uses cffile tag to upload a file, and call that
    function
    from your cfscript!
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Sending email from forms using 'from'

    I'm trying to send an email from forms. It goes well, but I like to use the 'from' field from Outlook. How can I use it in OLE? I have searched everywhere, but can't find it.
    It seems to me it is something like the way you do with BCC and CC options, but I haven't found a way to do the same thing with the From field. Can anyone help?
    Thanks,
    Pauline Kooy

    Fabrizio,
    Are you just sending the Line Feed character 'CHR(10)"? I typically send the Carrage Return character 'CHR(13)' as well. I'll create a variable called CRLF and assign the Carrage Return and Line Feed characters to this variable. Then reference the CRLF variable when I want to embed a new line.
    For example:
    DECLARE
       crlf         VARCHAR2(2) := chr(13)||chr(10);
       v_msg_body   VARCHAR2(2000);
    BEGIN
       v_msg_body := 'lots of text here'||crlf;
    END;Hope this helps.
    Craig...

  • HT4759 can anyone get their email from icloud using their android tablet?

    can anyone get their emial from i cloud when using their android tablet//

    i downloaded a CardDav app but it wants to know what my server name or URL is and I have no idea what server is needed?  from my android tablet server?  I have a verison ellipse7 i just rec'd yesterday and this is all new to me; and just newbie to iPhone from just two weeks ago. 
    AFter the server name it asks for user name and password - I assume that is for the iCloud email account, right?
    Carol

  • Getting the Details from a HTTP Request using C#

    Hi,
    Suppose, a user submits a form with some details as Address, Phone Number etc.. to a Web Application. On the client side, I need to have a proxy to intercept this http request message being sent to the Server and get the details in it like Phone number and
    Address in this case and display them to user in a pop up box for confirming and if he clicks YES, then only I should forward the request to Web Server/Web Application. 
    If the user feels that the information shown to him is not correct he can Click NO and the request will not be sent to the Server. Anyone know how to use this in DOTNET WEB APPLICATIONS?
    I need to write code for the Proxy Part, I am not sure how to handle HTTP messages and from where to start with. Any help would be of great help.
    Thanks
    K.V.N.PAVAN

    http://forums.asp.net/
    Yu have many sections to choose from concerning Web based solutions.

  • How can I get multiple values from form as a list ?

    we designed a form , and there are some attributes designed as checkbox , the data in the form is like following :
        <xml ......>
                <party>11</party>
                <party>22</party>
                <party>33</party>
        </xml>
    Is there any easy way to get the parties' data from the xml into a list predefined as a process varible  ?
    Any help is appreciated !

    You woudl use a setValue service and use xPath expressions to extract the individual party nodes from the inbound XML and then populate the list with these values.
    Paul

  • Calling report with parameter screen from form using frmrwinteg

    Hi,
         I am calling a report with a parameter screen from a form and am using the frmrwinteg bean. This works fine on our test application server but, when moved onto our production application server, the database logon screen is presented after pressing the submit button on the parameter screen. The cause of the problem seems to be the html generated to simulate the parameter screen. The html on the test application server contains a BASE tag in the HEAD section with an href starting "http:/servername.companyname.com". However, the same tag in the html generated on the production application server is missing the ".companyname.com", causing the cookie produced by the frmrwinteg bean to not be found. Does anyone know how the BASE href tag is generated and what I need to change to get the correct BASE href value? I am using Forms/Reports 10g R2 and Application Server 10.1.2.
    Cheers.....

    Appendix "A" of this document describes how cookie_domain works:
    http://otn.oracle.com/products/forms/pdf/10g/frmwebshowdoc_rep.pdf

Maybe you are looking for