我想知道什么是url编码。 我有2个jsp页面和一个servlet。 当我运行的应用程序中显示的网址是:在java中的url编码?
http://localhost:8080/myproject/index.jsp
其中
的index.jsp:
<form action="Myservlet" method="post">
<input type="text" name="mytext" id="mytext"/>
<input type="submit" value="submit"/>
</form>
提交按钮被点击所显示的URL后:
http://localhost:8080/myproject/Myservlet
URL编码是什么意思?我如何编码网址?
从index.jsp
去Myservlet
然后result.jsp
Myservet#的doPost //我需要在这里做URL编码?如果是的话如何?
fetching data from db.......
....................
String nextJSP = "/result.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextJSP);
dispatcher.forward(request,response);
result.jsp中
displays data here
请有人给一些回答我的问题 – sujit 2012-04-23 07:46:38
你甚至尝试谷歌吗? http://en.wikipedia.org/wiki/URL_Encoding – home 2012-04-23 07:52:27
可能重复:http://stackoverflow.com/questions/8713208/how-to-encode-a-url-with-the-special-character-percentage(见第二个响应) – blackcompe 2012-04-23 07:53:58