JAX-WS Web服务客户机入门 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-20
ServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { // Call Web Service Operation String TextArea1 = request.getParameter("TextArea1"); org.netbeans.end2end.check.client.CheckSoap port = service.getCheckSoap(); // TODO initialize WS operation arguments here java.lang.String bodyText = TextArea1; java.lang.String licenseKey = "0"; // TODO process result here org.netbeans.end2end.check.client.DocumentSummary doc = port.checkTextBody(bodyText,licenseKey); String allcontent = doc.getBody(); //From the retrieved document summary, //identify the number of wrongly spelled words: int no_of_mistakes = doc.getMisspelledWordCount(); //From the retrieved document summary, //identify the array of wrongly spelled words: List allwrongwords = doc.getMisspelledWord(); out.println("<html>"); out.println("<head>"); //Display the report''s name as a title in the browser''s titlebar: out.println("<title>Spell Checker Report</title>"); out.println("</head>"); out.println("<body>"); //Display the report''s name as a header within the body of the report: out.println("<h2><font color=''red''>Spell Checker Report</font></h2>"); //Display all the content (correct as well as incorrectly spelled) between quotation marks: out.println("<hr><b>Your text:</b> "" + allcontent + """ + "<p>"); //For every array of wrong words (one array per wrong word), //identify the wrong word, the number of suggestions, and //the array of suggestions. Then display the wrong word and the number of suggestions and //then, for the array of suggestions belonging to the current wrong word, display each //suggestion: for (int i = 0; i < allwrongwords.size(); i++) { String onewrongword = ((Words) allwrongwords.get(i)).getWord(); int onewordsuggestioncount = ((Words) allwrongwords.get(i)).getSuggestionCount(); List allsuggestions = ((Words) allwrongwords.get(i)).getSuggestions(); out.println("<hr><p><b>Wrong word:</b><font color=''red''> " + onewrongword + "</font>"); out.println("<p><b>" + onewordsuggestioncount + "suggestions:</b><br>"); for (int k = 0; k < allsuggestions.size(); k++) { String onesuggestion = (String) allsuggestions.get(k); out.println(onesuggestion); } } //Display a line after each array of wrong words: out.prin |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于JAX-WS Web服务客户机入门 - 编程入门网的所有评论