David Newton wrote:
That aside, you're doing two different things: you're accessing the session in the JSP via an action property (which is fine, but a little weird). You're accessing the request via JSTL's normal implicit object. Whether or not you *should* be storing this data in the request or session is debatable--personally it seems like it belongs in either the application scope or in no scope at all and should be exposed via an action property.
Note also that it's *much* cleaner to implement RequestAware to get the request's attribute maps, and has the benefit of not tying your action to the servlet spec.
Lastly, without knowing the result type it's hard to say--I would have thought a standard "dispatcher" result type would have worked.
i Tried to implement the RequestAware interface but i still can not access the request attributes from the jsp page while i can access the object if i store it in the session
here is the entire code:
and here is the jsp page.
<c:forEach var="product" items="${request.catalog}" >
Product: ${product.productID}
Description: ${product.description}
Quantity available: ${product.quantity}
Unit Price: ${product.unitPrice}
<s:form method="POST">
<s:textfield name="quantity" size="3"></s:textfield>
<s:submit value="add to cart"></s:submit>
</s:form>
</c:forEach>
the following page does not display anything.
but if i used <c:forEach var="product" items="${session.catalog}" >
the data is displayed correctly.
any idea why?
Thanks