ITeye博客

js中EL表达式使用(jsp中)

cookieandsession · 2013-08-02 16:57 · js/jquery · 行业应用 · Markdown

比如访问servlet set (request.setAttribute("xxx", "yy"); request.getRequestDispatcher("/2.jsp").forward(request, response)),然后跳转到http://localhost:8080/day05/set?name=Tom&age=30 然后可以通过以下代码获取相关数据,其实明白jsp翻译成的servlet代码,就会了然。JspWriter out = pageContext.getout()。out.write("");

<script type="text/javascript">
    	alert('${requestScope.xxx}');
    	alert('${xxx}');
    	alert('${param.age}');
    	alert('http://' + '${pageContext.request.serverName}' + ':' + '${pageContext.request.serverPort}' + '${pageContext.request.contextPath}' + '${pageContext.request.servletPath}');
    </script>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。