Hi Matt Yes, that's exactly what I want. In fact, I have the same code that you have given below.
But Struts does not allow it. It complains that the request is already commited and cannot forward twice. Can someone try this out for me please? Maybe I have missed out something... If this can be achieved, it'll be so easy to mix and match your Actions, put them as links in a page or in the template. Keith -----Original Message----- From: Matt Read [mailto:[EMAIL PROTECTED]] Sent: Thursday, 7 March 2002 12:12 p.m. To: Struts Users Mailing List Subject: RE: design flaw if using a template... My apologies if I'm misunderstanding your point but if you're concerned that the elements that you "put" into your template are not going through the an xxxAction then why not put the URL for the action in instead of a .jsp? This way your ShowNewsAction is following the same flow as any other content. E.g. <template:insert template="/WEB-INF/templates/myTemplate.jsp"> <template:put name="newspanel" content="/news/shownews.do" /> <template:put name="content"> ... some html </template:put> </template:insert> Matt. -----Original Message----- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: 06 March 2002 23:02 To: Struts Users Mailing List Subject: RE: design flaw if using a template... Hi Ross Good comments. You see, with custom tags, there are several problems: - For each different parts of the template, I need to create a custom tag - This custom tag is actually what an xxxAction class is meant to do, ie retrieve data from a database and prepare the data for view - If I later decide not to put news in the template and put it in a separete page, I need to port the taglib code to an xxxAction class. Not very flexible. - taglibs from Struts point of view, only renders data for viewing. It should not be performing model work, which should really be in the xxxAction class. So, I can see that Struts was designed to handle "user invoked" actions, not "code invoked" actions. Any more thoughts? Keith -----Original Message----- From: Ross MacCharles [mailto:[EMAIL PROTECTED]] Sent: Thursday, 7 March 2002 11:14 a.m. To: 'Struts Users Mailing List' Subject: RE: design flaw if using a template... Consider rethinking the philosophy that all data rendered in the JSP must come from an ActionForm. In my mind the ActionForm generally represents the editable data for the page displayed to the user. There's no problem with displaying data from other sources on the same page - especially read only data. For news I would simply use a custom tag to get it and display it. Put another way, I wouldn't want to have to set up a bean with "setNews" and "setMemberCount" when I have no intention of allowing my application to edit those values. /Ross -----Original Message----- From: Keith Chew [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 4:28 PM To: Struts Users Mailing List Subject: design flaw if using a template... 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]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

