views:

135

answers:

1

I have a generic buttons jsp:

<wow:button id="addButton" iconClass="add16 icon16x16"
            action="#{managedbean.addNew}" type="submit" immediate="true"
            value="#{lblMsg.label_add }" />

<wow:button id="deleteButton" iconClass="iconCancel"
            action="#{managedbean.delete}" type="submit"
            value="#{lblMsg.label_delete }" />

This gets included in another jsp page via

<wow:outputText value="#{locationBean.disclaimer}"></wow:outputText> <br />
<jsp:include page="buttons.jsp">

This page has a managed bean instance used by the EL expression. I want to pass this instance of locationBean to buttons.jsp. One way is setting a param value in jsp:include to the bean name and using requestScope[beanName] in buttons.jsp.

Is there a better way?

Edit: wow is our own JSF component library.

+1  A: 

Using the legacy JSP, I don't think there are semantically better ways. Your approach might however break if you change the scope of the bean. Another way may be to use JSTL c:set instead.

<c:set var="currentBean" value="#{locationBean}" scope="request" />
<jsp:include page="buttons.jsp" />

with

<h:commandButton action="#{currentBean.action}" />

But this might clash with another beans which have by coincidence the same name.

BalusC
I'll try this out tomorrow and post the answer. Thanks!
Rohit