jsp中EL表达式如何在小脚本中使用 jsp中EL表达式如何在小脚本中使用 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jsp中EL表达式是为了更好的与HTML代码分开,给美工人员提供方便,为什么还要在小脚本中使用,希望下面的代码能帮助你。<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> </head> <body> <% request.setAttribute("name","要显示的内容"); %> ${name }<br> ${requestScope.name }<br> 这两行代码在同一页面时都可以正常显示 </body></html> 直接在脚本中就可以用啊!<c:if test="${showOnly}"> ////////</c:if> response.setContentType("text/xml"); 有人见过这个问题吗? ExtJS提交表单struts2接收不到参数!请教! struts Date 和数组问题 js简单问题 servlet规范,有中文版么? Hibernate createSQLQuery问题 对象到底是怎样调用的呢? 如果调出在DOS下执行命令的信息到文本文件!请大家给个思路!谢谢 《EJB Design Patterns II》的PDF可打印版本 关于struts2最简包及其引发的tomcat容器不能启动 请教jsp网站后台静态生成html的实现思路
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<%
request.setAttribute("name","要显示的内容");
%>
${name }<br>
${requestScope.name }<br>
这两行代码在同一页面时都可以正常显示
</body>
</html>
<c:if test="${showOnly}">
////////
</c:if>