We are trying to follow the J2EE Blueprint model where all requests
first go to a Main.jsp which acts as a controller in the MVC pattern.
The Main.jsp calls a LookupBean to get the actual command bean that will
handle this request and the view JSP page that will be shown as a result
of this operation. However we are trying to figure out how to
generically set all the properties of the command bean. It looks
something like this:

Main.jsp
-------------------

<jsp:useBean id="lookup" class="package.LookupBean" scope="request" />

<!-- set the properties required by the lookup bean viz. Action,
Resource-->
<jsp:setProperty name="lookup" property="*" />


<%
        CommandBean command = lookup.getCommand();

        // We want to generically set all the propeties that Command bean needs
using the <jsp:setProperty> syntax.

        bean.action();
        req.setAttribute("command", command);
%>

<jsp:forward page="<%=lookup.getView()%>" />

--------------------

CommandBean is an interface that can be implemented by say
ShoppingCartCommandBean, AccountCommandBean, etc. The getCommand()
method of the LookupBean returns a specific type. However we want to
keep the Main.jsp generic enough and not have to do a setProperty() on
each known property of every command bean from the request object.

How do we generically set all the properties of the command bean using
the <jsp:setProperty property="*"> syntax with this approach?


Thanks in advance,

Anirban

Fujitsu Network Communications
[EMAIL PROTECTED]

--Network Management on the Web--

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to