Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 27034 invoked from network); 26 Aug 2007 16:02:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Aug 2007 16:02:06 -0000 Received: (qmail 72040 invoked by uid 500); 26 Aug 2007 16:01:51 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 72020 invoked by uid 500); 26 Aug 2007 16:01:51 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 72009 invoked by uid 99); 26 Aug 2007 16:01:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Aug 2007 09:01:50 -0700 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.191.72.59] (HELO web80506.mail.mud.yahoo.com) (209.191.72.59) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 26 Aug 2007 16:01:42 +0000 Received: (qmail 30886 invoked by uid 60001); 26 Aug 2007 16:01:14 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=masq66j3dVrq3+ixFExFvUs/FGttLbPJ5r33uOAySQe1DvbSqF0SJ36LBJXDS89MiXU2TlyGPuVuMWtr071ttQEFVu5PS5ckPIxQW8pFTHCjJ0tpIWqkYB+AJYCoLK8nhKm/cRjP/BCwlmy5CXqDT8cUsM58zmTyXSwN3CS9kNI=; X-YMail-OSG: .YDjupcVM1njzby5tDLy4sQ5fmfk1hlyincx4fzSG.ebpjr9LDXNs2Xu2.hzOhJ_oIvuO0kgd7mqlh3OnRMh_5lyIM8SP73GjhKfXu4j9nU2E7fbca6mQLpN8Ot1Lg-- Received: from [71.158.190.150] by web80506.mail.mud.yahoo.com via HTTP; Sun, 26 Aug 2007 09:01:14 PDT X-Mailer: YahooMailRC/651.48 YahooMailWebService/0.7.119 Date: Sun, 26 Aug 2007 09:01:14 -0700 (PDT) From: Darryl Thompson Subject: Re: Struts1/Tiles and Struts2/tiles in same app To: Struts Users Mailing List MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1550567518-1188144074=:29166" Message-ID: <161609.29166.qm@web80506.mail.mud.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org --0-1550567518-1188144074=:29166 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Ray,=0A=0AI followed your instructions and now I am getting this exception = on startup:=0Ajava.lang.ClassNotFoundException: org.apache.myfaces.webapp.S= tartupServletContextListener=0A=0AI don't have the struts-jsf plugin jar in= my web-inf and I removed the myfaces jar files. I did a search of the file= directory for the webapp and could not find any references to "myfaces" ye= t I still get the same failure on startup. Here is my web.xml file:=0A=0A=0A=0A=0A strutsNotes=0A =0A =0A org.apache.tiles.impl.BasicTilesContainer.DEFI= NITIONS_CONFIG=0A =0A /WEB-INF/config/t= iles-def-struts1.xml,=0A /WEB-INF/config/tiles-def-struts2.xml=0A <= /param-value>=0A =0A=0A =0A con= textConfigLocation=0A /WEB-INF/applicationContex= t.xml=0A =0A =0A openSe= ssionInViewFilter=0A org.springframework.orm.h= ibernate3.support.OpenSessionInViewFilter=0A =0A =0A filterDispatcher=0A or= g.apache.struts2.dispatcher.FilterDispatcher=0A =0A= =0A openSessionInViewFilter=0A= /*=0A =0A =0A= filterDispatcher=0A *.action=0A =0A=0A =0A org.sp= ringframework.web.context.ContextLoaderListener=0A =0A =0A =0A org.apache.tiles.web.startup.TilesListener=0A = =0A=0A =0A =0A action=0A org.apache.struts.action.ActionSe= rvlet=0A =0A config= =0A /WEB-INF/struts-config.xml=0A =0A 1=0A =0A =0A = Tiles Dispatch Servlet=0A org.= apache.tiles.web.TilesDispatchServlet=0A =0A =0A =0A action=0A *.do=0A =0A = =0A Tiles Dispatch Servlet= =0A *.tiles=0A =0A =0A =0A index.j= sp=0A =0A =0A java.lang.Exception=0A /WEB-INF/jsp/Error.js= p=0A =0A =0A /WEB-INF/struts-b= ean=0A /WEB-INF/struts-bean.tld=0A =0A =0A /WEB-INF/struts-logic=0A /WEB-INF/struts-logic.tld=0A = =0A =0A /WEB-INF/struts-html=0A = /WEB-INF/struts-html.tld=0A = =0A =0A /WEB-INF/struts-tiles=0A /WEB-INF/struts-tiles.tld=0A =0A =0A /WEB-INF/c=0A /WEB-INF/c= .tld=0A =0A =0A BASI= C=0A =0A=0A=0A=0A----- Original Mess= age ----=0AFrom: Ray Clough =0ATo: user@struts.apach= e.org=0ASent: Sunday, August 26, 2007 5:44:08 AM=0ASubject: Re: Struts1/Til= es and Struts2/tiles in same app=0A=0A=0AMy previous post failed, presumabl= y the attachment was blocked. Here is the=0Acontents of the document I cre= ated to define the process of using Tiles-2 as=0Aa standalone service with = Struts-1 and Struts-2. Sorry if it is long, but I=0Acouldn't get the attac= hment to work. If you ask, I will send the pdf to=0Aanyone who wants it.= =0A=0A-Ray Clough=0Aray@allthisisthat.com=0A=0AUsing Tiles-2 as a Standalon= e Service, Including Deployment with Struts-1=0Aand Struts-2.=0A=0AThis doc= ument describes using Tiles-2 (T2) in a Java Web Application based=0Aon Apa= che Struts-1 (S1) with Apache Struts-2 (S2). The classical way of=0Ausing T= iles-1 with S1 involved using a Plugin. The typical way of using T2=0Awith = S2 uses a Struts2-Tiles2 plugin module. These instructions do not use=0Aany= plugins with either S1 or S2. The Tiles processor is installed as an=0Aind= ependent service, exactly as it would be in a non-Struts environment.=0ANot= e that this document describes a basic Tiles installation, and there are=0A= advanced features available, but these are not covered in this document.=0A= If you are migrating an existing application, it is recommended that the=0A= migration be attempted in the smallest possible steps. This way, when a=0Af= ailure occurs, it will logically be attributable to the last step invoked.= =0AOf course, this is true of any significant feature migration of an exist= ing=0Aapplication.=0AFinally, note that these instructions are for the late= st released version of=0ATiles-2 at the time of this writing: viz. Tiles-2.= 0.4. It is expected that=0Achanges with future releases will not be big, bu= t there may be changes which=0Awill affect these instructions.=0A1. Requisi= tes: These files must be in the WEB-INF/lib directory:=0A=95=0ATiles-2 Dist= ribution jar files: tiles-core-2.0.4.jar, tiles-api-2.0.4.jar,=0Atiles-jsp-= 2.0.4.jar=0A=95=0ACommons Logging v1.1 or better: commons-logging-1.1.jar= =0A=95=0ACommons Digester v1.8 or better: commons-digester-1.8.jar=0A=95=0A= Commons BeanUtils v1.7 or better: commons-beanutils-1.7.0.jar=0A2.=0AThe Ti= les processor must be activated when the servlet container starts up.=0AAs = described in the Tiles-2 Tutorial, at=0Ahttp://tiles.apache.org/tutorial/co= nfiguration.html , there are 3=0Aalternative ways of doing this: (a) a Star= tup Servlet, (b) a Startup=0AListener, or (c) a Startup Filter. Each of the= se requires additions to the=0Aweb.xml web-app deployment descriptor. Using= method (b) requires this=0Aaddition to web.xml:=0A=0A=0A=0Aorg.apache.tiles.web.startup.Ti= lesListener=0A=0A=0AThis method also requires a= n entry in the section of the=0Aweb.xml file to tell Tiles = what the names of the Tiles definitions files=0Aare:=0A=0A=0A=0Aorg.apache.tiles.impl.Bas= icTilesContainer.DEFINITIONS_CONFIG=0A=0A=0A/WEB-= INF/config/tiles_part1.xml,=0A/WEB-INF/config/tiles_part2.xml=0A=0A=0A=0A3. In web.xml, add a reference to the Tiles Dis= patch Servlet, and map it to=0A"*.tiles". The Tiles DispatchServlet is resp= onsible for processing all url=92s=0Aending in =93.tiles=94 to the Tiles Pr= ocessor:=0A Tiles Dispatch Servlet=0A= org.apache.tiles.web.TilesDispatchServlet = =0A3=0A Tiles Dispatch=0AServlet *.tiles =0A=0A4. Migrating S1 portion of the app:=0A=95= =0Aremove the Struts-1 plugin from the WEB-INF/lib directory, depending on = the=0AS1 version, delete the file 'struts-tiles-1.3.8.jar'.=0A=95=0AThere w= as a difference between the way Tiles was deployed in Struts-1.2 and=0Aearl= ier and Struts-1.3.=0A=95=0AStruts 1-2 and earlier:=0A=95=0AIn struts-confi= g.xml, remove the element which deployed Tiles-1.=0AThat element l= ooked like this:=0A=0A=0A=0A=0A=0A=95=0AIn struts-config.xml, use the normal St= ruts RequestProcessor, not the=0ATilesResultsProcessor. That element previo= usly looked like this:=0A=0A=95=0AStruts= 1.3:=0A=95=0AIt is possible to deploy tiles in Struts 1.3 apps just like u= nder 1.2 and=0Aearlier. In this case, the upgrade path is identical. Struts= 1.3 introduced=0Athe =93Composable Request Processor which gives some othe= r options for=0Adeploying Tiles. Whatever Struts features are used to deplo= y Tiles, remove=0Athem from the struts-config.xml file.=0A5 In Struts-2, th= e usual way of deploying Tiles places the file=0A=93struts2-tiles-plugin-2.= 0.9.jar=94 into the WEB-INF/lib directory. This takes=0Aadvantage of the St= ruts-2 plugin architecture. It is also necessary to place=0Asome elements i= nto the web.xml file to start the Tiles-2 processor. This is=0Avery similar= to the deployment of the TilesListener described in step 2=0Aabove, but wi= th a different class path for the Listener component. Once this=0Afile is p= laced into the application, the Struts-2 actions defined in the=0Aconfigura= tion file =93struts.xml=94 need to have access to Tiles resources, and=0Ath= e easiest way to do that is to have your packages extend =93tiles-default= =94,=0Aor otherwise have access to the Tiles =93result=94 type and intercep= tor.=0A6 It is perfectly possible for Struts-1 to use the stand-alone Tiles= -2 and=0Afor Struts-2 to simultaneously use Tiles-2 deployed using the stan= dard=0Amethod described in Step-4 above, and covered in detail on the Strut= s-2 web=0Asite. However, there are reasons for not using the Struts-2 plugi= n, and=0Ausing Tiles-2 standalone with Struts-2. One of the main reasons fo= r this is=0Athat the standard deployment requires adding an attribute to th= e S2 actions,=0A=91type=3D=94result=94=92. If you want to use some other re= sult type, you won=92t be=0Aable to, because there is only one =91result=92= for an action. Also, to=0Aeliminate intermediate layers (ie the plugin) in= troduces fewer sources of=0Abugs into your app, and fewer dependencies (the= plugin, and S2 doesn=92t=0Aalways release with the latest Tiles-2 version)= .=0ATo remove the S2 plugin architecture requires only removing the=0Astrut= s2-tiles-plugin-xxxxx.jar file, removing the extension of the=0A=91tiles-de= fault=92 package by your packages, and not including the result type=0Aattr= ibute. Be sure that you use the TilesListener specified in Step-2, not=0Ath= e one which comes with Struts-2. Using the Plugin architecture results in= =0Aa S2 action definition like this:=0A=0A= =0A=0AWELCOME=0A=0A...=0AFor S2 with standalone Tiles-2, this becomes:=0A=0A=0A/WELCOME.tiles= =0A=0A...=0ANote that the forward page is now preceded by a slash = (=93/=94) and has =93.tiles=94=0Aon the end. This is because the Tiles Disp= atchServlet is mapped to *.tiles.=0AThe *.tiles mapping is default, and may= be configurable, but that=0Afunctionality was missing from a recent releas= e.=0A=0A7. Now that you have Tiles-2 set up in the app, whether you are usi= ng=0AStruts-1, Struts-2, a combination, or are not using Struts at all, you= need=0Ato create the JSP template files, the tiles definition xml file, an= d the jsp=0Apages. Be sure to note that the tiles.xml file (or whatever you= name it)=0Amust use the Tiles-2 DTD, which is different from the Tiles-1 D= TD, and the=0AJSP pages must use the correct namespace for Tiles-2.=0AFollo= wing are several files used in the deployment of a small demo app which=0Au= ses S1, S2, and Tiles-2 as a standalone service.=0AHere is =93web.xml=94=0A= =0A=0AG= reetings Earth=0A=0ADemonstrator for Struts-2 w= ith Struts-1 and Tiles=0A=0A=0A=0A=0A=0Aorg.apache.tiles.impl.BasicTilesContainer.DEFIN= ITIONS_CONFIG=0A=0A/WEB-INF/tiles.xml=0A=0A=0A=0Astruts2=0A=0Aorg.apache.struts2.dispatcher.Fi= lterDispatcher=0A=0A=0A=0Astruts2=0A/*=0A=0A=0A=0A=0Aorg.spr= ingframework.web.context.ContextLoaderListener=0A=0A=0A=0A=0Aorg.apache.tiles.web.startup.TilesL= istener=0A=0A=0A=0A=0ATiles Dispatc= h Servlet=0A=0Aorg.apache.tiles.web.util.Tile= sDispatchServlet=0A=0A3= =0A=0A=0A=0Aaction=0A*.do= =0A=0A=0A=0ATiles Dispatch Servl= et=0A*.tiles=0A= =0A=0A= =0Ahtml/index.html=0A=0A=0A30= =0A=0A=0A=0Ad= efines *.jspx as a JSP file=0A*.jspx=0Atrue=0A=0A=0A=0AHere is the Struts-2 deployment file, =91struts.xml=94=0A=0A=0A=0A=0A= =0A/WELCOME.tiles=0A=0A=0A /THREATEN.tiles =0A=0A=0A /WEATHER.tiles =0A=0A=0A=0A /NEWSLETTER.tiles = =0A /THANKS.tiles =0A= =0A=0A /HIGH_COMMANDER.tiles =0A=0A=0A /AJAX_DEMO.tiles =0A=0A=0A /POPUP_DEMO.tiles =0A=0A=0A /jsp/HedgeHog.jspx =0A=0A=0A=0AHere is the Tiles definition file, defined ab= ove to be =93tiles.xml=94. Note the=0ATiles-2 DTD. Also note that the tags = are somewhat different from Tiles-1:=0A=0A=0A=0A= =0A=0A=0A=0A=0A= =0A=0A=0A=0A=0A=0A= =0A=0A=0A=0A= =0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A= =0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A= =0A=0A=0A=0A=0A=0AAnd here is the =93template=94 jspx file. Note that this= is in =93JSP Document=94=0Afile and is an xhtml document, and so is named = =93.jspx=94, not =93jsp=94. Also note=0Athe tiles taglib uri, which is diff= erent from Tiles-1=0A=0A=0A=0A=0AString basePath =3D request.getScheme()=0A+ "://"= =0A+ request.getServerName()=0A+ ":"=0A+ request.getServerPort()=0A+ reques= t.getContextPath();=0ApageContext.setAttribute("BasePath",basePath);=0A=0A=0A=0A= =0A=0A<tiles:insertAttribute name=3D"tit= le" />=0A=0A=0A=0A=0A=0A=0A=0A= =0A=0A=0A=0A=0A=0A=0A=0A= =0A=0A=0A=0A=0A=0A
=0A
=0A=0A
=0A
=0A=0A=0A=0A
=0A=0A=0A
=0A=0A
=0A= =0A=0A=0A=0A=0A=0A=0A=0A=0A-- =0AView this message in con= text: http://www.nabble.com/Struts1-Tiles-and-Struts2-tiles-in-same-app-tf4= 329675.html#a12333794=0ASent from the Struts - User mailing list archive at= Nabble.com.=0A=0A=0A------------------------------------------------------= ---------------=0ATo unsubscribe, e-mail: user-unsubscribe@struts.apache.or= g=0AFor additional commands, e-mail: user-help@struts.apache.org=0A=0A=0A= =0A=0A=0A --0-1550567518-1188144074=:29166--