JSP页面包含另一个动态的JSP

JSP页面包含另一个动态的JSP

最近在做一个springMVC开发模式的项目,遇到一个问题就是一个JSP页面包含了另一个动态的JSP,动态的JSP要在页面加载的同时访问Controller

解决方法:

A.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<jsp:include page='<%="navigation"%>'/>//在这里navigation是controller里要访问的RequestMapping
</body>
</html>

bController.java

@Controller
public class bController {
@RequestMapping(value = "/navigation")
public String B() {
//TODO Auto-generated catch block
return "B"; //在这里返回B.jsp
}
}

动态包含JSP页面的问题

02-21

两个非常简单的JSP页面:rnCategory_Guide.jsp:rnrnrn Category_Guide rnrnrnrnrn 基础理论rnrnrnrnrnrnshowcategory.jsp:rnrnrn Show Category rnrnrnrnrn rn rn showcategoryrnrnrnrnrn为什么编译不可以,错误如下rndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: /showcategory.jsp(10,1) Expected "param" tag with "name" and "value" attributesrn org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)rn org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)rn org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)rn org.apache.jasper.compiler.Parser.parseParam(Parser.java:892)rn org.apache.jasper.compiler.Parser.parseBody(Parser.java:1838)rn org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1100)rn org.apache.jasper.compiler.Parser.parseInclude(Parser.java:928)rn org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1251)rn org.apache.jasper.compiler.Parser.parseElements(Parser.java:1597)rn org.apache.jasper.compiler.Parser.parse(Parser.java:171)rn org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)rn org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)rn org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)rn org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)rn org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)rn org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rnrnrnnote The full stack trace of the root cause is available in the Tomcat logs.rnrn实际上如果showcategory包含别的页面也不好使,为什么呢,谢谢!rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试