【问题标题】:How to get form bean value in JSP in struts 1.x如何在struts 1.x中的JSP中获取表单bean值
【发布时间】:2014-04-09 02:36:45
【问题描述】:

我需要在struts 1.x的jsp中获取form bean的值

我正在尝试以下代码,但这无济于事。

<c:forEach begin="1" end='here I need that from bean value' var="i"  >
    <c:choose>
        <c:when test="${param.pageNumberInput eq i}">
            <td>
                <c:out value="${i}" />
            </td>
        </c:when>
        <c:otherwise>
            <td>
                <a href="#"><c:out value="${i}" /> </a>
            </td>
        </c:otherwise>
    </c:choose>
</c:forEach>

我可以使用以下标签获取表单 bean 值

但是当我这样尝试时它不起作用

<c:forEach begin="1" end='<bean:write name="formBeanName" property="propertyName" />'   var="i"  >
    <c:choose>
        <c:when test="${param.pageNumberInput eq i}">
            <td>
                <c:out value="${i}" />
            </td>
        </c:when>
        <c:otherwise>
            <td>
                <a href="#"><c:out value="${i}" /></a>
            </td>
        </c:otherwise>
    </c:choose>
</c:forEach>

请帮助如何获取此formBean 属性值。

【问题讨论】:

  • propertyName 有吸气剂吗?并且您是否添加了任何 bean 实例,其键为 formBeanName??

标签: java jsp struts-1


【解决方案1】:
end='${formBeanBame.propertyName}'

您不能在另一个 JSP 标记的属性中使用 JSP 标记。 JSP EL 是您访问 bean 属性所需的全部内容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多