tomcat #{..} is not allowed in template text
前日在处理jsp页面时提示错误“tomcat #{..} is not allowed in template text”; 项目运行在tomcat5.5上是没有问题的,但是在tomcat6.0上就会出现上面的错误。经过一番网络搜索,发现原来是JSP2.1规范对#{…}的兼容性问题: tomcat5.5用的是JSP2.0规范~~~~~ 废话不多说了; 方案一: 参考 上面的操作吧,我没测试上面说的方法是否好用; 方案二: step1.在页面定义字符串变量; step2.把需要#的位置用刚才定义的变量替换;
<%
String a = " # " ;
%>
< input id = " brithday " name = " brithday " class = " Wdate " type = " text " onfocus = " WdatePicker({minDate:2002-1-1,maxDate:<%=a%> {%y+1}-12-%ld}) " style = " cursor:pointer " readonly = " readonly " /> <% String a = " # " ; %> < input id = " brithday " name = " brithday " class = " Wdate " type = " text " onfocus = " WdatePicker({minDate:2002-1-1,maxDate:<%=a%> {%y+1}-12-%ld}) " style = " cursor:pointer " readonly = " readonly " />
String a = " # " ;
%>
< input id = " brithday " name = " brithday " class = " Wdate " type = " text " onfocus = " WdatePicker({minDate:2002-1-1,maxDate:<%=a%> {%y+1}-12-%ld}) " style = " cursor:pointer " readonly = " readonly " /> <% String a = " # " ; %> < input id = " brithday " name = " brithday " class = " Wdate " type = " text " onfocus = " WdatePicker({minDate:2002-1-1,maxDate:<%=a%> {%y+1}-12-%ld}) " style = " cursor:pointer " readonly = " readonly " />
上一篇:
Java架构师技术进阶路线图