以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Web架构 』   (http://bbs.xml.org.cn/list.asp?boardid=66)
----  Java Web项目中加入ICTCLAS分词  (http://bbs.xml.org.cn/dispbbs.asp?boardid=66&rootid=&id=78026)


--  作者:刘祥
--  发布时间:10/29/2009 9:07:00 PM

--  Java Web项目中加入ICTCLAS分词
test.jsp内容  <form method="post" action="testAction.jsp" name="tiwen">
      <table >      <tr>        <td>问题</td>
        <td colspan="2"><input type="text" name="question" maxlength="50"><input type="button" value="提问" ></td>
      </tr>      <tr>      <td>答案区</td>
      <td colspan="2"><textarea name="testContent" cols="60" rows="8"></textarea
testAction.jsp内容
<jsp:useBean id="fenci" class="org.dlmu.lx.fenci.FenCiBean" scope="session" />
<%
  fenci.setResult(request.getParameter("question"));
   String Question = fenci.getResult();
%>
<%= Question %>
FenCiBean .java内容
import ICTCLAS.I3S.AC.ICTCLAS30;
public class FenCiBean {
 private String result;
 public String getResult() {
  return result;
 }
 public void setResult(String result) throws Exception {
  ICTCLAS30 testIC=new ICTCLAS30();
  String argu=".";
  if(testIC.ICTCLAS_Init(argu.getBytes("gb2312"))==false){
   System.out.println("error");
   return;
  }
  System.out.println("sucess");
  int b=testIC.ICTCLAS_ImportUserDict("userdict.txt".getBytes("gb2312"));
  byte nativeBytes[] = testIC.ICTCLAS_ParagraphProcess(result.getBytes("GB2312"), 0);
  String nativeStr = new String(nativeBytes, 0, nativeBytes.length, "GB2312");
  testIC.ICTCLAS_Exit();
  this.result = nativeStr;
 } 
}
运行时出现如下错误:
javax.servlet.ServletException: Could not initialize class ICTCLAS.I3S.AC.ICTCLAS30
 at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:495)
 at org.apache.jsp.testAction$jsp._jspService(testAction$jsp.java:94)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:202)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)

   


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms