A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© dongdong5982 高级黑马   /  2014-1-25 16:45  /  1516 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

刚开始学习Struts,在的Struts常用标签库时,有一个测试<bean:cookie>的例子,在MyEclipse里老是报错,不过在页面里却能正常运行,不知道是怎么回事,求高手解答。

所报的错误:

<bean:cookie>处:The TagExtraInfo class for "bean:cookie" (org.apache.struts.taglib.bean.CookieTei) could not be instantiated

mycookie处:mycookie cannot be resolved

为什么不能被实例化啊?


  1. <%@ page language="java" pageEncoding="GB18030"%>
  2. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
  3. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
  4. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
  5. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  7. <html:html lang="true">
  8. <head>
  9. <html:base />
  10. <title>bean_define.jsp</title>
  11. </head>
  12. <body>
  13.         <[b][u]bean:cookie[/u][/b] name="username" id="mycookie" value="MLDN"/>
  14.         <%
  15. [b][u]                mycookie[/u][/b].setMaxAge(3000);
  16.                 response.addCookie(mycookie);
  17.         %>
  18.         <% // 取得全部Cookie
  19.                 Cookie cookies[] = request.getCookies();
  20.                 for(int x = 0; x < cookies.length; x++) {
  21.         %>
  22.                         <h2><%=cookies[x].getName()%> --> <%=cookies[x].getValue()%></h2>
  23.         <%
  24.                 }
  25.         %>
  26. </body>
  27. </html:html>
复制代码




评分

参与人数 1技术分 +1 收起 理由
ily521125 + 1

查看全部评分

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马