jsp页面使用表达式跳转报错:
index.jsp
<body> <jsp:forward page="<%=basePath%>/json" /> </body>
错误信息:
org.apache.jasper.JasperException: /index.jsp(24,26) attribute for %>" is not properly terminated org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
正确写法:
<body> <!-- json是servlet url --> <jsp:forward page="${basePath}/json" /> <jsp:forward page="/json" /> </body>
原因:
<jsp:include>标签是允许包含动态和静态页面,其中page属性:
page="{relativeURL | <%= expression %>}"
可以使用绝对路径或相对路径,差别就是绝对路径不以"/"开头,而相对路径是以"/"开头,"/"则代表了项目的路径(到WebRoot根路径下)。
还有<%=path %>其中的path所指的路径末尾没有"/",所以你的路径改为
<jsp:include flush="true" page="<%=path%>/SessLoginServlet"></jsp:include>应该就可以了
=================================================================
<jsp:include page="<%=uri %>/include.jsp"></jsp:include>
报错:attribute for %>" is not properly terminated
原因:标签的page属性值可以是相对路径URL或者<%=表达式 %>,但同时只能存在其中一种
<jsp:include page="/frame/include.jsp"></jsp:include> 表示绝对路径
<jsp:include page="frame/include.jsp"></jsp:include> 表示相对路径
<jsp:include page="<%=uri %>"></jsp:include> 两个引号与<%=uri %>之间不能有空格
===============================================================
<jsp:include page="<%=uri %>/include.jsp"></jsp:include>
报错:attribute for %>" is not properly terminated
原因:标签的page属性值可以是相对路径URL或者<%=表达式 %>,但同时只能存在其中一种
<jsp:include page="/frame/include.jsp"></jsp:include> 表示绝对路径
<jsp:include page="frame/include.jsp"></jsp:include> 表示相对路径
<jsp:include page="<%=uri %>"></jsp:include> 两个引号与<%=uri %>之间不能有空格
相关推荐
python3 server.py 127.0.0.1 8888 ...AttributeError: module ‘os’ has no attribute ‘exit’ 部分代码入下: from socket import * import sys,os #实现登录 def do_login(s,user,name,addr): for i in user: i
问题描述及解决: 原创文章 1获赞 1访问量 17 关注 私信 展开阅读全文 作者:Branson233
ShowFor允许您使用I18n功能快速显示模型信息。 <%= show_for @user do |u| %> <%= u.attribute :name %> <%= u.attribute :nickname, in: :profile %> <%= u.attribute :confirmed...
- **jsp:param**:`<jsp:param name="name" value="value" />`,与jsp:include一起使用,为被包含的页面传递参数。 - 其他动作元素,如jsp:forward、jsp:useBean、jsp:setProperty等,用于实现更复杂的功能,如转发...
主要介绍了解决python多线程报错:AttributeError: Can't pickle local object问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
ShowFor ShowFor允许您快速显示具有I18n功能的模型信息。 <%= show_for @user做| u | %> <%= u.attribute:name%> <%= u.attribute:nickname,:in =>:profile%> <%= u.att ShowFor ShowFor...
- **语法**:`<%@ page attribute="value" %>` - **作用**:定义整个JSP页面的行为特征,如设置页面编码、错误处理页面等。 - **示例**: ```jsp <%@ page contentType="text/html;charset=UTF-8" language=...
声明用于在JSP页面中定义变量和方法,这些变量和方法可以在整个JSP页面中使用。 **JSP语法**: ```jsp <%! declaration; [declaration;]+ %> ``` **示例**: ```jsp <%! int i = 0; %> <%! String message = "Hello ...
报错信息: Traceback (most recent call last): File “D:/flaskProject/test.py”, line 35, in test pool.apply(self.out, args=(i,)) File “Python37-32\lib\multiprocessing\pool.py”, line 261, in apply ...
使用`ShowFor`时,首先需要在你的Gemfile中添加依赖: ```ruby gem 'show_for' ``` 然后运行`bundle install`安装。接下来,在视图文件中,你可以使用`show_for`辅助方法来展示模型信息: ```erb <%= show_for @...
### JSP_cheatsheet jsp 小抄 #### 概述 JSP(JavaServer Pages)是一种基于Java的服务器端技术,用于创建动态网页。它将静态内容与动态内容混合在一起,通过内置的对象处理用户输入并产生响应。JSP_cheatsheet是一...
1. **page指令**: `<%@ page attribute="value" %>`, 设置页面级属性,如字符集、导入包等。 2. **include指令**: `<%@ include file="filename" %>`, 动态或静态地将另一个文件包含进来。 3. **taglib指令**: `<%@ ...
- **页面片段(Fragment)**:通过`<jsp:include>`和`<jsp:attribute>`,可以创建可重用的页面部分。 ### 9. JSP与Servlet的关系 JSP最终会被编译为Servlet,因此理解Servlet的基础对掌握JSP至关重要。Servlet负责...
需要注意的是,`isErrorPage` 属性被设置为 `true`,这表明该 JSP 页面可以作为错误处理页面使用。 #### 2. `error.jsp` 示例 ```jsp <%@ page language="java" contentType="text/html; charset=GBK" isErrorPage...
- `<xsl:attribute name="...">...</xsl:attribute>` - **属性**: - `name`:必需属性,指定要创建的属性名称。 - **示例**: - 创建一个带有 `id` 属性的元素: ```xml <xsl:template match="node"> <div> ...
### JSP应用指南知识点概述 #### 一、JSP语法 **1. 注释** 在JSP中,注释主要用于添加代码说明或暂时屏蔽代码片段。JSP支持两种类型的注释: - **HTML注释**: `<!--comment-->`,这种注释在服务器端会被忽略,但...
### JSP (JavaServer Pages) 语法卡片知识点详解 #### 一、概述 JSP(JavaServer Pages)是一种用于创建动态网页的技术标准,它结合了HTML、XML与Java语言的功能,使得开发人员能够轻松地创建功能强大的Web应用...
xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd...
/>`,包括`<jsp:include>`用于动态包含页面,`<jsp:forward>`用于转发请求到其他页面。 在实际开发中,了解和熟练运用这些概念和语法是Java Web开发者必备的基础知识。通过深入理解JSP的工作机制和各种元素的用法...