how to print URL into jsp page while URL has hindi text ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rspvsanjay
    New Member
    • Sep 2016
    • 21

    how to print URL into jsp page while URL has hindi text ?

    I want to print URL into next jsp page , even if URL has hindi text content.

    index.html file :


    <html>
    <head>
    <title>T-SUMM</title>
    </head>

    <body>

    <form method="Post" action="./result.jsp">
    <center>
    Enter a URL : <input name='habits' id='t1'>
    <br><br>
    <input type="submit" name="submit">
    </center>
    </form>
    </body>

    </html>

    JSP page result.jsp

    <%@ page language="java" contentType="te xt/html; charset=UTF-8" pageEncoding="U TF-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>T-SUMM</title>
    </head>

    <body>
    <%
    String[] values=request. getParameterVal ues("habits");

    for(int i=0;i<(values.l ength);i++)
    {
    out.println("<b r><br>&nbsp;"+v alues[i]);out.println() ;
    }
    %>
    </body>

    </html>

    above code print URL as : https://hi.wikipedia.or g/wiki/%E0%A4%B5%E0%A4 %BE%E0%A4%B0%E0 %A4%BE%E0%A4%A3 %E0%A4%B8%E0%A5 %80

    but i want to print URL with hindi text content into next JSP page, which is attached as image file.
    Attached Files
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    Why are you submitting it as GET-request? Make a form, put the text inside and submit it as POST request.
    With a GET request, your parameter containing the text can only be max. 2000 bytes long, and every hindi character needs 2 times 3 bytes or more....
    That means it is technically not possible to add a long Hindi text as a query parameter at the end of the URL. But with posting a form, you have no text length limitation and your text characters would not be converted to their unicode representation.

    Comment

    • rspvsanjay
      New Member
      • Sep 2016
      • 21

      #3
      ok, but i do not know how to do ?

      please edit my above code and post here.

      Comment

      Working...