Hi

Struts provides us with a nice MVC architecture, where:
- a user's click maps to an Action
- based on the results, the user is forwarded to the view

Now, I have a template.jsp which all pages will use. The template will
contain some views that are common to all pages, eg:
- Latest News
- Site visits
- Member count

To retrieve these information, it gets them from the database. However,
there is no user click to invoke the action. This is where the limitation of
Struts comes in. Let me explain:

In the template.jsp, we can have:

<template:insert template="news.jsp"/>

In news.jsp we can access the database and retrieve the news for display.
This breaks the MVC pattern, since the view is accessing the model.
Alternatively, we have have this in the template.jsp:

<template:insert template="news.do"/>

This will call the NewsAction which accesses the database, and forwards the
results to the news.jsp for display.

This is a great concept, but it does not work. Struts does not allow
multiple forwards (this happens when the current page is already a .do).
Here's an example:
(1) User clicks on viewUserDetail.do
(2) ViewDetialAction forwards to user.jsp
(3) In template.jsp (used by user.jsp), news.do invokes NewsAction, and it
forwards to news.jsp

This is a double forward, which results in an exception.

Basically, I want to call

<template:insert template="news.do"/>

in the JSP. Has anyone done something like this?

Keith


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to