如题, 后台是struts1 ,方法内以 setAttribute("page",page);
在前台用struts <bean name="page" property="pageNo" />可以取出来
而用${page.pageNo}却取不出来, 居然把这个表达式给打印到页面上了, form里也set get了,page内的pageNo也有set get始终没搞明白. 期望高手给解答 谢谢!

解决方案 »

  1.   

    打印表达式说明EL语法没起作用,不用找SET和GET了,去找找EL的相关资料
      

  2.   

    isELIgnored="false"页面属性加了这个不?
      

  3.   

    看看你的jsp页面是怎么使用el表达式的
      

  4.   


    <%@ page language="java" contentType="text/html; charset=GBK"%>
    <%@ taglib prefix="logic" uri="logic"%>
    <%@ taglib prefix="bean" uri="bean"%>
    <%@ taglib prefix="html" uri="html"%>
    <%@ page import="gmt.boss.dqCard.page.Page" %>
    <html><head><link href="<%=request.getContextPath()%>/common/css/site_style.css" rel="stylesheet" type="text/css">
    <script src="<%=request.getContextPath()%>/common/js/formCheck.js" type=""></script>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script src="<%=request.getContextPath()%>/common/js/popcalendar.js" type=""></script>
    <title>VIP用户信息查询</title>
    </head>
    <body>
    <form name="selHandleActionForm" method="post" action="">
    <table>
    <logic:present name="page" scope="request">
    <tr align="right">
    <td >


    <logic:greaterEqual name="page" property="pageNo" value="1">
    <a href="<%=request.getContextPath()%>/JYL.do?method=queryCard&card_page.pageNo=${page.pageNo-1}">上一页</a>
    <html:link page="/JYL.do?method=queryCard&card_page.pageNo=${page.pageNo+1}">上一页</html:link>
    </logic:greaterEqual>
    <logic:lessEqual name="page" property="pageNo" value="1">
    上一页
    </logic:lessEqual><A href="<%=request.getContextPath()%>/JYL.do?method=queryCard&card_page.pageNo=1">首页</A> 
    <A  href="<%=request.getContextPath()%>/JYL.do?method=queryCard&card_page.pageNo=${page-1}">前页</A> 
    <A  href="<%=request.getContextPath()%>/JYL.do?method=queryCard&card_page.pageNo=${page+1 }">下页</A>  &nbsp;&nbsp;
    当前第<bean:write name="page" property="pageNo" />页
    每页<bean:write name="page" property="pageSize" />条
    共<bean:write name="page" property="rowCount" />条
    共<bean:write name="page" property="pageCount" />页
    </td>
    </tr>
    </logic:present> </table></form>
    </body></html>
      

  5.   

    <%@ page language="java" contentType="text/html; charset=GBK"%>加isELIgnored="false"
      

  6.   

    楼主注意一下,Struts标签中非Struts-EL标签是不能使用EL表达式的。简单点儿说就是Struts标签不能使用EL表单式作为属性值,除了一些做过特殊处理的标签(称为Struts-el标签,这些标签名字和常用的Struts标签名字有些区别)。举个例子:
               //这个是不能使用EL表达式的Struts标签,即我们常用的
               <bean:message key='<%= stringvar %>'/>         //这个是能使用EL表达式的Struts-EL标签
              <bean-el:message key="${stringvar}"/>具体可见文档中的说明,希望对楼主有帮助。