javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Invalid property in <set>: "age2"

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

    <title>My JSP ‘index.jsp‘ starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
  </head>

  <body>
<%--   <!-- 静态获取 -->
    <c:out value="helloworld"></c:out>
 <!-- 动态获取 -->
 <%
 request.getSession().setAttribute("username", "lili");
  %>
 <c:out value="${3/2} "></c:out>
 <%
 String username="username";
 String username1="";
 request.setAttribute("username1", username1);
 //放进requestScope对象里,用EL表达式取
 request.setAttribute("username", username);
  %>
  <!-- false -->
  <c:out value="${empty username }"></c:out><br>
  <!-- true -->
  <c:out value="${empty username1 }"></c:out><br>
  <!-- true -->
  <c:out value="${empty user }"></c:out><br>
  <!-- 使用out标签输出常量 -->
  <c:out value="hello World"></c:out><br>
  <!-- 使用out标签输出变量 -->
  <%
  request.getSession().setAttribute("name", "li");
   %>
  <c:out value="${name }"></c:out><br>
  <!-- default属性的使用 -->
  <c:out value="${name1 }" default="error"></c:out><br>
  <!-- escapeXml="true属性设置是否转义,默认为true不转义-->
  <c:out value="&ltout标签&gt" escapeXml="false"></c:out>

  <!-- 表达式控制标签set标签,存值到scope中 -->
  <c:set value="today" var="day" scope="session"></c:set><br>
  <!-- 输出day,值应该是today -->
  <c:out value="${day }"></c:out>
  <!-- 表达式控制标签set标签,存值到scope中 -->
  <c:set  var="age" scope="application">eleven</c:set><br>
  <!-- 输出day,值应该是today -->
  <c:out value="${age }"></c:out>

  <!-- 存值到javabean中 -->
  <!-- 通过set向Person属性赋值 -->
  <!-- 赋值和输出都要用EL表达式 --> --%>
  <jsp:useBean id="person" class="com.imooc.entity.Person" ></jsp:useBean>
  <c:set target="${person}" property="age2"  value="12"></c:set>
<%--   <c:out value="${person[age2]}"></c:out> --%>
  </body>
</html>

  如果target="person",如下,会报如题异常!

<c:set target="person" property="age2"  value="12"></c:set>

正常写法如下:
<c:set target="${person}" property="age2"  value="12"></c:set>
时间: 2024-11-05 17:29:50

javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Invalid property in &lt;set&gt;: "age2"的相关文章

HTTP Status 500 - javax.servlet.ServletException: File [/head.jsp] not found

完整错误信息 type Exception report message javax.servlet.ServletException: File [/head.jsp] not found description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: javax.se

严重: Servlet.service() for servlet [jsp] threw exception java.lang.NullPointerException

五月 04, 2018 11:53:24 上午 org.apache.catalina.core.ApplicationDispatcher invoke 严重: Servlet.service() for servlet [jsp] threw exception java.lang.NullPointerException at org.apache.jsp.tag.web.partyRoleId_tag.doTag(partyRoleId_tag.java:125) at org.apac

使用Maven创建Web项目后,jsp引入静态文件提示报错。JSP 报错:javax.servlet.ServletException cannot be resolved to a type

使用Maven创建Web项目后,jsp引入静态文件提示报错. 错误提示:javax.servlet.ServletException cannot be resolved to a type 错误如下图: 解决方案: 在Maven的pom文件中引发如下依赖即可: <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <versio

Servlet.service() for Servlet jsp threw exception javax.servlet.ServletException:File &amp;quot;/pageFoo

1.错误描述 Servlet.service() for Servlet jsp threw exception javax.servlet.ServletException:File "/pageFoot.jsp "not found 2.错误原因 <jsp:include page="../../pageFoot.jsp"></jsp:include> 3.解决办法 利用<jsp:include></jsp:includ

tomcat6.0发布项目打开jsp页面报错:HTTP Status 500 - javax.servlet.ServletException

今天遇到一个tomcat的部署的问题,问题根源在于server.xml 的配置里. 错误如标题,说HTTP Status 500 - javax.servlet.ServletException:XXX文件找不到,几经查找测试,程序并没有错误,有人说是jsp-api.jar和serlet-api.jar包冲突,调试发现并不能解决问题,后来才发现问题的所在: 开始的server.xml 配置对Host 以及其内的Context 是如下配置的: <Host name="localhost&qu

[springMVC]javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean

问题描述: 页面使用标签<form:form>进行提交时,出现[springMVC]javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean异常. 原因分析: 渲染页面时,<form:form>标签有一个默认属性commandName,其值默认为”command".其实这个command就是对应controller中的javabean.但我的contr

HTTP Status 500 - javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTag

我在项目中导入了jar,还是不能使用EL表达式,一运行就出现了下面的额错误: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTag org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWra

javax.servlet.ServletException cannot be resolved to a type错误解决方法

在页面中使用全局路径时${pageContext.request.contextPath}出现javax.servlet.ServletException cannot be resolved to a type错误,解决方法如下: 这个错误主要是因为缺少jsp-api.jar 和  servlet-api.jar这两个Jar包. 第一种解决方法: 直接把 Tomcat7.0 下lib目录中的 jsp-api.jar 添加  Build path 中. 第二种解决方法:使用 Maven 将 js

javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation:

javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" th