English 中文(简体)
特殊用途
原标题:Exception in Using org.mozilla.universalchardet.UniversalDetector

我写了一页小页,我想确定要求参数的特性。 这是我的法典:

String name= request.getParameter("hey");
UniversalDetector detector;
try{
    detector = new UniversalDetector(null); //Exception is thrown here

    detector.handleData(name.getBytes(), 0, name.length());
    detector.dataEnd();
    String encoding = "s";//detector.getDetectedCharset();
    if (encoding != null) {
        out.println("Detected encoding = " + encoding);
    } else {
        out.println("No encoding detected.");
    }
    detector.reset();
}catch(Throwable e3)
{
    out.print("Error: Jasper Exception >>"+e3.getMessage()+"<br>");
}

在第二行(我提到)中,出现了一个例外。 渔获量中的错误是:

Error: Jasper Exception >>org/mozilla/universalchardet/prober/CharsetProber

我应该做些什么?

最佳回答

I got the answer myself and I think it s good to put the answer here. The Jasper Exception was thrown because it could not find the class org/mozilla/universalchardet/prober/CharsetProber.

我注意到,我没有把prober 翻到路边。 MyWebSite/WEB-INF/classes/org/mozilla/universalchardet

我在那里翻了一番,现在工作。

P.S.:不幸的是,我的主要问题继续。 它可以指任何char,因为str时间不够长,不能被确认为特别char。

问题回答

我不知道你为什么会这样例外。 但可以肯定的是,你重新尝试做些什么赢得了工作。 当你获得请求的参数时,你会把它当作一种优势。 这意味着,网络集装箱已经将从吉大港山区的请求中收到的铁矿石转化成Stings,因此已经使用了char。

如果你打电话getBytes(>>,则你获得浏览器寄出的tes。 如果使用服务器的缺省char子,你会因重新将str形形形色色打入 by子。

你们的法典的另一个问题是例外处理:你追捕了建筑商提出的例外,但仍继续使用探测器,由于这一例外情况,该探测器尚未建立。

或许应该解释你们想要做什么和为什么要做什么。 你想这样做。





相关问题
Convert typed-in Text to lowercase

I ve got an index.jsp with [snip] <% String name = request.getParameter("name"); String pass = request.getParameter("pass"); String globalname = "webeng"; String globalpass = "2009"; ...

session transfer issue from Tomcat to ASP.Net

I am using Tomcat to host JSP and using IIS 7.0 to host aspx (C# + .Net 3.5 + VSTS 2008), and I have some session transfer issue from JSP page to ASPX page. JSP page is in one domain and all other ...

Setting the default value in Struts2

I am setting the value(kind of default value) for a drop down select value from action class in a page(given below). When the page loads the value is beig displayed but the other elements of the ...

Evaluate dynamically constructed JSP at runtime

I have a requirement where in the JSP page itself is created by the user and stored in the database. When viewing results we need to render this JSP to the client, evaluating all tags inside this JSP. ...

How to Pack/Encrypt/Unpack/Decrypt a bunch of files in Java?

I m essentially trying to do the following on a Java/JSP-driven web site: User supplies a password Password is used to build a strongly-encrypted archive file (zip, or anything else) containing a ...

JSP exception - class not found (tomcat)

I m setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root ...

ArrayList to Table in JSP

I have an ArrayList and i am trying to display it in a table ..... ArrayList rows = .... ..... <table cellspacing="1" cellpadding="4" border="3"> <tr> <TH>...

热门标签