Java 将jsp方法拆分为多个scriplets,以便在其中包含html代码
我正在用JSP编写一个方法,用于转储表中的行:Java 将jsp方法拆分为多个scriplets,以便在其中包含html代码,java,jsp,jsp-tags,Java,Jsp,Jsp Tags,我正在用JSP编写一个方法,用于转储表中的行: <%! void dumpRows(List<MyClass> obList){ int a = 10; for(int i = 0; i<100; i++){ %> //lots of HTML code which uses the variables from the dumpRows method <td> <%=a*
<%!
void dumpRows(List<MyClass> obList){
int a = 10;
for(int i = 0; i<100; i++){
%>
//lots of HTML code which uses the variables from the dumpRows method
<td> <%=a*i%> </td>
<%
}//for loop ends
}//method ends
%>
我认为问题在于你在混音我认为问题在于你在混音对不起,但答案很难理解。另外,请提及解决方案,而不是仅仅指出问题。据我所知,您只是想打印a*i的值,所以要在jsp页面上打印,您应该这样写,但在您的代码中,您正在编写Thanx,但这只是一个键入错误。我现在已经编辑了这个问题。对不起,答案很难理解。另外,请提及解决方案,而不是仅仅指出问题。据我所知,您只是想打印a*i的值,所以要在jsp页面上打印,您应该这样写,但在您的代码中,您正在编写Thanx,但这只是一个键入错误。我现在已经编辑了这个问题。你得到的错误是什么?它无法编译。它希望scriplet的第一部分中有一个“}”来关闭for循环。您得到的错误是什么?它不会编译。它希望scriplet的第一部分中有一个“}”来关闭for循环。
<%!
void dumpRows(List<MyClass> obList){
int a = 10;
for(int i = 0; i<100; i++){
%>
//lots of HTML code which uses the variables from the dumpRows method
<td> <%=a*i%> </td> //here problem
<%
}//for loop ends
}//method ends
%>