c:if标签的问题

技术科 2008-08-01 03:01:25
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
<c:if test="${pageContext.request.method=='post'}">
<c:choose>
<c:when test="param.favor=='computer'">
Fav is <b>computer</b>
</c:when>
<c:otherwise>
Fav is <b>other</b>
</c:otherwise>
</c:choose>
</c:if>
<form method="post">
What?
<br>
<input type="text" name="favor">
<input type="submit" value="提交">
</form>
</body>
</html>

这段代码运行后,在文本框中输入任何值都没反应,红色部分提示:"Invalid character constant",请教如何解决?
...全文
541 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq707472 2008-08-04
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 youhere1 的回复:]
引用 2 楼 Landor2004 的回复:
<c:if test="${method=='post'}">


直接这样就行了,如果还是不行那也不会是jstl的问题。
[/Quote]
Landor2004 2008-08-03
  • 打赏
  • 举报
回复
jstl.jar放到你的classpath下了吗,tld文件放到web-inf下了吗,或者standard.jar放到classpath下了吗

可能是没认出来!
技术科 2008-08-02
  • 打赏
  • 举报
回复
还是不行,求解求解!
xwwelcome 2008-08-01
  • 打赏
  • 举报
回复
按照楼上说的调试一下应该没问题的
youhere1 2008-08-01
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 Landor2004 的回复:]
<c:if test="${method=='post'}">
[/Quote]

直接这样就行了,如果还是不行那也不会是jstl的问题。
seeSkyblue 2008-08-01
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 Landor2004 的回复:]
<c:if test="${method=='post'}">
[/Quote]

或者:<c:if test="${method eq 'post'}">
Landor2004 2008-08-01
  • 打赏
  • 举报
回复
<c:if test="${method=='post'}">

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧