<%String date_str_p="aaa"%>
<a href="works_query.jsp?page=1&date_str=<%date_str_p%>&date_end=<%date_end_p%>">首页</a>
我这么写的但是date_str和date_end都报错了,An error occurred at line: 183 in the jsp file: /uip/works_query.jsp
Syntax error on token ".", ; expected
null

解决方案 »

  1.   

    <a href="works_query.jsp?page=1&date_str=<%=date_str_p%>&date_end=<%=date_end_p%>">首页</a>
    <%= date_str_p %>
      

  2.   

    加个 = 号
    <%= date_str_p %>
      

  3.   

    如果你是想要做开发的话,是一定要学习jstl的,原理虽然一样,但jstl是开发及其简便的利器;若是做个简简单单的小应用,直接在jsp里面写java代码也无所谓
      

  4.   

    你不能把html元素跟jsp脚本<%=%>/<%%>混在一起写的,你把变量存起来,比如存在request或者session中:<% request.setAttribute("date_str_p",date_str_p)%>,然后在<a>的href中用el表达式拿出来,<a href="works_query.jsp?page=1&date_str=${requestScope.date_str_p}&date_end=${requestScope.date_end_p}">首页</a>
      

  5.   

    不过还是建议你听楼上的,学习jstl吧,可以不用那么纠结的
      

  6.   


    jsp的知识,可以先熟悉jsp,在去看jstl
      

  7.   

    <%=>常量<%>
    <%>变量<%>