安装 Mac OSX 10.6.7、Eclipse、Tomcat 1.6
我正在尝试将 Java 文件中的字符串调用到我的 JSP 以将其显示给用户,但我不断收到以下错误。一如既往地感谢任何帮助,
JSP
<%
Injector injector = Guice.createInjector(new GuiceInjector());
SliceConnector r = injector.getInstance(SliceConnector.class);
out.println(r.search());
String dbConcept = "http://dbpedia.org/resource/human_rights";
System.out.println(r.search(dbConcept));
%>
爪哇
public String search(String dbConcept)
{
setSlicepediaProductionMode(true);
List<SliceHit> sliceHits = searchForSlices();
if (sliceHits == null) {
System.err.println("Timeout occurred while fetching slices");
return "error";
}
if (!sliceHits.isEmpty()) {
System.out.println("Found some slices Yuhuuuu ! :-) ");
String sliceContent = createSlices(sliceHits);
System.out.println("Slice content:");
System.out.println(sliceContent);
return sliceContent;
} else {
System.out.println("No Slices were found for this query");
}
System.out.println("Slice Consumer stopped activity");
return "SliceConnector";
}
private void setSlicepediaProductionMode(boolean productionMode)
{
sliceSearcher.setProductionMode(productionMode);
sliceCreator.setProductionMode(productionMode);
}
private List<SliceHit> searchForSlices() {
SlicepediaQuery sliceQuery = new SlicepediaQuery();
String dbConcept = "http://dbpedia.org/resource/human_rights";
sliceSearcher.setSliceQuery(sliceQuery);
if (sliceSearcher.run())
{
return sliceSearcher.getSliceHits();
} else
{
return null;
}
}
错误
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 141 in the jsp file: /SimpleResponse2.jsp
The method search() in the type SliceConnector is not applicable for the arguments (String)
138:
139:
140: String dbConcept = "http://dbpedia.org/resource/human_rights";
141: System.out.println(r.search(dbConcept));