编程jsp问题
<%@ page contentType="text/html;charset=GBK" %>
<h1> 使用include传递参数 </h1>
<jsp:include page="include1.jsp">
<jsp:param name="name" value="Tom and Jack "/>
<jsp:param name="age" value="22"/>
</jsp:include>
为什么这段代码编译不过去啊,请问错在哪里
我是把两个文件放在同一个文件夹下
<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<title>include动作指令 </title>
</head>
<body>
<%
String name=request.getParameter("name");
String age=request.getParameter("age");
out.print("name="+name+" <br>");
out.print("age="+age+" <br>");
%>
</body>
</html>
之前有没有setParameter
要不用dispatcher类传一下值
是不是找不到文件啊
include1.jsp
建议路径写成 工程名/包名/include1.jsp
${pageContext.request.contextPath}/inclde1.jsp
或者
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
${ctx}/inclde1.jsp
应该可以的哈 以前也是这样用的 没有问题呀
相关问答:
<%@ page contentType = "text/html;charset =gb2312"%>
<%!
public String codeToString(String str)
{
String s =str;
&nbs ......
<script language="javaScript">
function select()
{
document.selectpages.selectnum.value=document.selectpages.selectpage.value;
document.selectpages.submit();
}
&l ......
package tom.jiafei;
public class Student {
String name=null;
long number;
double weight,height;
public String getName() {
return name;
}
public void setName(Strin ......
我的网页是这个 http://127.0.0.1:8080/ch1/test.jsp
我要访问 www.126.com
显示结果为 http://127.0.0.1:8080/ch1/www.126.com#
JSP页面是这样写的,用了struts框架
<a href=" www.126.co ......