如何在JSP中使用泛型程式設計?

以上的程式要如何才能正確在Tomcat上執行呢?

目前的錯誤訊息如下:
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 4 in the jsp file: /generic/generic.jsp
Generated servlet error:
Syntax error on token "<", invalid AssignmentOperator

An error occurred at line: 4 in the jsp file: /generic/generic.jsp
Generated servlet error:
Syntax error on token "=", != expected

An error occurred at line: 4 in the jsp file: /generic/generic.jsp
Generated servlet error:
Syntax error on token "<", ( expected

An error occurred at line: 4 in the jsp file: /generic/generic.jsp
Generated servlet error:
Syntax error on token "(", invalid Expression



2.Re:如何在JSP中使用泛型程式設計? [Re: variable] Copy to clipboard
Posted by: koji
Posted on: 2005-04-30 13:42

首先你用的tomcat版本呢?j2se版本

另外servlet可以在5.5下用generics
但是jsp我記得在新的tomcat下是跑eclipse的jdt
所以你必須像這樣

(1) Ant( http://ant.apache.org/ )把最新版的ant.jar複製到 ${CATALINA_HOME}/common/lib。
(2) 把${CATALINA_HOME}/common/lib 的 jasper-compiler-jdt.jar 移除。
(3) ${CATALINA_HOME}/conf/web.xml 內org.apache.jasper.servlet.JspServlet的設定改成如下。
12345678
          <init-param>
             <param-name>compilerSourceVM</param-name>
             <param-value>1.5</param-value>
         </init-param>
         <init-param>
             <param-name>compilerTargetVM</param-name>
             <param-value>1.5</param-value>
         </init-param>

你可能感兴趣的:(jsp)