Re: Nested tab layouts possible?
You can nest tab layout, but you need to modify the tabsLayout.jsp to take into account the several tabs layout. Try and adapt the nestedTabsLayout.jsp located in tiles-documentation.war under layouts. Hope this help, Cedric [EMAIL PROTECTED] wrote: Has anyone been able to get nested tabs working using tiles? I have a tile that uses a tab layout. Within the first tab is another tile that also has a tab layout. So within tab A, I want to see sub-tabs 1 and 2. tiles-defs.xml: definition name=tabslayout.default path=/jsp/layouts/tabslayout.jsp put name=selectedIndex value=0 / put name=parameterName value=selected / putList name=tabList item value=Tab A link=/jsp/tabA.jsp / item value=Tab B link=/jsp/tabB.jsp / /putList /definition definition name=tabslayout.nested path=/jsp/layouts/tabslayout.jsp put name=selectedIndex value=0 / put name=parameterName value=selected / putList name=tabList item value=Subtab 1 link=/jsp/tab1.jap / item value=Subtab 2 link=/jsp/tab2.jap / /putList /definition Main JSP: tiles:insert definition=tabslayout.default flush=true / Tab A JSP: tiles:insert definition=tabslayout.nested flush=true / At runtime, the indexing of tabs doesn't work properly. If I click on sub-tab 2, it takes me to major tab B. There seems to be no way of selecting a subtab index within a main tab index. Anyone know if there a way to nest these things? Or a better approach? Any help appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [tiles] ComponentContext returning null
The ComponentContext exist only if you are in a tile. You are in a tile if you insert your jsp or action with one of the tile 'insert' mechanism: tiles:insert .. or a forward to a tile definition. Otherwise, the ComponentContext doesn't exist. Hope this help, Cedric William Salvucci wrote: Can anybody explain how the component context is set? From within an Action when I call ComponentContext context = ComponentContext.getContext( request ); context is always null. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [tiles] programatically putting a definition into a layout
Hi, There is an example on how to retrieve the tile context in org.apache.struts.webapp.tiles.test.TestActionTileAction. A tile context is created each time a tile is inserted. The tile context is hold in a ComponentContext object. Hope this help, Cedric William Salvucci wrote: tiles context? How do I get that? The logon.jsp has a struts html:form attribute that is associated to the action class. [EMAIL PROTECTED] 06/23/03 06:05AM William Salvucci wrote: with the following tiles-def, I can forward to layout.main and everything is fine: definition name=layout.main path=/layoutMain.jsp put name=header value=header.jsp / put name=app value=layout.app / put name=footer value=footer.jsp / /definition definition name=layout.app path=/layoutApp.jsp put name=mainMenu value=menu.main / put name=subMenu value=subMenu.jsp / put name=body value=welcome.jsp / /definition !-- Menu bar definition -- definition name=menu.main path=/menu.jsp putList name=items add value=Item 1 / add value=Item 2 / add value=Item 3 / /putList /definition I then modify the tiles-def so that in layout.main app = logon.jsp where logon.jsp submit is associated with a struts action. In the struts action I set the layout.main app = layout.app ComponentDefinition layout = TilesUtil.getDefinition(layout.main, request, this.servlet.getServletContext()); layout.put(app, layout.app); It is not recommended to change a definition dynamically, unless you know very well what you do. A definition content is shared by all the website. Changing the content will be reflected to all user of the definition. If you want to change a definition attribute for the current tiles, you should do so in the tile context, which hold a temporary copy of the definition. and forward to layout.main. So basically after the action everything should be the same as my original setup. However, I get the following error on the forward Jun 20, 2003 1:16:00 PM EDT Error HTTP Included resource or file /netl-c ommons/layout.app not found from requested resource /netl-commons/layoutMain.j sp. The layout.app name has been interpreted as an URL. It appear that the Tiles mechanism hasn't catch it. I don't see how you call the action from the logon.jsp page. Cedric layoutMain.jsp is not changed during my update and looks like TABLE border=1 TRTD COLSPAN=2tiles:insert attribute=header//TD/TR TRTD COLSPAN=2tiles:insert attribute=app / /TD/TR TRTD COLSPAN=2tiles:insert attribute=footer//TD/TR /TABLE Any idea why layoutMain.jsp could load layout.app in the original, but can't when I programatically put it into layout.main? I noticed that the put method doesn't have type as an argument for specifying string, page, definition, so I hope that isn't it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A tiles controller is called for an unrelated tiles defintion.
The log indicate that your .login definition is called by a way or another. It is hard to say why without knowledge of the workflow of your application. Is your /greeting action called when you hit a page issuing the log ? Cedric Rick Smith wrote: Have you tried to remove the associated controller from your login definition ? When I remove the controller from the .login definition everything works as expected. Also if I move the controller from the .login definition to a different tiles definition, the controller is not called multiple times. Where do you get or insert your login definition ? The .login definiton is retrieved via an ActionForward, I don't explicitly 'get' or 'insert' it from within a JSP. action=/greetings forward=.login/ Rick The attached file shows the template JSP used in the tiles .baseLayout definition that all other definitions extend; it also includes a sample of a 'content' tile that gets substituted for each definition. I control the navigation to the various pages by using tiles definitions as ActionForwards. I hope that the above is acceptable tiles practice. Rick - My BaseLayout.jsp %-- /** This is a page layout that provides for a header area, a navigational bar, a context menu, a content area and a footer area. * Does NOT open the BODY tag. * This allows header tiles to set body-tag attributes. * Does close the BODY tag. * Exports attributes to request so that they can be used by any sub-tile. * Expects app.title to be defined in the application resources * as name of the application. * */ --% %@ page language=java % %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/tiles prefix=tiles % tiles:importAttribute scope=request/ html:html tiles:get name=header / tiles:get name=banner / tiles:get name=navigationBar / table border=0 cellpadding=0 cellspacing=2 width=740 summary=Page Content tr td valign=top width=155 br logic:present name=contextMenu table border=0 cellpadding=0 cellspacing=0 width=155 summary=Secondary Navigation tiles:get name=contextMenu / /table /logic:present /td td valign=top width=3img src=bean:message key=images.commonURL//spacer.gif height=1 width=3 alt= /td td valign=top bgcolor=#cdcdcd width=1img src=bean:message key=images.commonURL//spacer.gif height=1 width=1 alt= /td td valign=top width=5img src=bean:message key=images.commonURL//spacer.gif height=1 width=5 alt= /td td valign=top width=530tiles:get name=content / /td td valign=top width=7img src=bean:message key=images.commonURL//spacer.gif height=1 width=7 alt= /td td valign=top bgcolor=#cdcdcd width=1img src=bean:message key=images.commonURL//spacer.gif height=1 width=1 alt= /td td valign=top width=7img src=bean:message key=images.commonURL//spacer.gif height=1 width=7 alt= /td /tr /table tiles:get name=footer / /body /html:html VV --- a sample content tile %-- /** This renders the content of the welcome text for Type1 users */ --% %@ page language=java import=util.Constants% %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-logic prefix=logic % table border=0 cellpadding=0 cellspacing=2 width=740 summary=Page Content tr td valign=top class=contenttext p img src=bean:message key=images.commonURL//main_title_company.gif width=367 height=21 border=0 alt=My Systembr br logic:present name=%=Constants.USER % bWecolmenbspbean:write name=%=Constants.USER % property=firstName//b, /logic:present logic:notPresent name=%=Constants.USER % bWelcome Type 1 user/b,/p /logic:notPresent pbean:message key=welcome.type1user/br /p /td /tr /table - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A tiles controller is called for an unrelated tiles defintion.
Rick Smith wrote: Normally, the controller is called only when its definition is inserted. A search of my JSP source code directory confirms that I do not use the tiles:insert tag at all, I'm using tiles:get: all my tiles are defined in my tiles-defs.xml. The tiles:get tag extends the tiles:insert tag. The primer is for compatibility with the template mechanism. If you get or insert your login definition, its associated controller is called. Have you tried to remove the associated controller from your login definition ? Does the controller still called ? Where do you get or insert your login definition ? Cedric The attached file shows the template JSP used in the tiles .baseLayout definition that all other definitions extend; it also includes a sample of a 'content' tile that gets substituted for each definition. I control the navigation to the various pages by using tiles definitions as ActionForwards. I hope that the above is acceptable tiles practice. Rick - My BaseLayout.jsp %-- /** This is a page layout that provides for a header area, a navigational bar, a context menu, a content area and a footer area. * Does NOT open the BODY tag. * This allows header tiles to set body-tag attributes. * Does close the BODY tag. * Exports attributes to request so that they can be used by any sub-tile. * Expects app.title to be defined in the application resources * as name of the application. * */ --% %@ page language=java % %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/tiles prefix=tiles % tiles:importAttribute scope=request/ html:html tiles:get name=header / tiles:get name=banner / tiles:get name=navigationBar / table border=0 cellpadding=0 cellspacing=2 width=740 summary=Page Content tr td valign=top width=155 br logic:present name=contextMenu table border=0 cellpadding=0 cellspacing=0 width=155 summary=Secondary Navigation tiles:get name=contextMenu / /table /logic:present /td td valign=top width=3img src=bean:message key=images.commonURL//spacer.gif height=1 width=3 alt= /td td valign=top bgcolor=#cdcdcd width=1img src=bean:message key=images.commonURL//spacer.gif height=1 width=1 alt= /td td valign=top width=5img src=bean:message key=images.commonURL//spacer.gif height=1 width=5 alt= /td td valign=top width=530tiles:get name=content / /td td valign=top width=7img src=bean:message key=images.commonURL//spacer.gif height=1 width=7 alt= /td td valign=top bgcolor=#cdcdcd width=1img src=bean:message key=images.commonURL//spacer.gif height=1 width=1 alt= /td td valign=top width=7img src=bean:message key=images.commonURL//spacer.gif height=1 width=7 alt= /td /tr /table tiles:get name=footer / /body /html:html VV --- a sample content tile %-- /** This renders the content of the welcome text for Type1 users */ --% %@ page language=java import=util.Constants% %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-logic prefix=logic % table border=0 cellpadding=0 cellspacing=2 width=740 summary=Page Content tr td valign=top class=contenttext p img src=bean:message key=images.commonURL//main_title_company.gif width=367 height=21 border=0 alt=My Systembr br logic:present name=%=Constants.USER % bWecolmenbspbean:write name=%=Constants.USER % property=firstName//b, /logic:present logic:notPresent name=%=Constants.USER % bWelcome Type 1 user/b,/p /logic:notPresent pbean:message key=welcome.type1user/br /p /td /tr /table - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Fwd: Using Struts tab layout]
Hi, The Tiles tabsLayout.jsp accept jsp URL and definition names. So, using definition name in the tabList, as you porpose, should work. You can check tabsLayout.jsp code to see how it works. Cedric Original Message Subject:Using Struts tab layout Date: Fri, 20 Jun 2003 17:59:20 +0200 From: [EMAIL PROTECTED] Reply-To: Struts Developers List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Hi, I'm a Struts newbie and this question may have been already addressed, but I can't seem to find anything relevant in the mail archives. I'm trying to use the generic Struts tab layout to my web content and have various page definitions built on top of my tile modules. In the tabs application demo, each tab directly references a link to a JSP url. However, all of my pages are defined via the tiles XML definition file, it would be nice if I can reference these definitions in the tab list rather than the URL link (would mean a reworking of my design). Is there a way to do this or can someone recommend a solution? Any help would be appreciated. Here's a scaled-down version of my definition file. definition name=.aFGenericReportPage path=/tiles/layout/aFReportLayout.jsp put name=title value=SOME TITLE HERE/ put name=header value=SOME HEADER HERE/ put name=body value=SOME BODY HERE/ /definition definition name=.aFOTDRMeasReportPageOverview extends=.aFGenericReportPage put name=title value=OTDR Measurement Report/ put name=header value=OTDRMeasReportHeader.def type=definition/ put name=body value=aFOTDRMeasBody.def type=definition/ /definition ... !-- Page Definitions ends here -- !-- tabs page -- definition name=aFOTDRTabbedMeasBody.def path=/tiles/layouts/aFTabsLayout.jsp put name=selectedIndex value=0/ put name=parameterName value=selected/ putList name=tabList !-- would like to do something like this, but not sure on how and syntax -- add value=Overview link=.aFOTDRMeasReportPageOverview/ add value=Detailed link=.aFOTDRMeasReportPageDetailed/ /putList /definition definition name=.aFOTDRMeasReportPage put name=title value=OTDR MeasurementReport/ put name=body value=aFOTDRTabbedMeasBody.def/ /definition Regards, Trang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [tiles] programatically putting a definition into a layout
William Salvucci wrote: with the following tiles-def, I can forward to layout.main and everything is fine: definition name=layout.main path=/layoutMain.jsp put name=header value=header.jsp / put name=app value=layout.app / put name=footer value=footer.jsp / /definition definition name=layout.app path=/layoutApp.jsp put name=mainMenu value=menu.main / put name=subMenu value=subMenu.jsp / put name=body value=welcome.jsp / /definition !-- Menu bar definition -- definition name=menu.main path=/menu.jsp putList name=items add value=Item 1 / add value=Item 2 / add value=Item 3 / /putList /definition I then modify the tiles-def so that in layout.main app = logon.jsp where logon.jsp submit is associated with a struts action. In the struts action I set the layout.main app = layout.app ComponentDefinition layout = TilesUtil.getDefinition(layout.main, request, this.servlet.getServletContext()); layout.put(app, layout.app); It is not recommended to change a definition dynamically, unless you know very well what you do. A definition content is shared by all the website. Changing the content will be reflected to all user of the definition. If you want to change a definition attribute for the current tiles, you should do so in the tile context, which hold a temporary copy of the definition. and forward to layout.main. So basically after the action everything should be the same as my original setup. However, I get the following error on the forward Jun 20, 2003 1:16:00 PM EDT Error HTTP Included resource or file /netl-c ommons/layout.app not found from requested resource /netl-commons/layoutMain.j sp. The layout.app name has been interpreted as an URL. It appear that the Tiles mechanism hasn't catch it. I don't see how you call the action from the logon.jsp page. Cedric layoutMain.jsp is not changed during my update and looks like TABLE border=1 TRTD COLSPAN=2tiles:insert attribute=header//TD/TR TRTD COLSPAN=2tiles:insert attribute=app / /TD/TR TRTD COLSPAN=2tiles:insert attribute=footer//TD/TR /TABLE Any idea why layoutMain.jsp could load layout.app in the original, but can't when I programatically put it into layout.main? I noticed that the put method doesn't have type as an argument for specifying string, page, definition, so I hope that isn't it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A question on Tiles and Frames
Hi, Each frame of a frameset is filled with a web page. Each one issue an independent http request to the web server. So each page corresponding to a frame should be publicly accessible on the web server, and can't be under WEB-INF. Cedric Jeff Kyser wrote: Hello, I was trying to use a Tile Definition like: definition name=associator.masterPage path=/WEB-INF/pages/tiles/framesetLayout.jsp put name=title value=Associator / put name=heading value=/WEB-INF/pages/tiles/heading.jsp / put name=codevalue=/WEB-INF/pages/tiles/emptyMenu.jsp / put name=menuvalue=/WEB-INF/pages/menu.jsp / put name=button value=/WEB-INF/pages/button.jsp/ put name=textvalue=/WEB-INF/pages/categories.jsp/ /definition with a framesetLayout.jsp that looks like: frameset rows=137,* frameborder=NO border=0 framespacing=0 frame src=%=request.getContextPath()%tiles:getAsString name=heading / name=heading scrolling=NO noresize frameset cols=217,* frameborder=NO border=0 framespacing=0 frameset rows=0,* frameborder=NO border=0 framespacing=0 frame src=%=request.getContextPath()%tiles:getAsString name=code / name=code frame src=%=request.getContextPath()%tiles:getAsString name=menu / name=menu /frameset frameset rows=26%,* frameborder=0 border=0 framespacing=5 cols=* frame src=%=request.getContextPath()%tiles:getAsString name=button / name=button noresize/ frame src=%=request.getContextPath()%tiles:getAsString name=text / name=text noresize/ /frameset /frameset /frameset but I get Forbidden errors, presumably because my JSPs are beneath the WEB-INF directory and therefore not accessible. Is there an alternate way to do this and still have my JSPs underneath WEB-INF? (Basically, I have a frames-based layout with a scrollable panel, and am trying to figure out how to best implement that feature using Struts/Tiles without exposing all my JSPs. TIA, -jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multi-channel tiles example
Hi, There is an (old) example of multi-channels in the Tiles distribution from http://www.lifl.fr/~dumoulin/tiles/. Be aware that this example has a lot of bad links, but the links related to multi-channel should still working. You can also find the following a valuable resource: http://www.lifl.fr/~dumoulin/howto/writeAFactory.doc Hope this help, Cedric Trevor Porter wrote: The struts tiles guide (http://jakarta.apache.org/struts/userGuide/dev_tiles.html) mentions multi-channel tiles as a feature to load different tiles according to some arbitrary key. Is there any documentation or examples demonstration this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A tiles controller is called for an unrelated tiles defintion.
Normally, the controller is called only when its definition is inserted. Are you sure that you don't insert the .login definition from the pages you navigate ? What is the jsp for one of this page ? Cedric Rick Smith wrote: I have a Tiles controller that has been simplified to write to the log. This controller is attached to the tiles definiton used for my login page (no other controllers are used anywhere). What I don't understand is that as I navigate accross the site, every time I am forwarded to a new page (created from a tiles definiton), the logon-controller gets called. Could somebody please explain to me why this might be happening? Below I have included a sample of my tiles-defs.xml, and a portion of the log illustrating the behavior. Thanks, Rick In my tiles controller I have : public void perform(ComponentContext arg0, HttpServletRequest arg1, HttpServletResponse arg2, ServletContext arg3) throws ServletException, IOException { arg3.log( ___Tile Controller: tile definition name -+ arg0.getAttribute(tileDefinitionName)); } In my tiles-defs.xml I have: tiles-definitions definition name=.baseLayout path=/WEB-INF/pages/common/layouts/BaseLayout.jsp put name=tileDefinitionName value=.baseLayout / put name=titleKey value=app.title / put name=header value=/WEB-INF/pages/common/header.jsp/ put name=banner value=/WEB-INF/pages/common/banner.jsp/ put name=navigationBar value=/WEB-INF/pages/common/navigationBar.jsp/ put name=contentvalue=${content}/ put name=footer value=/WEB-INF/pages/common/footer.jsp/ /definition definition name=.login extends=.baseLayout controllerClass=util.CurrentPageController put name=tileDefinitionName value=.login / put name=navigationBar value=/WEB-INF/pages/common/emptyNavigationBar.jsp/ put name=contentvalue=/WEB-INF/pages/login.jsp/ /definition definition name=.welcome extends=.baseLayout put name=tileDefinitionName value=.welcome / put name=contentvalue=/WEB-INF/pages/welcome.jsp/ /definition definition name=.widgets.main extends=.baseLayout put name=contextMenu value=/WEB-INF/pages/common/contextMenus/widgetsMain.jsp/ put name=contentvalue=/WEB-INF/pages/widgets/widgetsMain.jsp/ put name=tileDefinitionName value=.widgets.main / /definition definition name=.widgets.selected extends=.baseLayout put name=contextMenu value=/WEB-INF/pages/common/contextMenus/widgetsSelected.jsp/ put name=contentvalue=/WEB-INF/pages/widgets/widgetsSelected.jsp/ put name=tileDefinitionName value=.widgets.selected / /definition ... /tiles-definitions From the log after navigating around the site: 2003-06-19 13:40:35 ___Tile Controller: definition name - .login 2003-06-19 13:40:42 ___Tile Controller: definition name - .login 2003-06-19 13:40:47 ___Tile Controller: definition name - .login 2003-06-19 13:40:49 action: Executing base logic 2003-06-19 13:40:50 ___Tile Controller: definition name - .login 2003-06-19 13:40:52 action: Executing base logic 2003-06-19 13:40:53 ___Tile Controller: definition name - .login 2003-06-19 13:40:54 action: Executing base logic 2003-06-19 13:40:54 ___Tile Controller: definition name - .login - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: possible to parameterize template path in tiles definition whenusing tile def config file?
The current implementation of Tiles doesn't allow to change dynamically the path/layout of a definition. This is an enhancement request. A workaround is to have a struts action forwarding to different definitions, according to the path you want to use. Another trick is to have a jsp/tiles used as indirection. This tile is used as the path of your definition. This tile do an insert with the path set from one of the attribute (as you suggested), and pass all others attribute. Hope this help, Cedric Trevor Porter wrote: I'm trying to figure out if it's at all possible to parameterize the template path for a tiles defintion dynamically at runtime while at the same time declaring the tile definitions from a config file. I understand that this is straightforward when declaring a tile definition within a JSP (tiles:definition id=definitionName page=%layout%), but I want to use my tile definitions as ActionForwards, thus I need to declare them in a config file. This would be useful for scenarios where pages need to be laid out differently based on some key (such as user preference or browser type) but the struts-config file only knows of a single definition to forward to for a given action. For example, imagine the following struts-config action mapping: action path=/login type=LoginAction input=/index.jsp name=loginForm validate=true scope=request forward name=success path=.account.home/ The forward path points to a tiles definition that renders the account home page. I would like to dynamically control which template layout page is used for this definition from within the LoginAction. Is this possible? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A question on Tiles and Frames
The page of a frame should alway be publicly accessible. It is alway possible to access it directly without the other associated frames. So, you can't hide them. Cedric Cedric Jeff Kyser wrote: Hey Cedric, Thanks for the response. I guess I'd figured out I couldn't put them under WEB-INF for the reasons you stated. So how can I implement a scollable region such as a frame might offer and still use Tiles and stay with some of the 'best practices' recommended for Struts development such as hiding your JSPs under WEB-INF? I suppose it gets off-topic, but surely there must be a way to have independently scrolled regions of a web page in a Struts environment without making every page publicly accessible? thanks, I'd sure like some insight as to how to proceed... -jeff Hi, Each frame of a frameset is filled with a web page. Each one issue an independent http request to the web server. So each page corresponding to a frame should be publicly accessible on the web server, and can't be under WEB-INF. Cedric but I get Forbidden errors, presumably because my JSPs are beneath the WEB-INF directory and therefore not accessible. Is there an alternate way to do this and still have my JSPs underneath WEB-INF? (Basically, I have a frames-based layout with a scrollable panel, and am trying to figure out how to best implement that feature using Struts/Tiles without exposing all my JSPs. TIA, -jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Old time jsp:include and tiles
Hi, ajTreece wrote: Afternoon folks... I've got a web site that uses Struts (v1.x) and Tiles exclusively and it works great. The challenge is that I have been asked to include some code from another group that displays a couple of menu drop downs. They want to keep control of this particular code so they are requesting that I just jsp:include the full path to their file. This doesn't work real well inside of tiles. Is there a tiles: / parameter or option that I can use to include a file with a path like http://sse.central/includeFiles/nav_pulldowns_g No. Tiles can only insert resources from the current web application. Have you try to use the struts bean:include ... / tag ? What is wrong with jsp:include .. ? Cedric Thanks, ajTreece - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles - putlist , add and beanName
Hi, The beanName and beanScope attributes are only allowed in a jsp tag tiles:add They are not allowed in a definition declared in the config file. The reason is that there is no beans declared in the config file, so you can't reference one. One can expect that using beanName in the config file will reference a bean in the jsp where the definition is used/inserted. This is not the case in the actual version. This can be an enhancement request for the next release (you can open a ticket in bugzilla if you whish). Cedric [EMAIL PROTECTED] wrote: Hi according to the tld and documentation the following should be possible: definition name=someInfo extends=test.somePage put name=InfoHeader value=Some Info / putList name=InfoMessages add beanName=myMessageBean beanScope=request/ /putList /definition The beanName attribute should work for both the put and add tag. Using the above configuration, I get nothing Can anyone shed some light on this? thx, Henrik Bentel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [tiles] item attribute for the SimpleMenuItem from ApplicationResources?
In the tiles config file, you specify the key of the resource (value=form.label.name), and in your menu layout, insert the resource from its key with the bean:message ... struts tag: replace %=item.getValue()% with bean:message key=%=item.getValue()% / Cedric Mick Knutson wrote: I want to use the SimpleMenuItem in the Tiles example as my menu is fairly simple, but I want to make the value=Label something like value=form.label.name which would come from the Resource Bundle to be internationalized automatically. How can I do this? --- Thanks... Mick Knutson --- _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Replacement for Tiles DefinitionsUtil.setActionDefinition(..)
There is no replacement (yet ?) for DefinitionsUtil.setActionDefinition(..). Cedric Martin Denham wrote: Hi, Many of the example actions which come as part of the Tiles package use DefinitionsUtil which has been deprecated. I have copied the example actions in my code but would like to get rid of the deprecation warnings. Is there a replacement for DefinitionsUtil.setActionDefinition(..)? thanks Martin --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.483 / Virus Database: 279 - Release Date: 19/05/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where can i find documentation/examples of Multi-channels intiles??
Hi, There is an old example in the tile distribution from http://www.lifl.fr/~dumoulin/tiles/. This example was based on an old version of the tiles-doc.war, and some links aren't working. But, the example show how you can write a definition factory to serve a multi -channel application. You can also check http://www.lifl.fr/~dumoulin/howto/referenceADefinition.doc to know more about writing a definition factory. Another approach for multi-channel is to use the i18n feature of Tiles, with the variant part of the locale indicating a channel (ex: tiles-config_FR_fr_variant.xml). The advantage is that you don't need to write a new definition factory. Cedric Ferran Parra wrote: Where can i find documentation/examples of Multi-channels in tiles?? I could not find anything in http://www.lifl.fr/~dumoulin/tiles/, or the official struts home page. thanks! --- Ferran Parra [EMAIL PROTECTED] http://www.mubimedia.com MUBIMEDIA S.L. C/ Mallorca, 275, 1r 2a 08008 BCN Tel: 93 215 21 91 / Fax: 93 215 41 21 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to catch exception using tiles ???
Originally, it was possible to use the jsp page directive @ page |errorPage=|relativeURL @ on a nested tile bases| |for error/exception handling. But this doesn't work anymore. I have no simple solution. You can try one of the following: * Put a surrounding try/catch block in the tile throwing an exception, and treat the exception from there. * Change the insert ... tag behavior by changing the implementation of InsertTag.java. Look for the method processException(...). All is happening here. You can either provide your own new tag, or change the original tag behavior. * Avoid throwing an exception in a Tile. This is certainly the best way :-). Page rendering should normally not throw an exception. If you have an action or controller throwing an exception, consider using a Struts action with associated exception mechanism, or catch the exception in the action and do a forward accordingly. * Wait for the next release which will provide a better exception handling mechanism. This can take some times :-( Cedric Thomas Oldervoll wrote: Cedric Dumoulin [EMAIL PROTECTED] writes: Actually, the tiles:insert ... tag catch all the exceptions and show the message in place of the tile. This behavior help developing a complex page made of several tiles. If you set the logging level to debug, the complete exception stack trace will be shown. This behavoiur actually causes a problem for me. I want to show a pretty error message when a page or a tile failes. I use my own RequestController, a subclass of TilesRequestController. To handle page faults I have added a method process() that calls super.process() surrounded by a try/catch-block. I wanted to do the same thing for each tile, so I tried implementing processInclude(). This didn't work since tiles:insert never calls processInclude(). Investigating other options, I can't find any way to get tiles:insert to not print out the exception on the JSP and rather let me decide want to do. What I want is: - no generated exception message in the HTML output - the ability to print my own error message and log the error, or maybe even try to get hold of some cached content to use instead. Any tips for how to achieve this? -- Thomas Oldervoll, Zenior AS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles .. Should what level should one Drill down
Nimish Chourey , Tidel Park - Chennai wrote: Hi All , Looking at the examples of Tiles , I could make out that if you see a pattern in your JSP's then they could be easily factored into templates or what you can also called as tiles . For eg . you can divide your page in terms of Menu , Header , footer and body . Now my question is till what level can we define tiles or templates ?? Say I have a form with say 4 tables . These tables are similar . I mean I could easily make a template for these tabels . And these type of tables are used in all my JSP's . Should I make a tile for this type of table . You can make a Tile for your tables, and for any part of a page that is often used. This will improve reuse and reduce maintenance. The point to note here is these all tables are in a single form . You can insert tiles inside a form. What you should care about is that the open and close tag of the form should be in the same tile. There is an example in tiles-documentation.war under /tutorial/invoice showing the possible use of a form with reusable tiles. Cedric If I go ahead with this , what type of problems can I face ? Or the tiles should really be used at very high level ie say at Menu Footer Header level ?? Hope I have made my question clear . Comments are welcome .. Nimish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles:initComponentDefinitions and NullPointerException
This will not work with this tag because it checks for the factory existence. You can use the special action o.a.s.tiles.actions.ReloadDefinitionsAction.java to reload the factory. Cedric Bastian Zapf wrote: Salut Cedric and everybody else, can you also use tiles:initComponentDefinitions ... to re-initialize the factory? We're working here with a Websphere App. Server and would like to do that without restarting the server/whole application. Thanks, bas marco. Dienstag, 27. Mai 2003 15:51 To: Struts Users Mailing List [EMAIL PROTECTED] cc: From: Cedric Dumoulin [EMAIL PROTECTED] Subject: Re: tiles:initComponentDefinitions and NullPointerException Hi, The tiles:initComponentDefinitions ... tag can be used to initialize the tiles factory without Struts. However, the preferred way to initialize Tiles without Struts is to use an initialization servlet, like the TilesServlet. A blank war file initializing a Tiles factory without Struts can be found in the bin dist from http://www.lifl.fr/~dumoulin/tiles/. Locate the file tiles-blank.war. Cedric Umit VARDAR wrote: Hello all, I am trying to replace jsp pages of an application with tiles. All I do: 1. added taglib tags to web.xml 2. created tiles-defs.xml under the WEB-INF 3. added tiles:initComponentDefinitions file=tiles-defs.xml / as the first tiles tag into the index.jsp I am getting the following error, when I acces index.jsp: java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at org.apache.struts.tiles.TilesUtilImpl.applicationClass(TilesUtilImpl.java: 238) ... the rest is in the error.txt file. What could be the reason? Can you help me please. Best regards Umit VARDAR PS. error.txt, index.jsp and tiles-defs.xml are attached. java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:140) at org.apache.struts.tiles.TilesUtilImpl.applicationClass(TilesUtilImpl.java:238) at org.apache.struts.tiles.TilesUtilImpl.createDefinitionFactoryInstance(TilesUtilImpl.java:187) at org.apache.struts.tiles.TilesUtilImpl.createDefinitionsFactory(TilesUtilImpl.java:166) at org.apache.struts.tiles.TilesUtil.createDefinitionsFactory(TilesUtil.java:206) at org.apache.struts.taglib.tiles.InitDefinitionsTag.doStartTag(InitDefinitionsTag.java:127) at org.apache.jsp.index$jsp._jspService(index$jsp.java:68) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:173) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:223) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:142) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
Re: role - tiles definition?
Hi, There is a simple example of usage in tiles-documentation.war under test/testRole. In brief, when you specify a role, the insert is performed only if the user is in requested role. Otherwise the tag is skipped. You can refer to the documentation of insert .. tag (http://jakarta.apache.org/struts/userGuide/struts-tiles.html), and experiment. What you should know: the role attribute work in definitions with definition ... role=aRole/, but not in the put ... tags of a definition. ,Furthermore the role attribute only accept one role. An alternative is to use the logic tags of struts to check roles. Cedric José Fortunato H. Tomás wrote: Hi! I read the tilesAdvancedFeatures.pdf in some fast way. At end I see (9.2) a reference to role for tiles definition. I look backwords in the document I could find any mension of how it works, or how it should be used. Any one has a reference or could tell how this role works, or how I should use it? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please help a Tiles problem
The error message says that the definition factory is not found. Have you initialized the tile plugin ? Cedric Vernon wrote: 1. The error message: root cause javax.servlet.ServletException: Can't get definitions factory from context. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533) at org.apache.jsp.page_jsp._jspService(page_jsp.java:189) 2. The translated JSP file public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; javax.servlet.jsp.PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(text/html;charset=ISO-8859-1); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(\r\n); out.write(\r\n); out.write(\r\n\r\n); if (_jspx_meth_c_if_0(pageContext)) return; out.write(\r\n); if (_jspx_meth_c_if_1(pageContext)) return; // ... out.write(\r\n); if (_jspx_meth_c_if_37(pageContext)) return; out.write(\r\n\r\n\r\n\r\n\r\n\r\n\r\n); out.write(\r\n\r\n); if (_jspx_meth_tiles_insert_0(pageContext)) return; } catch (Throwable t) { out = _jspx_out; if (out != null out.getBufferSize() != 0) out.clearBuffer(); if (pageContext != null) pageContext.handlePageException(t); line 189 } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext); } 3. The JSP file with the definitions % taglib prefix=tiles uri=/WEB-INF/tlds/struts-tiles.tld % % taglib prefix=c uri=/WEB-INF/tlds/c.tld % c:if test=${empty applicationScope.FRONT} tiles:definition id=FRONT template=/jsp/templates/myLayout.jsp put name=title value=Front Page / put name=header value=/jsp/signon/header.jsp / put name=footer value=/jsp/homepage/footer.jsp / put name=body value=/jsp/frontpage/content.jsp / /tiles:definition /c:if c:if test=${empty applicationScope.SIGNON} tiles:definition id=SIGNON extends=FRONT put name=title value=Sign On / put name=body value=/jsp/signon/content.jsp / /tiles:definition /c:if !-- -- If I erase all defintions, but keep the first one, the attributes wouldn't loaded. The Tiles is from http://www.lifl.fr/~dumoulin/tiles/. I don't have any JSP debugging tool. Can someone please tell me where is wrong or how to find out the cause. Vernon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Build the Tiles
Yes you can build the tiles from the sources. You need to compile classes under o.a.s.tiles and o.a.s.taglib.tiles. Another simplest solution is to get the struts.jar, rename it to tiles.jar, open it with winzip or whatever you want, and suppress all the classes not related to tiles. Cedric Vernon wrote: Hi, all, I need to use the Tiles as a standalone component in my project. I am new to Tiles in less than on week. I follow the chapter 11, Developing applications with Tiles, of Struts in Action to set up Tiles. I run into a couple of problem and hope someone can give me a hand. The tiles.jar file I get from Cedric Dumoulln's site, which was built in the last Noverber. But the all common libraries are the most recent releases. I think the old build might cause those problem. After uploaded the rc1 source base, I only can see the Tiles installation, but not compiling and archive Tiles. Can I build Tile from the source? If yes, how I can do it? Thanks for your helps. Vernon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Question:Diff between jsp and XML tiles definations...
There is some differences: * Xml definitions are store in a factory; they can be inserted with insert name=aDefinition; they are declared in a centralized file, they can be declared using inheritance; they can be used in a struts forward ... tag; they need the initialization of the factory (done by the plugin) * jsp definition are stored in one of the jsp context. They are inserted with insert beanName=aBeanId; they don't need the factory; they can't be used as struts forward ...; they are created each time the tiles:definition .. tag is encountered. Hope this help, Cedric [EMAIL PROTECTED] wrote: Hi All, I am new to tiles and experimenting with it a bit to see if our struts 1.0 template based application can be ported to Tiles easily... I have got some sample pages from our application working using tiles definations But the definations are defined in a jsp file. So my question is whats the difference between Using an xml file for defination and using a jsp file?If I am using jsp definations, Do i stil need to initialise the Defination factory? If I go the jsp way, Will I be still able to use all features of tiles ?because I think to use tiles I need to use ActionComponentServlet(Struts 1.0) instead of ActionServlet...And the ActionComponentServlet modifies the forward behaviour for use with tiles...So does it mean that whether I use xml definations or not,I need to use ActionCOmponentServlet...Is it true? Any help is appreciated... regards, Shirish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Build the Tiles
Hi, Yes, we have discuss of that in the struts-dev list. There is pro and cons. Check the archive to know more. For now, we stay with the actual status quo. Cedric COMPAGNON GUILLAUME wrote: Have you (the strut's commitors) discuss about the possibility to separate the struts components (tiles, valdator, struts-html, struts-bean, ...) into differents jars ? a good advantage is not to wait struts versioning for an enhancement on one of these components.(very similar to the commons-XX.jar files) Guillaume -Message d'origine- De: Cedric Dumoulin [SMTP:[EMAIL PROTECTED] Date: vendredi 4 avril 2003 10:16 À: Struts Users Mailing List Objet: Re: Build the Tiles Yes you can build the tiles from the sources. You need to compile classes under o.a.s.tiles and o.a.s.taglib.tiles. Another simplest solution is to get the struts.jar, rename it to tiles.jar, open it with winzip or whatever you want, and suppress all the classes not related to tiles. Cedric Vernon wrote: Hi, all, I need to use the Tiles as a standalone component in my project. I am new to Tiles in less than on week. I follow the chapter 11, Developing applications with Tiles, of Struts in Action to set up Tiles. I run into a couple of problem and hope someone can give me a hand. The tiles.jar file I get from Cedric Dumoulln's site, which was built in the last Noverber. But the all common libraries are the most recent releases. I think the old build might cause those problem. After uploaded the rc1 source base, I only can see the Tiles installation, but not compiling and archive Tiles. Can I build Tile from the source? If yes, how I can do it? Thanks for your helps. Vernon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ce message et toutes les pieces jointes (ci-apres le message) sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.Tout message electronique est susceptible d'alteration. Le CREDIT DU NORD et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. This message and any attachments ( the message) are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited.E-mails are susceptible to alteration. Neither CREDIT DU NORD nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles problem
Hi, How do you insert your tiles ? Do you use the tiles:insert name=home.main tag, an action forward name =home.main / or something else ? You should use one of insert or forward. Cedric Stephen Smithstone wrote: Hi all got a problem with a tiles contoller heres the controller code public class IndexTiles implements org.apache.struts.tiles.Controller { public void perform( ComponentContext comCtx , HttpServletRequest req , HttpServletResponse res , ServletContext serCtx ) { System.out.println( Processing IndexTiles.. ); List newStories = new ArrayList( ); NewStory story = new NewStory( ); story.setStory( A New Document Store System is now in place that allows sub directories to be assigned to different people ); story.setStoryDate( new java.text.SimpleDateFormat( dd/MM/ ).format( new java.util.Date( ))); newStories.add( story ); comCtx.putAttribute( News , newStories ); Iterator it = comCtx.getAttributeNames(); while( it.hasNext() ) { System.out.println( it.next().toString() ); } } } and in my tiles-defs.xml i have definition name=home.main extends=main.layout controllerClass=co.uk.oyez.webapps.intranet.home.tiles.IndexTiles put name=body value=/home/pages/index.jsp / put name=heading value=Intranet - Home / how ever on my page index.jsp i have tiles:importAttribute name=News/ when ever i go to the page is says it cant find News in the context please help Ta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Question:Diff between jsp and XML tiles definations...
[EMAIL PROTECTED] wrote: Hi Cedric, Thanks for the reply once again..:-)) But I still have one question. So does it mean that using the jsp approach is a bit inefficient? Yes, unless you provide a mechanism to avoid the reload of definition But is the the only disadvantage? No, Definition are located in jsp pages instead of a central file, and you can't easily use inheritance. My main concern is can I use all the features of tiles (Mainly defination Inheritance etc.)with the jsp approach? Inheritance is not fully implemented whith def in jsp. I am trying to avoid the use of action component servlet as We already have extended ActionServlet in our project.And I am not sure if we Instead inherit ActionComponentServlet will it affect any thing else.. Try to inherit from the TilesActionComponentServlet. It overload few methods, so it should not interfere with your class. Cedric regards, Shirish -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 2:19 PM To: Struts Users Mailing List Subject: Re: Tiles Question:Diff between jsp and XML tiles definations... There is some differences: * Xml definitions are store in a factory; they can be inserted with insert name=aDefinition; they are declared in a centralized file, they can be declared using inheritance; they can be used in a struts forward ... tag; they need the initialization of the factory (done by the plugin) * jsp definition are stored in one of the jsp context. They are inserted with insert beanName=aBeanId; they don't need the factory; they can't be used as struts forward ...; they are created each time the tiles:definition .. tag is encountered. Hope this help, Cedric [EMAIL PROTECTED] wrote: Hi All, I am new to tiles and experimenting with it a bit to see if our struts 1.0 template based application can be ported to Tiles easily... I have got some sample pages from our application working using tiles definations But the definations are defined in a jsp file. So my question is whats the difference between Using an xml file for defination and using a jsp file?If I am using jsp definations, Do i stil need to initialise the Defination factory? If I go the jsp way, Will I be still able to use all features of tiles ?because I think to use tiles I need to use ActionComponentServlet(Struts 1.0) instead of ActionServlet...And the ActionComponentServlet modifies the forward behaviour for use with tiles...So does it mean that whether I use xml definations or not,I need to use ActionCOmponentServlet...Is it true? Any help is appreciated... regards, Shirish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Probelm with Tiles download...
Hi, The download from the cited site should run. The tutorial is in tiles-doc.war. It should run immediately, unless you have a configuration problem (missing jars, bad parser version, ...). The tutorial in this dist is based on a now old struts 1.1 pre beta version. If you want to use tiles with struts1.0.x, I advice to do the following: * get the tiles-documentation.war from struts distribution. Learn, do the tutorial and experiment with this war file. The files from the tutorial are in this version. * After you are comfortable with Tiles, experiment on a struts1.0 platform: get the dist from my website, locate tilesForStruts1-0.jar and use it with struts1.0. * You can start from the tiles-blank-struts1-0.war file to have a good starting point with struts1.0. Hope this help, Cedric [EMAIL PROTECTED] wrote: Hi All, I just downloaded Tiles.zip from the tiles home page(http://www.lifl.fr/%7Edumoulin/tiles/).I need to use it with struts 1.0. The readme.txt says that there is a tilies-tutorial.war which i cant find any where. Also there are 2 jar files(tiles.jar in /lib and tilesForStruts1-0.jar in /lib/struts1.0).SO which one i shoule be using? And when I deploy the tiles-documentation.war and access it,I get following exception org.apache.jasper.JasperException: Can't get definitions factory from context. at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) Where can I get a proper download of Tiles for struts 1.0. regards, Shirish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Probelm with Tiles download...
Args ... I mean struts 1.1. Tiles framework has been integrated in struts 1.1. It can work with struts1.0, but you need the TilesForStruts.jar. Check http://jakarta.apache.org/struts/api/org/apache/struts/tiles/package-summary.html#package_description for installation. Cedric [EMAIL PROTECTED] wrote: Hi Cedric, Thanks for the advice...I will try the same.. But what you mean by Struts distribution?Do you mean Struts 1.0.x distribution or struts 1.1 distribution? Because as far as I know, struts 1.0.x dist does not contain tiles.SO if i need to get struts 1.1,then I will have to run the tiles tutorial with struts 1.1. regards, Shirish -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 1:57 PM To: Struts Users Mailing List Subject: Re: Probelm with Tiles download... Hi, The download from the cited site should run. The tutorial is in tiles-doc.war. It should run immediately, unless you have a configuration problem (missing jars, bad parser version, ...). The tutorial in this dist is based on a now old struts 1.1 pre beta version. If you want to use tiles with struts1.0.x, I advice to do the following: * get the tiles-documentation.war from struts distribution. Learn, do the tutorial and experiment with this war file. The files from the tutorial are in this version. * After you are comfortable with Tiles, experiment on a struts1.0 platform: get the dist from my website, locate tilesForStruts1-0.jar and use it with struts1.0. * You can start from the tiles-blank-struts1-0.war file to have a good starting point with struts1.0. Hope this help, Cedric [EMAIL PROTECTED] wrote: Hi All, I just downloaded Tiles.zip from the tiles home page(http://www.lifl.fr/%7Edumoulin/tiles/).I need to use it with struts 1.0. The readme.txt says that there is a tilies-tutorial.war which i cant find any where. Also there are 2 jar files(tiles.jar in /lib and tilesForStruts1-0.jar in /lib/struts1.0).SO which one i shoule be using? And when I deploy the tiles-documentation.war and access it,I get following exception org.apache.jasper.JasperException: Can't get definitions factory from context. at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) Where can I get a proper download of Tiles for struts 1.0. regards, Shirish - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem forwarding from a Tile or Template.
Hi, The provided code should work with Tiles if you have set the TilesRequestProcessor. The problem is that the jsp spec forbid the use of forward once the response is committed. But the jsp spec also said that a response is committed when you do an insert(). Tiles, and Templates, use include(). Struts action forward tag use forward(). So there is a problem. The TilesRequestProcessor takes care of this problem, and use include() instead of forward() when you use a forward ... in a struts action. Cedric [EMAIL PROTECTED] wrote: I get Cannot forward because the response has already been committed. I get the same response using Templates or Tiles. Here is a simplistic version of my problem. My JSP is ... %@ taglib uri=/WEB-INF/tld/struts-tiles.tld prefix=tiles % tiles:insert page=/one-pane-template.jsp tiles:put name=main value=/requestCreate1.do / /tiles:insert one-pane-template.jsp is %@ taglib uri=/WEB-INF/tld/struts-tiles.tld prefix=tiles % html head / body tiles:insert name=main/ /body /html I am trying to attain a Tiled display, where one of the Tiles is a wizard. As there are a lot of initial form parameters for this app, I call the action and form to initialise the data. Hence, the .do call. If I create an Action for the Tile container (one-pane-template.*) and populate the necessary beans there, calling one-pane-template.do and requestCreate1.jsp works, but this seems the wrong place to put the logic. FYI - I initially raised this as a bug (for Templates) http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18469, but it was invalidated as Tiles had superseded it. Thanks Tony. Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using a Tile Definition from within a Servlet ?
Yes, it is possible. There is no simple API to do that, but take a look at the TilesRequestProcessor.processTilesDefinition(...) method to know how it is done by the struts servlet. What you should do is: * retrieve the definition from the factory * create the new tile context from thedefinition * save the current tile context * store the new tile context in the jsp context * include the new tile * restore the current context Hope this help, Cedric Trevor Nightingale wrote: Is it possible to forward to a tiles definition with a servlet ? Something like RequestDispatcher dispatcher = request.getRequestDispatcher(tile.def.goes.here); dispatcher.forward(request,response); Thank you in advance, Trevor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem forwarding from a Tile or Template.
You are going in the right direction, but you should declare the tiles plugin as follow in the struts-config.xml: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=moduleAware value=true / /plug-in This should be inserted after the /action-mappings tags. You can check the struts-config.xml file in tiles-documentation.war as example. Cedric [EMAIL PROTECTED] wrote: I assume you mean, add the following to the struts-config.xml controller contentType=text/html;charset=UTF-8 debug=3 locale=true nocache=true processorClass=org.apache.struts.tiles.TilesRequestProcessor / But having done this I now get; Cannot initialize RequestProcessor of class org.apache.struts.tiles.TilesRequestProcessor: java.lang.ClassCastException: org.apache.struts.tiles.TilesUtilImpl Am I going in the right direction? T. -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 09:58 To: Struts Users Mailing List Subject: Re: Problem forwarding from a Tile or Template. Hi, The provided code should work with Tiles if you have set the TilesRequestProcessor. The problem is that the jsp spec forbid the use of forward once the response is committed. But the jsp spec also said that a response is committed when you do an insert(). Tiles, and Templates, use include(). Struts action forward tag use forward(). So there is a problem. The TilesRequestProcessor takes care of this problem, and use include() instead of forward() when you use a forward ... in a struts action. Cedric [EMAIL PROTECTED] wrote: I get Cannot forward because the response has already been committed. I get the same response using Templates or Tiles. Here is a simplistic version of my problem. My JSP is ... %@ taglib uri=/WEB-INF/tld/struts-tiles.tld prefix=tiles % tiles:insert page=/one-pane-template.jsp tiles:put name=main value=/requestCreate1.do / /tiles:insert one-pane-template.jsp is %@ taglib uri=/WEB-INF/tld/struts-tiles.tld prefix=tiles % html head / body tiles:insert name=main/ /body /html I am trying to attain a Tiled display, where one of the Tiles is a wizard. As there are a lot of initial form parameters for this app, I call the action and form to initialise the data. Hence, the .do call. If I create an Action for the Tile container (one-pane-template.*) and populate the necessary beans there, calling one-pane-template.do and requestCreate1.jsp works, but this seems the wrong place to put the logic. FYI - I initially raised this as a bug (for Templates) http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18469, but it was invalidated as Tiles had superseded it. Thanks Tony. Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version
Re: tiles:insert tag inserting carriage return before /td on linux box
Hi, The Tiles tags only insert the content of the specified pages. There is no extra insertion. So, your problem should come from one of your pages having this extra character. Check particularly the layout jsp ... Also, try to isolate the exact location in your pages where this extra car is inserted. Delete the cars and rewrite them on the unix system. Cedric Alix Jermyn wrote: Our tiles work fine with Tomcat 4.1.12, struts1.1b3, jdk1.4.01 on an NT box, but as soon as we port it to a Linux box (SUSE, same 1.1b3, tomcat 4.1.24) our rendered html displays a subtle and rather nasty error, as a carriage return is inserted immediately before the /td tag, causing the well known rendering bug in tables. for example; td blah blahtiles:insert attribute=MainHeader //td will be rendered correctly as: td blah blah Main header text/td on the NT system, but as td blah blah Main header text /td on the linux server, with the carriage return causing ugly display problems. As far as we are aware, we have saved all our text files (jsp, html, tld, xml ...) in unix format without the NT double ODOA CR sequence. Any ideas??? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] putList() Displaying
Hi, The tiles:insert tag don't check if the attribute is a list because element of the list can be of several kind (def name, URL, Item, custom bean, ...). Doing an insert on a attribute of type list doesn't means that you want to insert each element of the list. Maybe you simply want to display the element. Take for example the menu layout. It requires as input a list of Item. One can customized the Item: how the insert tag can take into account such customization ? In the current proposal, the insert tag just pass the list as is, and let the programmer play with the list according to what have been pushed in the list. Cedric Jacob Hookom wrote: I was wondering if I missed something in the documentation pertaining to displaying lists of includes without using scriptlets. The tiles example war uses putLists to describe menus, but then uses a scriptlet with an Iterator to actually display them. Why doesn't the tiles:insert tag know if it's a list and iterate over the results to display them-- again, I may have completely missed it in the documentation? Best Regards, Jacob Hookom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: custom tile definitions leads to error
Hi, If you use your own defined Item class, you can disable the xml validation to add your extra properties (set the appropriate option in the TilesPlugin). Also, you can use the bean tag instead of item: bean classname=... set-property property=... value=... / set-property property= ... value=... / ... /bean Maybe we should add the set-property ... tag to the item tag ? Cedric Dan Allen wrote: I took the lead of Cedric when he made his SimpleMenuItem and I extended it to make a SimpleMenuActionItem with the following layout: item text=Home action=/Home classtype=net.creativerge.bean.SimpleMenuActionItem/ However, now I am getting DTD parse errors all over the place. It seems sort of lame to have to worry about DTD issues if you want to extend and make your own custom tag. But I guess such is life with XML. So I can do one of two things at this point. I can create my SimpleMenuActionItem using the original attributes and just have a non-intuitive mapping between the two (the attribute name and what it actually does) or I can modify the DTD for my new item set. However, if i modify the DTD I have no idea where to put it or how to reference it (okay, so I lack some XML knowledge). However, I thought it was a pretty good idea, seeing how struts should always make internal links action links, to make a SimpleMenuActionItem. I also felt that the attribute text was more intuitive for the contents between the link than value since the other option is icon my proposal for the DTD is as follows: + add an attribute action which, when used in place of link will reference a struts action + change value to text to counter the icon I could be just talking crazy here, but it seems like a good idea to me. Perhaps we could excite some interest in defining how to extend the items list a bit better. Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] putList() Displaying
You can getting away of scriptlet by using logic:insert ... with a jsp 1.2 compliant server, or use jstl c:forEach. The examples provided in tiles-documentation should be jsp1.1 compliant, so they use a loop in a scriptlet. But this doesn't really matter, as this scriptlet only occur in a well located jsp. You can think of this jsp as a black box, and don't bother at what there is inside. Your jsp can contain only tag with no scriptlet, and use some layout containing the scriptlet. Cedric Hookom, Jacob John wrote: Why can't the tag or the tiles controller do something along the lines of instanceof, if the property is a list-type, then process each member of the list to the page? I thought everyone was getting away from scriptlets -Jacob -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Mon 3/31/2003 3:50 AM To: Struts Users Mailing List Cc: Subject: Re: [Tiles] putList() Displaying Hi, The tiles:insert tag don't check if the attribute is a list because element of the list can be of several kind (def name, URL, Item, custom bean, ...). Doing an insert on a attribute of type list doesn't means that you want to insert each element of the list. Maybe you simply want to display the element. Take for example the menu layout. It requires as input a list of Item. One can customized the Item: how the insert tag can take into account such customization ? In the current proposal, the insert tag just pass the list as is, and let the programmer play with the list according to what have been pushed in the list. Cedric Jacob Hookom wrote: I was wondering if I missed something in the documentation pertaining to displaying lists of includes without using scriptlets. The tiles example war uses putLists to describe menus, but then uses a scriptlet with an Iterator to actually display them. Why doesn't the tiles:insert tag know if it's a list and iterate over the results to display them-- again, I may have completely missed it in the documentation? Best Regards, Jacob Hookom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles-Definitions] can't find bean in request.
Joel Wickard wrote: Cedric Dumoulin wrote: Hi, The definition from the tiles file are stored in the factory. You should use the following to insert a definition: tiles:insert name=admin / the above method of trying to insert the predefined defs results in the following exception when I try to view the page. So you have an error in your config or in your definition declaration. Please, check the examples in the tiles-documentation.war. You can also check one of the following articles: * http://blogs.browsermedia.com/patrick/index.do?date=20030210#120914 * http://www.onjava.com/pub/a/onjava/excerpt/progjakstruts_14/index1.html * http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html * http://www-106.ibm.com/developerworks/java/library/j-strutstiles.html * and many other ... Cedric java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag.processName(InsertTag.java:527) at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:486) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:444) at org.apache.jsp.employeeLanding_jsp._jspx_meth_tiles_insert_0(employeeLanding_jsp.java:75) at org.apache.jsp.employeeLanding_jsp._jspService(employeeLanding_jsp.java:54) Check the tag syntax :-) Cedric Joel Wickard wrote: Here's the first few lines of the root cause of the exception I'm getting: root cause javax.servlet.ServletException: Error - Tag Insert : No value defined for bean 'admin' with property 'null' in scope 'request'. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:494) at org.apache.jsp.employeeLanding_jsp._jspService(employeeLanding_jsp.java:59) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) Here's my web.xml entries: taglib taglib-uri/WEB-INF/struts-tiles/taglib-uri taglib-location/WEB-INF/struts-tiles.tld/taglib-location /taglib Here's my struts-config entries: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=definitions-debug value=2 / /plug-in Here's my tiles-defs.xml entries: tiles-definitions definition name=admin path=/admin/templates/backendMain.jsp put name=page-title value=QuatraData :: Default / put name=logo-content value=/logoDefault.jsp / put name=menu-layout value=/menuBar.jsp / /definition /tiles-definitions Here's the page I'm trying to use the template in: [EMAIL PROTECTED] contentType=text/html% %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % tiles:insert beanName=admin beanScope=request/ ( what I'm trying to do is just have a page that uses all the defaults specified in tiles-defs, that's why I have no put tags ) Here's the template itself: [EMAIL PROTECTED] contentType=text/html% %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % html head titletiles:getAsString name=page-title //title script language=Javascript function launchTimeClock(){ window.open( ./timeclock/timeClock.jsp, puchClock, resizeable=no, height=170, width=230); } /script /head body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#CC onLoad=launchTimeClock(); table cellspacing=0 cellpadding=0 border=0 tr td width=300 !-- Logo Content -- tiles:insert name=logo-content / /td td valign=top tiles:insert name=menu-layout / /td /tr /table /body /html Here's the pages that should be inserted: logoDefault.jsp: I am a logo menuBar.jsp: My Menu Bar If I don't use definition, if I just use a template and then manually use tiles:put, it works fine. Any help would be great, I can supply any other requested information. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REPEAT: Tiles put attribute beanScope not found in DTD -is this right?
Hi Richard, The scope attribute in an insert is used to specify the jsp scope from which a definition should be retrieved. Definition can be stored in a jsp context by the user or with the help of the tiles:definition .. tag. Definitions declared in the tiles config file are NOT stored in a jsp scope, but in the tiles definition factory. There is no way to store them in a jsp scope from the config file. So the scope attribute is not available in the config file. Cedric Richard Mixon wrote: Sorry, to repost, but this seems like a bug. No? Hi. We are trying to use the beanScope attribute. The Tiles documentation that comes with Struts 1.1rc1 says that both the definition and put tags support beanScope. When I use it we get the following error when Tomcat 4.1.18 starts up: ... 19:26:14,593 ERROR Digester:1434 - Parse Error at line 29 column -1: Attribute scope is not declared for element definition. org.xml.sax.SAXParseException: Attribute scope is not declared for element de finition. at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1411) ... I' also looked at both the tiles-config.dtd and tile-config_1.1.dtd - neither indictates that beanScope is supported. However the struts-tiles.tld file does reference the beanScope. Is it intentional that defining Tiles in the XML config file is down-level from defining Tiles in the actual JSP page? Thanks - Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Questions concerning Tiles
Hi Guillaume, It is hard to say, I have never evaluated the cost of creation of a new Date object. You need to evaluate this cost, and compare it against a solution where you cache the object. Maybe the Date implementation already do a kind of caching ! If not, it should be simple to create a singleton class(a static one) with one method: getDate(). This method cache the real object, and take care of updating it daily :-). Cedric COMPAGNON GUILLAUME wrote: Cédric, is that make sense to define a bean type for printing the today date with the scope of the application ( in order not to instanciate the Date each time) ? Thx! Guillaume Ce message et toutes les pieces jointes (ci-apres le message) sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.Tout message electronique est susceptible d'alteration. Le CREDIT DU NORD et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. This message and any attachments ( the message) are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited.E-mails are susceptible to alteration. Neither CREDIT DU NORD nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles - how to handle missing jsp page
Hi, aps olute wrote: Hi, How to handle missing jsp pages so one does not get errors? Not all these elements have ignore attributes, so how to handle them? Some of these are in defs.xml and some are in the regular jsp files. 1. on the putlist listed under item value=... links=.../ 2. on the putlist added via add value=../ You can handle them when you insert them in the layout: tiles:insert attribute=.. ignore=true / My problem is if these were missing at start of tomcat, no exceptions are displayed, but upon adding the missing jsp -- they get displayed okay. But now if I delete this jsp file again, NO exception is thrown but the old image is still displayed even though the jsp is missing now. Why? (as if the jsp did not get recompiled, I expect recompilation if there is a missing jsp page). Looks like a container problem: your container doesn't detect the deleted jsp, and use the existing generated java code. What server do you use ? Cedric I can think of a scenario that in a live environment jsp pages are moved/removed from a page and it should not throw an exception or display an older page (if the included page has been removed). Thanks in advance. aps __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles-Definitions] can't find bean in request.
Hi, The definition from the tiles file are stored in the factory. You should use the following to insert a definition: tiles:insert name=admin / Check the tag syntax :-) Cedric Joel Wickard wrote: Here's the first few lines of the root cause of the exception I'm getting: root cause javax.servlet.ServletException: Error - Tag Insert : No value defined for bean 'admin' with property 'null' in scope 'request'. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:494) at org.apache.jsp.employeeLanding_jsp._jspService(employeeLanding_jsp.java:59) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) Here's my web.xml entries: taglib taglib-uri/WEB-INF/struts-tiles/taglib-uri taglib-location/WEB-INF/struts-tiles.tld/taglib-location /taglib Here's my struts-config entries: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=definitions-debug value=2 / /plug-in Here's my tiles-defs.xml entries: tiles-definitions definition name=admin path=/admin/templates/backendMain.jsp put name=page-title value=QuatraData :: Default / put name=logo-content value=/logoDefault.jsp / put name=menu-layout value=/menuBar.jsp / /definition /tiles-definitions Here's the page I'm trying to use the template in: [EMAIL PROTECTED] contentType=text/html% %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % tiles:insert beanName=admin beanScope=request/ ( what I'm trying to do is just have a page that uses all the defaults specified in tiles-defs, that's why I have no put tags ) Here's the template itself: [EMAIL PROTECTED] contentType=text/html% %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % html head titletiles:getAsString name=page-title //title script language=Javascript function launchTimeClock(){ window.open( ./timeclock/timeClock.jsp, puchClock, resizeable=no, height=170, width=230); } /script /head body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#CC onLoad=launchTimeClock(); table cellspacing=0 cellpadding=0 border=0 tr td width=300 !-- Logo Content -- tiles:insert name=logo-content / /td td valign=top tiles:insert name=menu-layout / /td /tr /table /body /html Here's the pages that should be inserted: logoDefault.jsp: I am a logo menuBar.jsp: My Menu Bar If I don't use definition, if I just use a template and then manually use tiles:put, it works fine. Any help would be great, I can supply any other requested information. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configuring Tiles + Validation + Modules
Niesen, Nathan wrote: I basically have the same questions. I've been searching the user docs and mailing lists trying to get a handle on what modules were intended to do, what modules can and can't do, and how I can use modules to improve my application framework. It appears to me that the modules feature opened up a whole can-o-design-worms and they're still wiggling. I can't find anything that clearly defines intended usage of modules or the limitations of modules; especially in regards to using resources outside of a modules sub-directory. In addition to John's questions, I have the following question: 1) How can I use tiles/templates to assemble a page in one module from reusable components/pages in one or more other modules? For example: I have pages in modules B, C, and D, that all want to pull in a menu page from my default module as well as a reusable page from module A. Tiles config file consider the url as absolute to the application. So, simply specify the absolute URL of your layout, page or tile. The tiles-documentation.war use 3 modules. You can check it for examples. Cedric Other issues with modules: 1) Not all tags (html:img in particular) use the pagePattern or forwardPattern attributes from the controller. If I want to use an image in my header.jsp, the image file has to be physically located in each module or I get a broken link. 2) The pagePattern and forwardPattern are defined on the controller which means all tag or forward URLs for the module will be mapped to the same context relative URL. I think it would be more flexible if you simply specified the pattern as part of the URL attribute for the tag or forward. For example: html:img alt=get an image from the default module page=$P/header.gif/ and html:img alt=get an image from the current module page=$M$P/module.gif/ 3) The examples don't effectively demonstrate the effects that the contextRelative, inputForward, pagePattern, and forwardPattern attributes have on the page, forward, action, and href attributes. 4) The examples only show how to switch from one self-contained module to another. They don't demonstrate how to combine resources/pages from multiple modules into a single page via either includes or tiles/templates. Thanks, Nathan. -Original Message- From: Hohlen, John C [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 8:20 AM To: Struts-User (E-mail) Subject: Configuring Tiles + Validation + Modules I'm looking for some help on how to configure the Tiles and Validation Plug-Ins. A lot of the good books (Struts In Action, Programming Jakarta Struts, etc.) and replies to the mailing list address these topics independently, but not collectively. In addition, I took a look at James Holmes Switching Modules example, but that focuses on the different ways to switch b/t modules, not on how to configure Modules with Tiles and the Validation frameworks. For discussion purposes, let's assume I have following 3 modules (default, modA, modB). Here are my questions: 1) If I have a form bean definition used by all 3 modules, does it need to be defined in each of the 3 struts-config files, or can I just declare it in the default struts-config? 2) Does each modules' struts-config file need the following declaration to use the Validation framework, or can I simply declare this once in the config file for the default module? plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml/ /plug-in 3) For Tile Definition config files, can all of these just be declared in the default struts-config, or should they be declared in the module struts-config they correspond to (assuming you've divided your Tile definitions by module)? For example: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs-default.xml, /WEB-INF/tiles-defs-modA.xml, /WEB-INF/tiles-defs-modB.xml/ /plug-in 4) Can I use the default module's application resource file for text common across modules? Therefore, preventing me from having to duplicate entries across modules. If so, this means Struts always looks in the particular module's application resource first, then the default module. But this doesn't apply for form bean definitions or action mappings, correct? 5) Is the following an acceptable way to configure the application resource files: --- struts-config.xml (default) --- message-resources parameter=Messages null=false/ --- struts-config-modA.xml (default) --- message-resources parameter=Messages-modA null=false/ --- struts-config-modB.xml (default) --- message-resources parameter=Messages-modB null=false/ Thanks in advance for your help, JOHN
Re: Configuring Tiles + Validation + Modules
Hohlen, John C wrote: I'm looking for some help on how to configure the Tiles and Validation Plug-Ins. A lot of the good books (Struts In Action, Programming Jakarta Struts, etc.) and replies to the mailing list address these topics independently, but not collectively. In addition, I took a look at James Holmes Switching Modules example, but that focuses on the different ways to switch b/t modules, not on how to configure Modules with Tiles and the Validation frameworks. For discussion purposes, let's assume I have following 3 modules (default, modA, modB). Here are my questions: 1) If I have a form bean definition used by all 3 modules, does it need to be defined in each of the 3 struts-config files, or can I just declare it in the default struts-config? All modules are independent, so you need to declare form bean definition in each module. You can have a struts-config file containing the common declaration, and use it in each module (with the multi config file capability). 2) Does each modules' struts-config file need the following declaration to use the Validation framework, or can I simply declare this once in the config file for the default module? plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml/ /plug-in You need it for each module. 3) For Tile Definition config files, can all of these just be declared in the default struts-config, or should they be declared in the module struts-config they correspond to (assuming you've divided your Tile definitions by module)? For example: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs-default.xml, /WEB-INF/tiles-defs-modA.xml, /WEB-INF/tiles-defs-modB.xml/ /plug-in You need it for each module. Some module can use different factory, or no definition factory at all. Cedric 4) Can I use the default module's application resource file for text common across modules? Therefore, preventing me from having to duplicate entries across modules. If so, this means Struts always looks in the particular module's application resource first, then the default module. But this doesn't apply for form bean definitions or action mappings, correct? 5) Is the following an acceptable way to configure the application resource files: --- struts-config.xml (default) --- message-resources parameter=Messages null=false/ --- struts-config-modA.xml (default) --- message-resources parameter=Messages-modA null=false/ --- struts-config-modB.xml (default) --- message-resources parameter=Messages-modB null=false/ Thanks in advance for your help, JOHN - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Controller in definitions
Kevin Cramer wrote: I was playing around with this more and if I include the tile with the controller directly in the JSP with the tiles:insert definition= tag then it works. If I use the tiles:insert name= tag which refers to an attribute which dynamically defines the definition / JSP to use then it does not work. What is your exact syntax ? Something like: tiles:insert name=anAttribute with anAttribute referencing a definition associated to a controller should call the controller. Cedric Can this not be done? I would prefer to do it the way I am doing since the tile that is inserted there is specified in a parent tile. Thanks, Kevin On Wed, Mar 26, 2003 at 10:27:23AM -0500, Kevin Cramer wrote: If I put a System.out.println in the perform function, it never shows up in the logs. I'm positive it is not being called but I can't figure out why. I am using definitions and I saw a post from Cedric that you need to use tiles:insert to get it working but I am doing this in my JSP. Any ideas? Thanks, Kevin On Tue, Mar 25, 2003 at 09:54:16PM -0700, David Graham wrote: Well there's only 1 method in the Controller interface: http://jakarta.apache.org/struts/api/org/apache/struts/tiles/Controller.html What happens when you do a System.out... in the controller? David From: Kevin Cramer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Tiles Controller in definitions Date: Tue, 25 Mar 2003 21:50:19 -0500 I'm trying to setup a controller for a Tiles definition. I follow the examples I've seen but it appears that the controller class is not called. I've seen posts here that indicate that you need to use tiles:insert to enable the controller but I'm always using that whenever I include the JSP. Perhaps my use of tile definitions is causing problems? I'm also unsure whether I'm supposed to use the perform() or execute() on the Controller interface. The error I get is that the JSP of the tile with the controller complains that it cannot find the object that I am doing the putAttribute with. The error is on the tiles:importAttribute. I have the following in my tiles-defs.xml: definition name=standardPage path=/WEB-INF/common/layouts/standardLayout.jsp put name=title.key value=title.notDefined / put name=header value=.standardPage.header / put name=content value=NO CONTENT DEFINED / put name=leftvalue=/WEB-INF/common/other1.jsp / put name=right value=standardPage.testcontroller / /definition definition name=.standardPage.header path=/WEB-INF/common/header.jsp put name=headerbar value=standardPage.header.bar/ /definition definition name=standardPage.header.bar path=/WEB-INF/common/bar.jsp put name=left value=NO LEFT DEFINED / put name=right value=NO RIGHT DEFINED / /definition definition name=standardPage.testcontroller path=/WEB-INF/common/testcontroller.jsp controllerClass=mytest.TestAction /definition Here is the testcontroller.jsp: %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-tiles prefix=tiles % tiles:importAttribute name=TEST/ bean:write name=TEST property=value/ Here is the controller class: public final class TestAction extends TilesAction implements Controller { public static final String TEST_KEY = TEST; public ActionForward perform( ComponentContext context, ActionMapping arg1, ActionForm arg2, HttpServletRequest arg3, HttpServletResponse arg4) throws IOException, ServletException { perform(context, arg3, arg4, getServlet().getServletContext()); return null; } public void perform( ComponentContext context, HttpServletRequest arg1, HttpServletResponse arg2, ServletContext arg3) throws ServletException, IOException { MyTestObject test = new MyTestObject(Test Value); context.putAttribute(TEST_KEY, test); } public ActionForward execute( ComponentContext context, ActionMapping arg1, ActionForm arg2, HttpServletRequest arg3, HttpServletResponse arg4) throws Exception { perform(context, arg3, arg4, getServlet().getServletContext()); return null; } } Thanks, Kevin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
Re: Tiles Controller in definitions
Hi, If you use a class as controller, you need to implement the Controller interface, which define only one method: public void perform(ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws ServletException, IOException; So you have to implement this method. Another solution is to extend the ControllerSupport class, which implement the Controller interface. The TilesAction class is a convenience class to be used with a controller URL. Cedric Kevin Cramer wrote: I'm trying to setup a controller for a Tiles definition. I follow the examples I've seen but it appears that the controller class is not called. I've seen posts here that indicate that you need to use tiles:insert to enable the controller but I'm always using that whenever I include the JSP. Perhaps my use of tile definitions is causing problems? I'm also unsure whether I'm supposed to use the perform() or execute() on the Controller interface. The error I get is that the JSP of the tile with the controller complains that it cannot find the object that I am doing the putAttribute with. The error is on the tiles:importAttribute. I have the following in my tiles-defs.xml: definition name=standardPage path=/WEB-INF/common/layouts/standardLayout.jsp put name=title.key value=title.notDefined / put name=header value=.standardPage.header / put name=content value=NO CONTENT DEFINED / put name=leftvalue=/WEB-INF/common/other1.jsp / put name=right value=standardPage.testcontroller / /definition definition name=.standardPage.header path=/WEB-INF/common/header.jsp put name=headerbar value=standardPage.header.bar/ /definition definition name=standardPage.header.bar path=/WEB-INF/common/bar.jsp put name=left value=NO LEFT DEFINED / put name=right value=NO RIGHT DEFINED / /definition definition name=standardPage.testcontroller path=/WEB-INF/common/testcontroller.jsp controllerClass=mytest.TestAction /definition Here is the testcontroller.jsp: %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-tiles prefix=tiles % tiles:importAttribute name=TEST/ bean:write name=TEST property=value/ Here is the controller class: public final class TestAction extends TilesAction implements Controller { public static final String TEST_KEY = TEST; public ActionForward perform( ComponentContext context, ActionMapping arg1, ActionForm arg2, HttpServletRequest arg3, HttpServletResponse arg4) throws IOException, ServletException { perform(context, arg3, arg4, getServlet().getServletContext()); return null; } public void perform( ComponentContext context, HttpServletRequest arg1, HttpServletResponse arg2, ServletContext arg3) throws ServletException, IOException { MyTestObject test = new MyTestObject(Test Value); context.putAttribute(TEST_KEY, test); } public ActionForward execute( ComponentContext context, ActionMapping arg1, ActionForm arg2, HttpServletRequest arg3, HttpServletResponse arg4) throws Exception { perform(context, arg3, arg4, getServlet().getServletContext()); return null; } } Thanks, Kevin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Error
It is hard to say what is wrong without more information ;-). Jasper report an error while it try to convert the jsp page ? Check your jsp for a tiles:put .. tag whith a path attribute, or path as attribute value ... Then, check if your tag has the correct syntax. Cedric Alonso, Damian wrote: Hi Everyone, I am trying to migrate my app to use Tiles (using Struts 1.1 RC 1). I am currently getting the following error trying to load my first page: org.apache.jasper.JasperException: Warning - Tag put : Bad type 'path'. at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 48) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) ... [snip] Does anyone know why this exception occurs?? Thanks in advance, Damian. www.sensis.com.au A leading Australian advertising, information and directories business. www.yellowpages.com.au www.whitepages.com.au www.citysearch.com.au www.whereis.com.au www.telstra.com.au This email and any attachments are intended only for the use of the recipient and may be confidential and/or legally privileged. Sensis Pty Ltd disclaims liability for any errors, omissions, viruses, loss and/or damage arising from using, opening or transmitting this email. If you are not the intended recipient you must not use, interfere with, disclose, copy or retain this email and you should notify the sender immediately by return email or by contacting Sensis Pty Ltd by telephone on [+61 3 9201 4888] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles - Forward - Images/Color not shown
Hi, First of all, when you have a bad page not showing what you expect, check the page source on the client side. Does the page contains the image tags and so on ? Does the page is well formed ? Is there some syntax errors ? Save the page, reload it from the server until you have a correct page. Look for the differences ... If the page is correct, this is a problem with your browser. If not, there is a problem on the server side. Check if all your tiles are inserted as expected. Hope this help, Cedric Bank Kiratisin wrote: Hi all, I have a problem with tiles not shown up. My web application uses struts/tiles on Tomcat 4.1.18. Almost every click on the site submits a form to an Action, which forwards visitors to the next page that consists of multiple main and small tiles. Now the problem is 'sometimes' some tiles (in the same page) don't show up. But when I click refresh button (and of course the browser warns if I want to resubmit the form), the tiles do show up again. It happens often with the images and background color, while the content text shows up normally. Can anyone help me? Ps. I don't know if this is related, but it trends to happen more often when I tested from outside the company network (the application is hosted at the company and it happens less when I tested at the office.) Any help would be greatly appreciated. -- Bank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [tiles] tiles:insert not working for relative path
Hi, When you use Tiles, you should better use absolute paths (relative to the application). This is because you never know from where a tiles is inserted, and so you don't know to what the path is relative with. The only change that can explain the behavior change between 1.1b2 and 1.1RC1 is the internal use of RequestDispatcher.include() instead of PageContext.include(). This later accept relative paths, while the first not. Try to use the latest nightly build instead of the rc1: we have revert to a call to PageContext.include(). So, your application should work again. Let us know the result. Cedric Volker Krebs wrote: Hello, I've just updated our system from struts-1.1b2 to struts-1.1rc1. It seems that tiles:insert page=/ only works for an absolute Path now. tiles:insert page=/path/to/jsp/MyJSP.jsp flush=true/ is working while tiles:insert page=MyJSP.jsp flush=true/ is not working. MyJSP.jsp is in the same Directory the other JSP is. Can anyone confirm that ? I didn't find a bug entry for that. Or has something changed in RC1 ? Thanks. Volker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Is it possible to get a definition name in a layout.jsp
Hi, It is not possible in the actual version to retrieve the definition name. It is an enhancement request for a next version. The workaround is to add an attribute whose value is the definition name. Cedric Raible, Matt wrote: I have the following definition in my tiles-config.xml: definition name=.login extends=baseLayout put name=title.key value=login.title/ put name=heading.key value=login.heading/ put name=content value=/WEB-INF/pages/welcome.jsp/ /definition baseLayout has a path of: definition name=baseLayout path=/layouts/baseLayout.jsp In baseLayout.jsp, is it possible to retrieve the definition's name (i.e. .login). I'd like to use this in my body tag as an id, so after the login definition is rendered, I'll have: body id=.login My reason for wanting this is so I can specify minor CSS tweaks on a per-page basis. This idea was inspired by http://diveintomark.org/archives/2003/01/16/body_ids.html. Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing 'title' to a tile in a frame
Hi, One important thing to remember when you use frames is that each frame is a different page and and that each frame will issue a different request to the server. So, it is not be possible to pass attributes from one frame to another using the request context, or tiles ! You have to find another way to do that, like passing the value as a http parameter of the frame url: frame src=%=request.getContextPath()%tiles:get name=header /?title=%=tiles:get name=title / name=header Cedric Jeff Kyser wrote: hello, all have searched, searched, but no examples, and getting I guess hung up on syntax. Problem: I want to pass the 'title' declared in my tile definition to the 'header' tile, which is itself displayed in a frame. From Cedric's posts and help from Steve Strait, I've gotten the syntax for putting the title into the header in my layout.jsp file: tiles:insert name=header tiles:put name=title beanName=title beanScope=tile/ /tiles:insert And I also see from the tiles examples, the use of frames as: frameset rows=73, *, 73 frame src=%=request.getContextPath()%tiles:get name=header / name=header ... /frameset Can somebody help with the proper syntax for putting these together such that the header frame gets the title? TIA, -jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Ann] Meeting in Paris this Saturday
Hi, For those interested to discuss with me about Struts and Tiles, I will be this Saturday 22 march in Paris at the bookstore Le Monde en 'tique' from 16h to 18h (www.lmet.fr). Cedric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles
Check the struts archive. There is some answer to this question. You can also check for the thread Sell me on Tiles Cedric Nathan Steiner wrote: I am fairly new to struts, and was just getting comfortable with templates, and now must dig into tiles. With tiles, from what I can gather, you can compose your definitions in jsp's and/or tiles-def xml file, and extend them, yada, yada, yada. I guess my question is what are the pros-cons for both? Thanks, Nate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules, is it possible to share tiles template?
A possible workaround: link rel=stylesheet type=text/css href=%=request.getContextPath()%/css/onelook_ie.css Cedric Mark Zeltser wrote: Example: Global Tile: link rel=stylesheet type=text/css href=html:rewrite page='/css/onelook_ie.css'/ Regualar reference, html output: link rel=stylesheet type=text/css href=/sample/css/onelook_ie.css Reference from sub module, html output: link rel=stylesheet type=text/css href=/sample/module/css/onelook_ie.css How to avoid having /module/ as part of URI when referenced from sub module? Thanks, Mark. Mark Zeltser wrote: Hi, Is it possible to share tiles template from submodule? I woudlike to set common look and feel for all sub apps. However, when sub module accesses common tile, all image, stylesheet, etc, referenceses are changed to include sub module as part of the URI. How can I solve this? I tried to use /html:base tag with no success. Env: struts 1.1_b3 tomcat 4.1.8 Thanks, Mark. -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: useAttribute and simple Types
Hi, The useAttribute tag doesn't perform any type conversion. When you specify a classname, the tag will do something like: Classtype varName = (Classtype)request.getAttribute( attributeName ); So, there is no way to specify primitive types. Cedric Alban Soupper wrote: Hi all, Just a little question, is it possible to use a tiles:useAttribute .../ with a value passed as boolean or int values ? If yes, How :) ? Thanks all, Alban. ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager at postmaster.eim.ch. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: useAttribute and simple Types
Maybe we can improve the useAttribute tag to let it convert the primitive types. But I think that it will be only possible to convert primitive types to their corresponding wrappers. You can open a ticket for that in bugzilla if you wish. Even better, you can propose a patch ;-) Cedric Alban Soupper wrote: Thanks, So what it the common use for passing boolean value to tiles: via a String attribute ? Alban. -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: mardi, 18. mars 2003 11:24 To: Struts Users Mailing List Subject: Re: useAttribute and simple Types Hi, The useAttribute tag doesn't perform any type conversion. When you specify a classname, the tag will do something like: Classtype varName = (Classtype)request.getAttribute( attributeName ); So, there is no way to specify primitive types. Cedric Alban Soupper wrote: Hi all, Just a little question, is it possible to use a tiles:useAttribute .../ with a value passed as boolean or int values ? If yes, How :) ? Thanks all, Alban. ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager at postmaster.eim.ch. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager at postmaster.eim.ch. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tile variable in a custom tag
Import the tile attribute in one of the jsp scope: tiles.importAttribute name=OBJECT_NAME / Then, you can use it in your tag as el expression. If you need to use it as java variable, use tiles:useAttribute name=.../ Check the tag syntax to know more ... Cedric Sloan Seaman wrote: Is there any way to get a variable passed to a tile into a custom tag within that tile? Example: I pass to the tile: tiles:put name=OBJECT_NAME value=node/ and then I want to so something like: pantryLoading:getBarcodeTree name=${OBJECT_NAME} property=nodeList scope=session/ -- Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles context and forwards
Hi, The better reading is the tiles sources ;-). A tile context is created each time a tile is inserted. A tile can be inserted with insert ..., or by a forward clause in a struts action. When the context is created, it is initialized with the definition attribute if any. The tile context is accessible once created. This is trivial to said, but this has some implication: If you specify a struts action as the definition path, the tile context is accessible in the action. If you directly call an action, there is no tile context accessible in the action, even if the action forward to a definition (the context is created at the forward time, i.e. after the action execution). A tile context can be retrieved with: ComponentContext.getContext(Servlet). There is some example in o.a.s.webapps.tiles.*. Hope this help, Cedric Mark Lowe wrote: Anybody know any good reading i can do to better my understanding of how to get one's grubby mitts on the context for a given tile. i.e. how can i forward to a tile? i.e how can i get a tile's context from an action servlet? many thanks mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to change the base tile on the fly
Hi, I have a very simple solution: * Create a struts action that switch to the appropriate layout (a jsp), according to the user settings: action path=/switchLayout type=... forward name=layout1 path=/layouts/layout1.jsp/ forward name=layout2 path=/layouts/layout2.jsp/ forward name=layout3 path=/layouts/layout3.jsp/ /action * Then, use this action in the master definition in place of the layout (path=switchLayout.do ). A better solution would be to be able to do that with a Tiles controller: change the layout path in the controller. Unfortunately, the current tiles implementation doesn't allow to change the path of a tile context. Maybe a future version. Cedric Raible, Matt wrote: The reason I want to do this is to have two totally different skins based on a user's settings. How can I change a baseLayout and all children on the fly? Is it possible - can I just point to a specific tiles-config.xml after they login? I realize this is possible using stylesheets and some fancy CSS, but I'd like to explore doing this using Tiles. Thanks, Matt -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:27 AM To: Struts Users Mailing List Subject: Re: Is it possible to change the base tile on the fly It is possible to change a definition attribute like the path on the fly, but this will not change all the child definitions has you expect. This is because in the actual implementation all definitions have their own copy of the attributes. There is no lookup to the parent value. Cedric Raible, Matt wrote: I have the following base tile definition that all my other definitions extend: definition name=baseLayout path=/layouts/baseLayout.jsp put name=title.key/ put name=heading.key/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ /definition Is it possible to change the path attribute of this definition on-the-fly - perhaps based on a value received in an Action? If so, how? Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Creating SubTabs (Tabs within Tabs)
Affan Qureshi wrote: Hi, I have implemented the TabLayout as described in the examples and works well. I want to define sub tabs under the main Tabs. So my requirement would be like having putList elements inside putList elements(which is not possible in DTD) so that I can define nested lists. How have you implemented this in your apps? You should define one definition for each subtabs. Such definition use the tabsLayout, and define the appropriate list. In the parent tabs, specify the subtabs definition name instead of the url. Also, there exist another tabs layout more adapted to nestedTabs. You can download if from here (http://www.lifl.fr/~dumoulin/howto/nestedTabsLayout.jsp) Looking at the DTD I saw an element putListElements. Where des this fit in? Can this be helpful in this regard? Also can I specify the class by classtype=org.apache.struts.tiles.beans.SimpleMenuItem to something more sophisticated so that I can add some more info? What will I need to change? Yes, you can. Write your class extending or implementing the MenuItem class, specify this class as classtype. You need to disable the xml validation or add your entries in the tiles dtd to be able to read the config file containing your new parameters. Cedric Thanks a lot. Affan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles:definitions extends attribute
The extends attribute refer to a definition in the factory (initialized from the config file). The definitions define directly in a jsp page are not stored in the factory, but in a jsp context, so they can't be found by the extends attribute. This is certainly something to improve, but the ability to define definitions in jsp is not often used. It is usually replaced by the use of an xml config file. Cedric Michael Ruppin wrote: For an exercise, I decided to try using a JSP for my definitions, as opposed to XML. All went fine until I tried to implement a definition with an extends attribute. It works fine in XML, but in a JSP I get:javax.servlet.ServletException: Can't get definitions factory from context. Both my JSP and XML tests used the same struts-1.1-rc1 jars, in Tomcat 4.1.18. Can this not be done? I've never seen an example, but all the documentation I've found indicates this is a valid tag attribute. My war files: http://snow.prohosting.com/mruppin/tilesxml.war http://snow.prohosting.com/mruppin/tilesjsp.war __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: urgent:projecting with tiles
Hi, Tiles allows to build pages dynamically. However, you should not use this functionality all the time ;-). In you r case, you can have a login page, an error page (or more), and other pages. Each page is build by assembling tiles, and by using a common layout, header, footer, ... To each page you can associate an action that do a kind of logic. For example, the action can check the appropriate login. According to the logic result, the action forwards to the appropriate rendering page (here a tile definition containing the appropriate body). But maybe I have miss something in what you are trying to do. Cedric [EMAIL PROTECTED] wrote: Hi, i've an question about tiles.. i would use tiles for my application, but i have an problem. If i use tiles instead of frame but i face this problem: how obtain the definition of page? Example, i have in my application the login page and if an page call the login page i would that the module of login will put into body of this page( manteins header,footer an menu )..for this i append at the all link an parameter that rappresent the definition of page, in an action i use this definition for create an new definition and put the login module in the body. Now i have another problem: if there is an error in a action i would reload the page that call this action and display an error message. But the page not contains the logic, contains only tag that iterate on collection of element passed from preavious action. For this the action that have an error must call the preavious action and not preavious page..my action must know the url for call the preavious action ( path,param and definition of preavious page). For this i add another parameter at all my link, this parameter conteins the preavious url. example of a complect url: pathAction?itsParameterp=nameOfDefinitionOfThisPageu=pathPreaviousAction?itsParameterp=preaviousDefinitionOfPage it's very orrible..but how i know the definition of page and the preavious url if i not add this in the link? i think to save this in session, but first this is very heavy for my server and second if a client save the link and call my page with this savedlink??? i think to use the attribute input in action element, but some page dont't have this ( example action of menage language could call from some jsp...) i think to extends TilesRequestProcessor for adding at request an collection conteins the preavious url and definition, but this function if my client browsing normaly my site..if my client save the url and call my site with this don't work... there is an soluction of this problem?Somebody to explain the tecnics that use in your application for solve these problem? Thanks in advance, Alessio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: modules, tiles and html:form
Hi, I think that the problem comes from the fact that you put the pages belonging to one module under the WEB-INF umbrella. If you move your broken1.jsp to /StrutsIssues/admin/broken1.jsp, and change the definition tile.broken1 accordingly, all work fine: definition name=tile.broken1 extends=layout put name=body value=/admin/broken1.jsp/ /definition The problem is that in your not working solution, the path of the page is /WEB-INF/jsp/admin/broken1.jsp. Struts use this path to determine the module. The default algorithm is 'all page under /admin belong to the admin module'. With your previous path, struts found that your page belong to the default module. It is possible to specify another directory to store the pages of your module. Check struts doc. Hope this help, Cedric James CE Johnson wrote: Hi, I'm having a problem with a combination of modules, tiles and html:form. Hopefully someone out there has a better solution than what I've come up with. The short version of my saga is that html:form in a jsp included as a tile by an action of a sub-application cannot resolve it's 'action' attribute into the appropriate action defined in the sub-application's struts config file. The long version of the saga... (and there's a URL to a tarball of an example of my problem at the bottom) My web.xml specifies two struts configuration files: init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-nameconfig/admin/param-name param-value/WEB-INF/struts-config-admin.xml/param-value /init-param Each of the named config files installs the Tiles plugin. struts-config.xml looks to tiles-definitions.xml while struts-config-admin.xml looks both there and at tiles-definitions-admin.xml. In struts-config-admin.xml I have the following action defined: action path=/broken1 type=org.apache.struts.tiles.actions.NoOpAction forward name=success path=tile.broken1/ /action This, of course, corresponds to the context-relative url /admin/broken1.do. The tile definition for 'tile.broken1' in tiles-definitions-admin.xml is: definition name=tile.broken1 extends=layout put name=body value=/WEB-INF/jsp/admin/broken1.jsp/ /definition Finally, the 'layout' tile is defined in tiles-definitions.xml as: definition name=layout path=/WEB-INF/jsp/layout.jsp put name=title value=Struts Issues / put name=header value=/header.do / put name=footer value=/footer.do/ put name=bodyvalue=/WEB-INF/jsp/blank.jsp / /definition broken1.jsp attempts to create a trivial form thusly: html:form action=/admin/bar.do html:text property=name/ /html:form So, with all of that in place, when i try to access http://localhost:8080/StrutsIssue/admin/broken1.do (using JBoss 3.0.6 by the way) I get a nasty stacktrace telling me: [ServletException in:/WEB-INF/jsp/admin/broken1.jsp] Cannot retrieve mapping for action /admin/bar' javax.servlet.jsp.JspException: Cannot retrieve mapping for action /admin/bar at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:729) at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:501) at org.apache.jsp.broken1$jsp._jspService(broken1$jsp.java:72) etc... Thinking that, perhaps, the jsp thinks it is within the /admin scope (if you'll pardon the misuse of the term), I try again with: html:form action=/bar.do html:text property=name/ /html:form But, as expected, that fails because there is no /bar action defined in the struts-config.xml (only in struts-config-admin.xml) I have a workaround but I don't like it very much. First we return to struts-config-admin.xml with a new pair of actions: action path=/working type=org.apache.struts.tiles.actions.NoOpAction forward name=success path=tile.working/ /action action path=/workingView type=org.apache.struts.tiles.actions.NoOpAction forward name=success contextRelative=true path=/WEB-INF/jsp/admin/working.jsp/ /action I don't like this for two reasons: 1) I have to define two action paths for every action 2) I now have an action path that directly forwards to a jsp rather than handling all of that with tiles tiles-definitions-admin.xml picks up the new tile.working definition so that the defined layout will be pleased: definition name=tile.working extends=layout put name=body value=/admin/workingView.do/ /definition I don't like this because now my tiles have knowlege of the sub-application's context. Ideally, the '/admin' partial-path should only be known to web.xml. And the working.jsp is: html:form action=/bar.do html:text property=name/ /html:form The only thing I really like about the solution is that the working.jsp references the action path within the scope of the /admin module. I'm using struts 1.1-RC1 BTW. A simplified and fully working example of my problem is here:
Re: Anyone using tiles with pager tag lib?
Hi, When you hit a page through a struts action, the action is executed, then the request is forwarded to the associated page or tiles. The jsp spec specify that when you do a forward, the requestURI is change accordingly. This is why you get the URL of the tiles layout instead of the action URL. In fact, Tiles framework try to respect the struts way by doing forward (instead of include) as long as it is possible. A trick is to let think the tiles request processor that it should do an include instead of a forward. For that, you should put an empty tileContext in the request. I join an action that do exactly that. You should use this action with the struts action used to associate an URL to a tiles definition defining a page. You should avoid to use it with action used as included tiles. action path=/showRequestURI type=org.apache.struts.webapp.tiles.test.NoForward forward name=successpath=test.action.noforward/ /action Hope this help, Cedric --- package org.apache.struts.webapp.tiles.test; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.ComponentDefinition; /** * Implementation of strongAction/strong that create a TileContext in order * to force the TilesRequestProcessor to do an include instead of a forward. * The side effect is that request.getRequestURI will return the URL of the * calling struts action instead of the URL of the tiles layout. * See the jsp documentation to understand why. * Usage: * use this action in conjunction with an action declaration in struts config. * The action declaration should have one success forward to a Tile. * pre * action path=/showRequestURI *type=org.apache.struts.webapp.tiles.test.NoForward *forward name=successpath=test.action.noforward/ * /action * /pre * @author Cedric Dumoulin * @version $Revision: 1.2 $ $Date: 2002/11/16 04:58:47 $ */ public final class NoForward extends Action { // - Public Methods /** * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if the application business logic throws * an exception * @since Struts 1.1 */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Try to retrieve tile context ComponentContext context = ComponentContext.getContext( request ); if( context == null ) { // Not found, create a context // This context will be detected by the TilesRequestProcessor which will do an include // instead of a forward. ComponentContext tileContext = new ComponentContext( ); ComponentContext.setContext( tileContext, request); } return (mapping.findForward(success)); } } - Laker Shen wrote: The reason is that tiles mess up with the request url. Pager rely on %= request.getRequestURI() % to build the url for next page. Tiles always point the request URI to be the layout.jsp. Before the url for next page is: SearchResult.jsp?pager.offset=10, now it is: tiles/layout/mainLayout.jsp?pager.offset=10 That's why it's not working. What should I do? Tiles is nice, but did cause so many troubles. From: Laker Shen [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Anyone using tiles with pager tag lib? Date: Tue, 11 Mar 2003 22:14:36 + Have trouble to use tiles with pager tag lib (from jsptags.com). Anyone uses this two together? Is there a way to fix it? Thanks. When I clicked the next on my search result page: org.apache.jasper.JasperException: Error - tag.getAsString : component context is not defined. Check tag syntax at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter
Re: Is it possible to change the base tile on the fly
It is possible to change a definition attribute like the path on the fly, but this will not change all the child definitions has you expect. This is because in the actual implementation all definitions have their own copy of the attributes. There is no lookup to the parent value. Cedric Raible, Matt wrote: I have the following base tile definition that all my other definitions extend: definition name=baseLayout path=/layouts/baseLayout.jsp put name=title.key/ put name=heading.key/ put name=header value=/common/header.jsp/ put name=footer value=/common/footer.jsp/ /definition Is it possible to change the path attribute of this definition on-the-fly - perhaps based on a value received in an Action? If so, how? Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested and Tiles taglibs together
Hi Chris, Chris Butler wrote: So, I've been using struts for a while... even back when Tiles used to be called Components. :-) I'm pretty impressed with how far things have come and how useful the framework is... Anyway, I'm new to using nested tags and am trying to use them in combination with Tiles. The goal I have is to iterate over a bunch of questions, each question which has its own layout. For now, ignore how the layout switch is handled - I'm more concerned about passing nested context between tiles if it's possible. (I've actually accomplished the switch via a logic:equals sort of hack for the time being rather than pre-loading any data in a tiles controller. Why this works with a tiles:insert, I'm not sure since one would think it would have flush-from-within-a custom-tile issues as well.) First pass (without swapped layout): nested:iterate property=questions scope=request nested:nest property=question nested:write property=questionText /br / nested:hidden property=questionId /br / !-- insert answers here later -- /nested:nest /nested:iterate What I would like to do in concept: *** questions.jsp nested:iterate property=questions scope=request tiles:insert attribute=questionLayout flush=false/ /nested:iterate *** questionLayout.jsp nested:nest property=question nested:write property=questionText /br / nested:hidden property=questionId /br / !-- insert answers here later -- /nested:nest Problems I've had: 1. Tiles flush = false I'm using JBoss 3.2.0RC1 w/Jetty - the Tiles flush tag doesn't seem to work or Jetty mishandles it. I know we're fighting against the JSP 1.1 spec. Symptom: The flushed tile HTML appears first, the containing JSP HTML after There is a ticket opened in bugzilla for this issue.You can try the proposed patch, and vote for it. 2. Losing nested context Once I do the tiles:insert, I lose the nested context. I need to be able to generate the problem index for each question in the form. This should look something like: questions[0].question.questionId= questions[1].question.questionId= I don't know how nested is implemented, but it looks like it store its context in the page scope. Need to be in the request scope to work with Tiles Thoughts: 1. When will Struts move to support JSP 1.2? It's been around for a long time now. In fact, isn't JSP 1.3 out there as well? It is jsp1.2 2. Is there any good documentation on Tiles and Nested in combination? So far, I've been to a lot of the struts resources without much luck. I don't know about any documentation for Tiles/nested. Any help is welcome. Cedric 3. I love the concept of Tiles controllers. These are fantastic for moving a Tile around a webapp solely by referencing it via the JSP/tiles defs. Is there anyway to leverage this concept in relation to my desired objectives? Thanks loads - any tips or even possible approaches would be fantastic. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Design - Overriding putList items
Hi, Affan Qureshi wrote: I have divided the modules(logical) in my application in a Tab layout. I want to show different pages under the same tab at various points in the application. It means the putList items change all the time. If I want to extend and override the values inside the putList tags I have to write the whole putList tag again in the extended definition. Is this right or is there a better way? It is right, the list itself is not extended ;-(. This is an enhancement request. I am not sure if it is already in bugzilla.Feel free to add it or vote for it. I have created a bean in which I keep values for links to display in each tab and modify them at runtime in my Action classes. I put that bean in session and copy its properties to the TilesContext in the controllerClass actions. The problem is that this design is not very easy to maintain and enhance. Also I get the values mixed up in the session which makes the user go to a wrong page sometimes. And the layout code is all over the place instead of a single, configurable one (like the XML file). Is this the right design I have? Any suggestions/solutions? In tiles examples I use the following for a user customized menu: * A definition contain the attributes for the menu, with a list of default items to show. * The controller try to retrieve a customized list of items (from the session, but could be from a persistent storage) o If the list isn't found, get the one defined in the tile context from the definition, copy it and store it appropriately in the session. So, the list in the definition is used to initialize the default values ! * Replace the list in the tile context with the customized one * Return from the controller and show the tile In this scenario, the definition is used to defined the default values. So, the management still centralized in the xml file. The controller is used to prepare appropriately the data to show. Hope this help, Cedric Thanks a lot, Affan PS My Tiles Code below: This is my basic/default definition: definition name=index.page path=/webpages/layouts/tabsLayout.jsp controllerClass=com.etilize.cms.web.actions.LayoutProcessorAction put name=title value=MyAppName/ put name=header value=/webpages/header.jsp/ put name=footer value=/webpages/footer.jsp/ put name=selectedIndex value=0/ put name=parameterName value=selected/ putList name=tabList item value=Home link=/webpages/home.jsp classtype=org.apache.struts.tiles.beans.SimpleMenuItem/ item value=Taxonomy link=/webpages/template.jsp classtype=org.apache.struts.tiles.beans.SimpleMenuItem/ .. item value=Search link=/webpages/search.jsp classtype=org.apache.struts.tiles.beans.SimpleMenuItem/ /putList /definition In actions i have the following code to set the values in the session bean: LayoutSettings settings = (LayoutSettings)req.getSession(true).getAttribute(WebAppConstants.TAB_LAYOUT _SETTINGS); List tabList = settings.getTabList(); SimpleMenuItem searchTab = (SimpleMenuItem)tabList.get(3); searchTab.setLink(returnLink); tabList.set(3,searchTab); settings.setTabList(tabList); req.getSession(true).setAttribute(WebAppConstants.TAB_LAYOUT_SETTINGS,settin gs); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Localization Using Extended Tiles Definitions
Hi, Paul Hodgetts wrote: Should I be able to do the following localization using extended tiles definitions? In tiles-defs.xml: tiles-definitions definition name=.page.base page=/default-layout.jsp put name=header value=/header.jsp/ put name=footer value=/footer.jsp/ /definition definition name=.page.index extends=.page.local put name=content value=/index-content.jsp/ /definition definition name=.page.cart extends=.page.local put name=content value=/cart-content.jsp/ /definition /tiles-definitions You need a .page.local definition in this file too. This file is used as default when the locale can't be resolved. In your case, when the locale is not de_DE. So, this file must be able to be fully resolved by itself. In tiles-defs_de_DE.xml: tiles-definitions definition name=.page.local extends=.page.base put name=menus value=/menus_de_DE.jsp/ /definition /tiles-definitions This is ok. When the locale is de_DE, this definition will be used in place of the definition with the same name in the default config file. In other words, there is a common base page across all the locales. Each local adds a locale-specific menu to every page. Then there are the variety of specific pages that add their unique content. Does this make sense? Yes, in your localized files, just rewrite the definition that need to be rewritten. Is this the right way to do this, or is there some other way to accomplish this? This is the right way to do, but don't forget that you need a default configuration file. This later should be fully resolvable when it is read by the definition factory. This mean that all ancestor definitions must be accessible in the file, or in one of the file specified in the factory config. In Tiles, there is one factory for each matching locale (a matching locale = there exist a file with appropriate suffix for the locale). The factory is loaded when the locale is encountered. File loading follow the java i18n rule: The default file is loaded, then it is overloaded by files with the same name and a local matching i18n suffix. Cedric Right now, I'm getting an error saying that it can't find a definition for .page.local, but I may be doing something else wrong. Thanks, Paul - Paul Hodgetts -- Principal Consultant Agile Logic -- www.agilelogic.com Consulting, Coaching, Training -- On-Site Out-Sourced Development Java, J2EE, C++, OOA/D -- Agile Methods/XP/Scrum, Use Cases, UI/IA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to catch exception using tiles thrown by e.g. org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude
Hi, This design have been chosen in order to not penalize an entire page when only one tile fail. With this design, the page is shown correctly, and the faulty tile report an error. What is missing in this design is a way to customize what should happen in case of error. This is an enhancement request to be added to bugzilla (or vote for it if it already exist). Cedric Jörg Maurer wrote: Wondering why i have no chance to catch any exception i did some investigation on that topic , so i consulted the java logic of your insert tag. it is that ~good~ shielded against any exception bubbling, that my own error handler logic never gets a chance because ALL EXCEPTIONS HAVE BEEN CAUGTH AND NEVER RETHROWN. next is snip from your Insert Tag(commented out is your code, underneath that is what i want - throw new JspException(ex.getMessage())) : } catch (ServletException ex) { Throwable realEx = ex; if (ex.getRootCause() != null) { realEx = ex.getRootCause(); } //processException( // realEx, // [ServletException in: + page + ] + realEx.getMessage() + '); throw new JspException(ex.getMessage()); } catch (Exception ex) { //processException(ex, [Exception in: + page + ] + ex.getMessage()); throw new JspException(ex.getMessage()); } finally { // restore old context // done only if currentContext not null (bug with Silverstream ?; related by Arvindra Sehmi 20010712) if (currentContext != null) pageContext.setAttribute( ComponentConstants.COMPONENT_CONTEXT, currentContext, pageContext.REQUEST_SCOPE); } return EVAL_PAGE; Looking at Geary´s template insert tag, he always chose to do throw new JspException(ex.getMessage());. Your logic displays by default a simple stack trace(Exception type and exception message) of where the tile should be. I dont want to show that to my customer, but as i said, i have no change to display my jsp-error page instead. So if that feature is not here for any other reason, i consider that being a unlucky design for me, because i have to at least vesion my own tiles.jar or do some dirty subclassing your tag. I would appreciate your comment. Greets Jörg -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Donnerstag, 06. März 2003 11:57 To: Struts Users Mailing List Subject: Re: how to catch exception using tiles thrown by e.g. org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude Jörg Maurer wrote: Cedric exactly as you said, insert is used. despite the big try-catch block approach, its unclear to me why error-page in web.xml doesn#t get a try. Additionally i searched for similar behaviour and all i found was following page 52 of the JSP 1.2 spec : Note: if autoFlush=true then if the contents of the initial Jsp- Writer has been flushed to the ServletResponse output stream then any subsequent attempt to dispatch an uncaught exception from the offending page to an errorPage may fail. When an error page is also indicated in the web.xml descriptor, the JSP error page applies first, then the web.xml page.. You as a more experienced one than myself, does it make some sense to the issue? This make sense: Your page is made of several tiles. The first ones have already been compute, and so some outputs have been flushed. Then, one of the insert .. throw an exception. This exception is not catched by the jsp mechanism because the output stream has already been flushed ... Cedric -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Dienstag, 04. März 2003 18:35 To: Struts Users Mailing List Subject: Re: how to catch exception using tiles thrown by e.g. org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude I suppose that your exception is thrown by a tiles:insert ... tag in a jsp. This exception is thrown by the tiles framework, which know nothing about the struts exception mechanism, so it can't be used. The exception is then propagated by the tag handler and reach the jsp page (the tile jsp). If there is an exception handler associated to the jsp, it is called, if there is no handler, the exception is propagated to parent page inserting this one. If the parent page have inserted the child page with an insert ..., then the insert catch the exception and show it. Normally, the jsp exception handling should work, but it appear that it is not always the case. A workaround is to put a big try/catch in the jsp throwing the exception ;-(. This will be improved in future versions. Cedric Jörg Maurer wrote: Hi struts people! I have really defined everywhere i think i can put an exception handler for servlet exception : 1.) in my base layout.jsp an %@ errorPage='/pages/common/error/errorsGeneralHandler.jsp'% 2.) in struts config a global
Re: Struts-Tiles causes charset problem!!!
So you have a encoding type problem on the server side. This is not related to Tiles because you have the same problem with jsp:include. Have you try to specify the encoding in each faulty jsp: % page pageEncoding ..%. You can also specify the encoding of the tiles-config.xml file: ?xml version=1.0 encoding=ISO-8859-1 ? Hope this help, Cedric Eric Chow wrote: Hi Cedric, The returned page has appropriate encoding tag. Eric - Original Message - From: Cedric Dumoulin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 7:05 PM Subject: Re: Struts-Tiles causes charset problem!!! Check if the returned page (the page source in the browser) has the appropriate encoding tag. The page encoding is usually set in your template.jsp file. Cedric Eric Chow wrote: Hi, I want to display some Chinese in JSP(Customer Tag). If my JSP as following: (showChineseContent.jsp) === % page language=java contentType=text/html % % taglib uri=/WEB-INF/tld/test.tld prefix=test % % taglib uri=/WEB-INF/tld/share.tld prefix=share % html head meta http-equiv=content-type content=text/html; charset=UTF-8 meta HTTP-EQUIV=Pragma CONTENT=no-cache titleChinese Form/title link rel=stylesheet href=css/myapp.css /head body table border=0 width=100% align=center cellspacing=2 cellpadding=2 test:chineseFormList tr thID/th thName/th /tr share:list tr tdtest:chineseFormInfo property=messageID//td tdtest:chineseFormInfo property=name//td /tr /share:list /test:chineseFormList /table /body /html The above JSP works very well, I can retrieve those Chinese from database and display them correctly. After I change it to use Tiles as a template as following: tiles-def.xml = definition name=showChineseLayout path=template.jsp put name=title value=Test Chinese / put name=content value=showChineseContent.jsp / /definition in my showChinese.jsp === tiles:insert definition=showChineseLayout flush=true / After changed to tiles, everything is wrong, all the Chinese displayed as some QUESTION-MARKS ! Is there any problem in Tiles? And, I tried to use jsp:include page=showChineseContent.jsp flush=true/ instead of Tiles, it also not worked. Any idea on it? Best regards, Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles and appending request parameters
Hi, Brandon Goodin wrote: Thanks, let me provide a more real world example and see what you would do. - I have a menu that is customized according to the user. - I have a tile that displays the menu data. - I have a layout that has a tiles:insert name=menu - In my tiles-defs.xml I give the following definition for the menu insert. definition name=main path=/layouts/mainlayout.jsp put name=menu value=tile.menu type=definition/ /definition definition name=tile.menu controllerUrl=/do/menu/ - The tile.menu contollerUrl needs to retrieve the userid from the original action that called the mypage definition. Since the tile.menu definition spawns it's own request I assume it does not have access to the request of the parent page. Therefore, I was wondering if there is a way to pass the userId down into the request that is spawned by the controllerUrl. Tiles use RequestDispatcher.include() to include a tile or call a controller. The original request is accessible in all the included tiles or controller. So, you can access the userId. Here is a step through of the process I envision request - Action - page that contains controllerUrl tile definition - menu tile calls controllerUrl Action - (Here is where I want to pass parameters into the request spawned by the controllerUrl) Here you retrieve the userId, and create the appropriate user menu. There is several solutions: * set a tile attribute to a predefined menu definition * create dynamically a list of menu entry * ... Action does it's magic - Action returns a page with a menu customized to a particular user. The action forward to the menu tile which retrieve the appropriate attribute and show it as a menu ... Check the example in struts-documentation/example: there is a user customizable menu. This menu is set in a controller according to what the user has chosen. The corresponding definition is in tiles-examples-def.xml (examples.userMenu). Cedric Thanks for your help. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 4:06 AM To: Struts Users Mailing List Subject: Re: Tiles and appending request parameters Hi, I think that the problem is not related to the Tiles. What you want is to be able to add a request parameter to the current requestResponse. When Tiles include the controller via its url, is simply do an include, and doesn't modify the requestResponse object. So, you still have all the http parameters that are associated to the request. You can yourself modify the requestResponse object in your action before inserting the tiles. Check the jsp and servlet spec to know if it is possible to add an http parameter. Personally I use to pass such extra parameters in the request context or Tile context rather than a new http parameter. Hope this help, Cedric Brandon Goodin wrote: Hey all, I have asked this question in the past and have lived with the limitation of not being able to do it. The only reason why I ask now is that I recently gave a quickstart presentation on tiles and wasn't sure if somethin had been added to remedy the problem. So, I wanted to pose it again to see if there has been an enhancement that supports it or there is a viable workaround that can produce the same results (without scriplets). I have a layout that has an insert that uses the controllerUrl attribute. I want to append a parameter to the controllerUrl. Is this possible yet? For example: I have this definition: definition name=tile.weather path=/layouts/weather/weatherlayout.jsp controllerUrl=/do/weather/ When the page renders I want to attach the following request paramters to the controllerUrl value: ?weatherStationID=KFCA So that the controllerUrl ultimately calls: ... controllerUrl=/do/weather?weatherStationID=KFCA ... The parameters will be supplied by the action that called the parent layout. This is not a realworld example. It is just a simple illustration. Please do not send me alternate approaches. I just want to know if dynamic parameter appending is possible with tiles. Thanks all. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Beginner Tiles Problem
Kuzminski, Nicolas wrote: Besides, any one knows if it's posible to have an url association with tiles definitions, as we have with actions and, for example, /*.do urls? It would be great to have, let's say, /*.def requests You can post an enhancement request in bugzilla ;-) Cedric Saludos, Nicolas. -Original Message- From: Kuzminski, Nicolas Sent: Martes, 04 de Marzo de 2003 17:30 To: Struts Users Mailing List Subject: RE: Beginner Tiles Problem The problem is, you can't use a definition as a plain forward. It does not work as a url. Try this instead: action path=/go type=org.apache.struts.tiles.actions.DefinitionDispatcherAction parameter=def forward name=successpath=/ok/ forward name=error path=/err/ /action (those two forwards are required, don't know why) And redefine the forward: forward name=welcome path=/go.do?def=my.default redirect=false/ So now you have a real url that points to a definition: /go.do?def=anydef. Saludos, Nicolas. -Original Message- From: White, Joshua A (CASD, IT) [mailto:[EMAIL PROTECTED] Sent: Martes, 04 de Marzo de 2003 17:28 To: [EMAIL PROTECTED] Subject: Beginner Tiles Problem I have successfully set up tiles using a tiles-def.xml file. In this file, I have set up a definition for my.default. I have been successfully able to view this layout by inserting the following code into a jsp: %@ taglib uri=struts-html prefix=html% %@ taglib uri=struts-bean prefix=bean% %@ taglib uri=struts-tiles prefix=tiles% tiles:insert definition=my.default/ Again, this works fine. I have been attempting to declare a global forward mapping for the same layout: global-forwards forward name=welcome path=my.default redirect=false/ /global-forwards I have inserted the following code into a jsp file to test the forwards: %@ taglib uri=struts-logic prefix=logic% logic:forward name=welcome/ When I hit the page containing this code, Tomcat gives me a 404 (The requested resource (/myapp/my.default) is not available.). Whats happening here? Joshua This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] AVISO DE CONFIDENCIALIDAD. Este mensaje y la información incluída en él es confidencial y está dirigida únicamente al destinatario. Puede contener información privilegiada, confidencial, amparada por el secreto profesional y/o que no deba ser revelada. Si Usted ha recibido este mail por error, por favor comuníquenoslo inmediatamente via e-mail y tenga la amabilidad de eliminarlo de su sistema. Queda notificado que no deberá copiar este mensaje ni utilizar, divulgar, publicar o distribuir su contenido de modo alguno. Todo mensaje enviado a esta dirección de correo electrónico puede ser sujeto a inspección por alguien distinto de su receptor originario. Muchas gracias. CONFIDENTIALITY NOTICE. The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to this message and then delete it from your computer. All e-mail sent to this address will be received by the Meridian Financial S.A and/or Providian Bank S.A corporate e-mail system and is subject to archiving and review by someone other than the recipient. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Basic Tiles question
Hi, A tile attribute is only visible in its tile, not in its parent, not in the sub tiles. You should pass the attribute explicitly from the current tile to the inserted tile, or put the value in the request context: tiles:insert attribute=header tiles:put name=title beanName=title beanScope=titles / tiles:insert/ Cedric Steve Stair wrote: How do I get the contents of a variable which is clearly available inside the layout file to be available inside a tile? In my layout file, I can have something like tiles:getAsString name=title/ which works just fine. If I put the same tag in a tile, I get this error message: [ServletException in:/tiles/test.jsp] Error - tag.getAsString : attribute 'title' not found in context. Check tag syntax' -- Steve Stair - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles problems (Building complex pages)
Fabio Mancinelli wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tue, 4 Mar 2003, Cedric Dumoulin wrote: Hi, It looks like your unlucky using Tiles ;-). Thank you for your answers. I admit that some of my questions were a bit brain-damaged :) Anyway passing a definition to the vboxLayout via the add beanName=.../ doesn't work because all the passed attributes are inserted in the vboxLayout by using a insert name=.../ I made it work by modifying the vboxLayout in this way: ... % Iterator i = list.iterator(); while(i.hasMoreElement()) { String name = (String)i.next(); % logic:present name=%= name % %--A bean is present with the attribute name so it should be a definition--% tiles:insert beanName=%= name %/ /logic:present logic:notPresent name=%= name % %--Standard tiles insertion-- tiles:insert name=%= name %/ /logic:notPresent % } % So, when I insert that tile I alway use add name=.../ regardless if I am passing a definition (local or tile-config defined) or a path to another tile.This is necessary, I think, because add beanName doesn't work at all. Do you think this is a reasonable solution? I think this is a good solution. Cedric However this solution fails for adding normal strings, but I agree with you (Cedric) that you should not compose body tiles with a list of small strings packed in a vboxLayout! :) So the lack of support for normal strings isn't really an issue! A presto, Fabio - -- - - Fabio Mancinelli, PhD student EMail : [EMAIL PROTECTED] Dipartimento di Informatica WWW : http://www.di.univaq.it/~mancinel Universita' dell'Aquila - - -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE+ZRG96dsQbk2R3cMRAhwpAKDE6JedQaXKz6I4sg4SjMVovJ2OOgCfb1HE URKleHqTlaYkxtJS5p7izZg= =PdU8 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to catch exception using tiles thrown by e.g. org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude
Jörg Maurer wrote: Cedric exactly as you said, insert is used. despite the big try-catch block approach, its unclear to me why error-page in web.xml doesn#t get a try. Additionally i searched for similar behaviour and all i found was following page 52 of the JSP 1.2 spec : Note: if autoFlush=true then if the contents of the initial Jsp- Writer has been flushed to the ServletResponse output stream then any subsequent attempt to dispatch an uncaught exception from the offending page to an errorPage may fail. When an error page is also indicated in the web.xml descriptor, the JSP error page applies first, then the web.xml page.. You as a more experienced one than myself, does it make some sense to the issue? This make sense: Your page is made of several tiles. The first ones have already been compute, and so some outputs have been flushed. Then, one of the insert .. throw an exception. This exception is not catched by the jsp mechanism because the output stream has already been flushed ... Cedric -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Dienstag, 04. März 2003 18:35 To: Struts Users Mailing List Subject: Re: how to catch exception using tiles thrown by e.g. org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude I suppose that your exception is thrown by a tiles:insert ... tag in a jsp. This exception is thrown by the tiles framework, which know nothing about the struts exception mechanism, so it can't be used. The exception is then propagated by the tag handler and reach the jsp page (the tile jsp). If there is an exception handler associated to the jsp, it is called, if there is no handler, the exception is propagated to parent page inserting this one. If the parent page have inserted the child page with an insert ..., then the insert catch the exception and show it. Normally, the jsp exception handling should work, but it appear that it is not always the case. A workaround is to put a big try/catch in the jsp throwing the exception ;-(. This will be improved in future versions. Cedric Jörg Maurer wrote: Hi struts people! I have really defined everywhere i think i can put an exception handler for servlet exception : 1.) in my base layout.jsp an %@ errorPage='/pages/common/error/errorsGeneralHandler.jsp'% 2.) in struts config a global exception handler global-exceptions exception path=pages/common/error/errorsGeneralHandler.jsp type=javax.servlet.ServletException/ /global-exceptions 3.) in web.xml error-page exception-typejavax.servlet.ServletException/exception-type location/pages/common/error/errorsGeneralHandler.jsp/location /error-page Still ServletException slip through my guards. Last know point as stack trace shows below is org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilS t rutsModulesImpl.java:122) , which throws ServletException but is never catchable to me. The point is not the FileNotFound, which is pretty clear to me, but why such exception doesn´t hit any of my error handler. Any hints appreciated! 2003-03-04 12:36:06 ApplicationDispatcher[] Servlet.service() for servlet jsp threw exception javax.servlet.ServletException: /pages/wf_category/pager_region.jsp at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWr a pper.service(IDEJspServlet.java:183) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFi l e(IDEJspServlet.java:246) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJ s pServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispat c her.java:683) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDis p atcher.java:574) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispa t cher.java:497) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.j a va:819) at org.apache.jsp.wf_0005fcategory_0005fchoose$jsp._jspService(wf_0005fcat e gory_0005fchoose$jsp.java:107) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWr a pper.service(IDEJspServlet.java:173) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFi l e(IDEJspServlet.java:246) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJ s pServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispat c her.java:683
Re: Struts-Tiles causes charset problem!!!
Check if the returned page (the page source in the browser) has the appropriate encoding tag. The page encoding is usually set in your template.jsp file. Cedric Eric Chow wrote: Hi, I want to display some Chinese in JSP(Customer Tag). If my JSP as following: (showChineseContent.jsp) === % page language=java contentType=text/html % % taglib uri=/WEB-INF/tld/test.tld prefix=test % % taglib uri=/WEB-INF/tld/share.tld prefix=share % html head meta http-equiv=content-type content=text/html; charset=UTF-8 meta HTTP-EQUIV=Pragma CONTENT=no-cache titleChinese Form/title link rel=stylesheet href=css/myapp.css /head body table border=0 width=100% align=center cellspacing=2 cellpadding=2 test:chineseFormList tr thID/th thName/th /tr share:list tr tdtest:chineseFormInfo property=messageID//td tdtest:chineseFormInfo property=name//td /tr /share:list /test:chineseFormList /table /body /html The above JSP works very well, I can retrieve those Chinese from database and display them correctly. After I change it to use Tiles as a template as following: tiles-def.xml = definition name=showChineseLayout path=template.jsp put name=title value=Test Chinese / put name=content value=showChineseContent.jsp / /definition in my showChinese.jsp === tiles:insert definition=showChineseLayout flush=true / After changed to tiles, everything is wrong, all the Chinese displayed as some QUESTION-MARKS ! Is there any problem in Tiles? And, I tried to use jsp:include page=showChineseContent.jsp flush=true/ instead of Tiles, it also not worked. Any idea on it? Best regards, Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles and appending request parameters
Hi, I think that the problem is not related to the Tiles. What you want is to be able to add a request parameter to the current requestResponse. When Tiles include the controller via its url, is simply do an include, and doesn't modify the requestResponse object. So, you still have all the http parameters that are associated to the request. You can yourself modify the requestResponse object in your action before inserting the tiles. Check the jsp and servlet spec to know if it is possible to add an http parameter. Personally I use to pass such extra parameters in the request context or Tile context rather than a new http parameter. Hope this help, Cedric Brandon Goodin wrote: Hey all, I have asked this question in the past and have lived with the limitation of not being able to do it. The only reason why I ask now is that I recently gave a quickstart presentation on tiles and wasn't sure if somethin had been added to remedy the problem. So, I wanted to pose it again to see if there has been an enhancement that supports it or there is a viable workaround that can produce the same results (without scriplets). I have a layout that has an insert that uses the controllerUrl attribute. I want to append a parameter to the controllerUrl. Is this possible yet? For example: I have this definition: definition name=tile.weather path=/layouts/weather/weatherlayout.jsp controllerUrl=/do/weather/ When the page renders I want to attach the following request paramters to the controllerUrl value: ?weatherStationID=KFCA So that the controllerUrl ultimately calls: ... controllerUrl=/do/weather?weatherStationID=KFCA ... The parameters will be supplied by the action that called the parent layout. This is not a realworld example. It is just a simple illustration. Please do not send me alternate approaches. I just want to know if dynamic parameter appending is possible with tiles. Thanks all. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Urgent, TilesRequestProcessor
Hi, If you use Tiles, and want to extends the RequestProcessor, you need to extend the TilesRequestProcessor. This later extends the RequestProcessor, so you transitively extends it also. The TilesRequestProcessor purpose is to catch the definition names used in urls. If a struts url (like forward=) is a definition, then this definition is inserted in place of the url. The TilesRequestProcessor doesn't interfere with other functionalities provided by the original processor. To understand exactly what happen, you can check the RequestProcessor workflow (defined in the process() method). This will help to understand. Cedric [EMAIL PROTECTED] wrote: Hi, i've a problem with TilesRequestProcessor; i insert in my struts-config.xml the definition of my classes: controller processorClass=struts.requestP / and requestP extends TilesRequestProcessor (i don't understand whi if i use tiles plug-in i don't exstend RequestProcessor..) in this class i overload the processPreprocess and processForwardConfig methods, now if i call an jsp page this processor dont't work (i use System.out for see if it work..), it's work if i use TilesAction...whi? example of my page: %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % tiles:insert definition=base flush=true controllerUrl=/til.do / and in my struts-config.xml: action type=struts.tilesA path=/til forward name=success path=mainLayout/ /action in my tiles-defs.xml: definition name=base path=/tilesLayout/baseLayout.jsp put name=page value=baseEstesa / put name=title value=prova.titolo / put name=header value=/tilesLayout/header.jsp / put name=body value=/tilesLayout/body.jsp / put name=menuI value=/tilesLayout/menuI.jsp / put name=footer value=/tilesLayout/footer.jsp / /definition in this case i use an TilesAction and i see the System.out from my processor(my processor work),but if i don't use the TilesAction: %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % tiles:insert definition=base flush=true / the processor don't work...whi? Thanks, Alessio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unable to access title attribute in Tiles under layout (1.1-rc1)
Hi, Once again ;-) : The attributes of a tile are only accessible from this tile, not from its sub- tiles or its parent. Attributes of a tile are like parameters of a method: they are only visible in this method. It is why you can't access the title attribute owned by the layout from the header tile. To access it, you need to pass it explicitly to the tile: tiles:insert attribute=header tiles:put name=title beanName=title beanScope=tiles / /tiles:insert Cedric Steve Stair wrote: Inside /layouts/layout.jsp page, I have the following: %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % titletiles:getAsString name=title//title Which works fine, the page title as defined in the tiles defintion file is displayed in the browser's title bar However, when I attempt to use that same title in /tiles/header.jsp %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % h1tiles:getAsString name=title//h1 I get the following error message: [ServletException in:/tiles/header.jsp] Error - tag.getAsString : attribute 'title' not found in context. Check tag syntax' I haven't been able to find an example that does this. So far I've only found an example that statically includes the header file, which somewhat defeats the purpose of using Tiles. My definition looks like this definition name=.app.Base path=/layouts/layout.jsp put name=title value=${title} / put name=header value=/tiles/header.jsp / put name=nav value=/tiles/nav.jsp / put name=messages value=/tiles/messages.jsp / put name=content value=${content} / put name=footer value=/tiles/footer.jsp / /definition -- Steve Stair - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: AW: Tiles Body question
The configuration you propose should work. All example ship with struts are based on this kind of nesting (portal, tabs, menu, ...). The reported exception usually appear when an insert ... is performed inside a tag implementing the BodyTag interface (like insert, iterate, ...). Is there a tag surrounding tiles:insert ... in your memberDetail.jsp file ? Cedric Roland Berger wrote: Hi Cedric Sorry, but I can not find the problem even with the examples. I belive I do it the same way as it is done there. May be you can have a look at the code below: *** tiles-defs.xml snippets *** definition name=.detailLayout path=/WEB-INF/common/layouts/detailLayout.jsp ... /definition definition name=.pages.member.detail.show extends=.detailLayout put name=body value=.pages.member.detail.show.head/ /definition definition name=.pages.member.detail.show.head path=/WEB-INF/pages/memberDetail.jsp put name=bodyHead value=/WEB-INF/pages/memberDetailShowHead.jsp/ /definition involved jsp page snippets File: detailLayout.jsp tiles:insert attribute=body / File: memberDetail.jsp tiles:insert attribute=bodyHead flush=false/ Remark: If I don't set flush to false I get: Can't insert page '/WEB-INF/pages/memberDetailShowHead.jsp' : Illegal to flush within a custom tag java.io.IOException: Illegal to flush within a custom tag at javax.servlet.jsp.tagext.BodyContent.flush(BodyContent.java:115) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja va:817) at Again, the page memberDetailShowHead.jsp is put at the beginning of memberDetail.jsp and not where the tiles:insert attribute=bodyHead flush=false/ tag is. Thank you very much Roland -Ursprüngliche Nachricht- Von: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Gesendet: Montag, 3. März 2003 18:08 An: Struts Users Mailing List Betreff: Re: AW: Tiles Body question The examples in struts-documentation use a master layout (classicLayout.jsp), and the body is often made of tiles inserted with another layout (like columnsLayout, vboxLayout, tabsLayout...). You can easily define your own layout with an insert. It is also possible to insert the definition corresponding to a page inside a nested bodies (see the tabs in the example directory). Maybe I have miss something in what you are trying to do ... Cedric Roland Berger wrote: Yes, that's exactly what I also want to do. But it seems that I missed the big picture. When I set flush=true I get a Illegal to flush error. If I set flush=false the tile I want to insert into the body template is inserted at the top of the page and not where the insert tag is. Can you give a small example with tiles-defs.xml and the JSP Part? ( see also thread: 'tiles insert in sub layout' ) Thanks a lot. Roland. -Ursprüngliche Nachricht- Von: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 22. Februar 2003 14:13 An: Struts Users Mailing List Betreff: Re: Tiles Body question You can have a body acting as a body template which in turn insert other bodies ... Cedric James Prance wrote: In a classic template, the header, footer and menu could be common across your application. However the body would likely change depending on the business process. Is there a way to alter the 'body' value dynamically? I'm a bit confused by this at the moment and my current understanding is that you need a new 'layout' for each differing 'body' page.. is this correct or am i totally arse about face? James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting tiles attributes from a bean in different scopes
BaTien Duong wrote: Thanks Cedric. You save us a day! 3 more items to be sure: 1) Assuming we have *myAttribute* from *myBean* in user session myBean.getLevel2().getMyAttribute(). To use myAttribute as a JSP Java variable, we need: //set an attribute for tile insert tiles:insert attribute=myAttribute / tiles:put name=myAttribute beanName=myBean beanScope=session beanProperty=level2.myAttribute / /tiles:insert This declare a tile attribute initialized from your bean. This attribute can be used in the inserted tile only, not in the current page //declare a Java variable for JSP usage tiles:useAttribute name=myAttribute scope=request / This can be done in the inserted tile only. It declare a java variable and a bean in the request scope. A java variable is only visible inside the jsp page where it is declared. The bean is visible in its scope. // myAttribute is now available for all sub tiles in the jsp %= myAttribute ... % NO ! The java variable is not visible in sub tiles because they are other jsps. But the bean stored in the request scope is visible. so, you can retrieve it from the scope: bean:define .../ 2) Assuming now level2 is a HashMap and myAttributeName is the key corresponding to myAttribute value: myAttribute = (HashMap myBean.getLevel2()).get(myAttributeName) the beanProperty can be set: beanProperty=level2.myAttributeName I don't remember the exact syntax for accessing hashmap. It is the same syntax used in Struts tags. 3) Assuming as in (2) but myAttribute is now a property of level2Obj, which is the value of myAttributeName key: myAttribute = ( Level2Obj (HashMap myBean.getLevel2()).get(myAttributeName).getMyAttribute(), the beanProperty can be set: beanProperty=level2.myAttributeName.myAttribute It should work. In fact Tiles use the BeanUtils library. So, if this library support it, Tiles support it also. Cedric Thanks. -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 9:35 AM To: Struts Users Mailing List Subject: Re: Setting tiles attributes from a bean in different scopes Hi, BaTien Duong wrote: Hello Cedric and the group: Issue: need to retrieve properties of *myBean* in user session scope as values for tiles attributes in request scope. You can't set the scope of a tiles attribute: a tiles attribute is defined with put nested in an insert. A tile attribute is always in the tiles scope (the tiles context). However, you can import (importAttribute) a tile attribute in any jsp scope, or use it (useAttribute) as java variable. So, I don't clearly see what you are trying to do ;-). Solution from a scratch of my head: jsp:useBean id=myBean scope=session / tiles:useAttribute id=myAttribute name=myAttribute scope=request className=java.lang.String / tiles:put name=myAttribute beanName=myBean beanProperty=myAttribute / This code is not valid because the put tag should be nested inside an insert tag. Questions: 1) The bean and attribute are in different scopes. Can one set tile attributes from session scope? You can set an attribute from a bean stored in any scope: tiles:insert ... tiles:put name=myAttribute beanName=myBean beanScope=session / /tiles:insert This declare and set an attribute for the tile to be inserted. The attribute is called myAttribute, its value is taken from the bean myBean which is in the session scope. 2) Is there a faster way to assign an attribute at the time of initialization in useAttribute tag so we do not need jsp:useBean and tiles:put tags? useAttribute .../ tag is used to declare a java variable inside the jsp page. This variable is initialized from an attribute of the current tiles. This attribute has been passed to the current tiles. A side effect of this tag is to declare also a bean in one of the jsp scope. 3) Assuming myAttribute is a nested level of myBean ( i.e. getMyBean().getMyLevel2().getMyAttribute() ), is there an EL way similar to JSTL? Remind that you can use the dot separator in the bean property name: beanProperty=myLevel2.myAttribute Cedric Thanks? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: AW: AW: Tiles Body question
Roland Berger wrote: Yes, the Tag's surrounding tiles:insert are: nested:form ... nested:nest ... nested:nest ... table ... tr ... td ... tiles:insert ... Do you know a work around? No workaround apart not using nested:nest . The problem is not from Tiles, but from the jsp spec: it is not allowed to flush inside a BodyTag. Also, your webserver seem to deal badly with inclusion because when you set flush=false, the tiles should normally appear at its right place, not at the top of page. What webserver do you use ? Cedric Thank's Roland -Ursprüngliche Nachricht- Von: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 4. März 2003 11:33 An: Struts Users Mailing List Betreff: Re: AW: AW: Tiles Body question The configuration you propose should work. All example ship with struts are based on this kind of nesting (portal, tabs, menu, ...). The reported exception usually appear when an insert ... is performed inside a tag implementing the BodyTag interface (like insert, iterate, ...). Is there a tag surrounding tiles:insert ... in your memberDetail.jsp file ? Cedric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles problems (Building complex pages)
Hi, It looks like your unlucky using Tiles ;-). Fabio Mancinelli wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, Sorry for this lengthy mail but I am getting crazy! I am working with Struts and Tiles and I am developing a small site to test (and stress this technology) I reused some layouts taken from the tiles documentation. The standard page layout with the classical header, body, footer attributes and, in particular I took the vboxLayout: % Iterator i = list.iterator(); while(i.hasNext()) { String name = (String)i.next(); % tiles:insert name=%= name % flush=true/ % } % What I want is a page with the standard layout whose body is a vboxLayout with some tiles. To do this I have to write the following files: main.jsp If you use the tiles-config.xml, you can replace this page by a Struts action forwarding to a definition. mainBody.jsp As it use the vboxLayout.jsp, you can alsoreplace this page by a definition t1.jsp t2.jsp These are your bodies, you need them ;-) Where main is a page which uses the standard layout, mainBody is a simple .jsp with only a tiles:insert page=vboxLayout.jsp tiles:putList name=list tiles:add value=t1.jsp/ tiles:add value=t2.jsp/ ... t1, t2 are .jsp tiles. Now my questions are: 1) The mainBody contains a list of tiles some of which might be text-only. I would like to do something like this: tiles:insert page=vboxLayout.jsp tiles:putList name=list tiles:add value=t1.jsp/ tiles:add type=stringThis is an embedded text only tile/tiles:add ... In this way I would get rid of all the .jsp which contains only text/html and are peculiar to a single page. But this doesn't work. This is useful only if the body contains small text, and preferably without tags. Specifying type=String should work. 2) Another problem is when a tile, let's say t1.jsp, needs some attributes to be passed in order to be instantiated. Let's suppose that the tile t1 needs a title. How do I pass that attribute in the previous example? You can define another definition declaring your attributes. Then, you specify the definition instead of the jsp url: definition name=t1 page=/t1.jsp put name=title value=Yupi/ definition/ definition name=body page=/layouts/vboxLayout.jsp putList name=list add value=t1/ add value=/t1.jsp/ /putList definition/ tiles:insert page=vboxLayout.jsp tiles:putList name=list tiles:add value=t1.jsp tiles:put name=title value=Yupi/ /tiles:add tiles:add value=t2.jsp/ ... Doesn't work. I tried to write a local definition before actually inserting the tile: tiles:definition id=instantiatedT1 page=t1.jsp tiles:put name=title value=Yupi/ /tiled:definition This define a definition defined in a jsp scope. tiles:insert page=vboxLayout.jsp tiles:putList name=list tiles:add value=instantiatedT1/ You need to do somethink like: tiles:add beanName=instantiatedT1/ But I am not sure that the vboxLayout support a definition bean as list element. Definitions are more useful when defined in the tiles factory from a tiles-config.xml file. tiles:add value=t2.jsp/ ... But this doesn't work too. I tried also to specify different scopes for the definition (even the application one!) and different types for the tiles:add tag (namely type=definition and also beanName=instantiatedT1). The only way I've found to make this work is to put the definition inside the tiles-config.xml, but this would be equivalent in having a separate t1.jsp with no parameters. I suppose the problem is in the vboxLayout but I cannot figure out how to write a layout which supports what I said in 1). The problem in 2) still has no solution (to me). I suggest that you use the tiles-config.xml file. It will help reduce the number of pages. I also suggest to have one jsp per tiles, and to not write big pieces of body inside a put tag. Also, don't forget that you can write your own layout doing the exact behavior that you are looking for. Cedric A presto, Fabio - -- - - Fabio Mancinelli, PhD student EMail : [EMAIL PROTECTED] Dipartimento di Informatica WWW : http://www.di.univaq.it/~mancinel Universita' dell'Aquila - - -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE+ZKrs6dsQbk2R3cMRArgjAKCcW4oqazE/lbRwXBnOEA7odtvTyACgzw9p oSPR57Gl6YLcMAA6B08KZbo= =BmVa -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to catch exception using tiles thrown by e.g. org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude
I suppose that your exception is thrown by a tiles:insert ... tag in a jsp. This exception is thrown by the tiles framework, which know nothing about the struts exception mechanism, so it can't be used. The exception is then propagated by the tag handler and reach the jsp page (the tile jsp). If there is an exception handler associated to the jsp, it is called, if there is no handler, the exception is propagated to parent page inserting this one. If the parent page have inserted the child page with an insert ..., then the insert catch the exception and show it. Normally, the jsp exception handling should work, but it appear that it is not always the case. A workaround is to put a big try/catch in the jsp throwing the exception ;-(. This will be improved in future versions. Cedric Jörg Maurer wrote: Hi struts people! I have really defined everywhere i think i can put an exception handler for servlet exception : 1.) in my base layout.jsp an %@ errorPage='/pages/common/error/errorsGeneralHandler.jsp'% 2.) in struts config a global exception handler global-exceptions exception path=pages/common/error/errorsGeneralHandler.jsp type=javax.servlet.ServletException/ /global-exceptions 3.) in web.xml error-page exception-typejavax.servlet.ServletException/exception-type location/pages/common/error/errorsGeneralHandler.jsp/location /error-page Still ServletException slip through my guards. Last know point as stack trace shows below is org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilSt rutsModulesImpl.java:122) , which throws ServletException but is never catchable to me. The point is not the FileNotFound, which is pretty clear to me, but why such exception doesn´t hit any of my error handler. Any hints appreciated! 2003-03-04 12:36:06 ApplicationDispatcher[] Servlet.service() for servlet jsp threw exception javax.servlet.ServletException: /pages/wf_category/pager_region.jsp at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWra pper.service(IDEJspServlet.java:183) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFil e(IDEJspServlet.java:246) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJs pServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:683) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDisp atcher.java:574) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispat cher.java:497) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.ja va:819) at org.apache.jsp.wf_0005fcategory_0005fchoose$jsp._jspService(wf_0005fcate gory_0005fchoose$jsp.java:107) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWra pper.service(IDEJspServlet.java:173) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFil e(IDEJspServlet.java:246) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJs pServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:683) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDisp atcher.java:574) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispat cher.java:497) at org.apache.struts.tiles.TilesUtilStrutsModulesImpl.doInclude(TilesUtilSt rutsModulesImpl.java:122) at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:161) at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:703) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTa g.java:818) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:467) at org.apache.jsp.base_0005flayout$jsp._jspService(base_0005flayout$jsp.jav a:1006) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWra pper.service(IDEJspServlet.java:173) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFil e(IDEJspServlet.java:246) at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJs pServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:683) at
Re: i18n in SimpleMenuItem
Hi, The Tiles config files should contain the resource keys (put name=title value=a.key /). You use this keys in the jsp file in conjunction with tags accepting such keys: tiles:importAttribute / bean:write name=a.key /. You can implement your own SmartMenuItem, taking a key as input, and providing the translated value as output ... You should find a way to specify the resource bundle to use. Cedric Dan Allen wrote: Has anyone written a class (which they would like to share) that extends SimpleMenuItem to retrieve the bundle key for value and global forward for the link? I was envisioning something along the lines of: item name=webapp.page.news value=news classname=org.apache.struts.titles.bean.SmartMenuItem/ I am not even interested in the global forward as much as the bean:message bundle resource. Also, while I am on the topic of tiles. Is there any way to use the bean:message key=webapp.title/ in the tiles definition file? I know that you can have different definition files for different languages, but it would seem to be more logical to be able to reference the application message bundle instead. It would seem to me a new type of message would be the most approrpriate if it is not already possible to do this. I would be grateful for any responses to those two inquires. Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles insert in sub layout
Hi, Have you tried to set flush=true in your insert tags ? Cedric Roland Berger wrote: Hi all tiles:insert does not insert the jsp page where it should. I have the following setup: In my master Layout (classicLayout.jsp) I have the tag: Code snippet start of classicLayout.jsp * ... tiles:insert attribute=body/ ... Code snippet end * The attribut body references another tiles definition which inserts the mitgliedDetail.jsp page. In that JSP page I have another tag: tiles:insert attribute=bodyHead flush=false/ which points the mitgliedDetailBearbeitenKopf.jsp Page. Code snippet start of tiles-defs.xml ** definition name=.pages.mitglied.detail.bearbeiten extends=.classicLayout ... put name=body value=.pages.mitglied.detail.bearbeiten.kopf/ /definition definition name=.pages.mitglied.detail.bearbeiten.kopf path=/WEB-INF/pages/mitgliedDetail.jsp put name=bodyHead value=/WEB-INF/pages/mitgliedDetailBearbeitenKopf.jsp / /definition ... Code snippet end *** Instead of inserting the JSP page, referenced by the name bodyHead, into 'detailMitglied.jsp' where the tiles:insert attribute=bodyHead flush=false/ is, the page is inserted at the beginning of the page 'detailMitglied.jsp'. But the insert Tag is not at the beginning but somewhere in the middle. What is the proper way to insert jsp pages, which are insertet into the master layout, and have themselfs insert tags? ( Kind of nested inserts ) Kind regards Roland PS: I work with struts version 1.1 beta 3 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Whay can't a controller be assigned in the put tag?
A Tiles controller is associated to the tile being inserted. The controllers are called when a tiles is inserted. They are declared in the insert tag, or in the definition tag which is used by insert. The put tag is used to specify an attribute which is passed to the insert. So, the controller can't be associated to the put tag. What could be done in an future enhancement is something like this: put name=body definition extends=a.def controllerUrl=aController / /put This will specify that the attribute body is a definition extending another one, and overloading the controller. The same mechanism will allow to overload definition parameters inline. This is an enhancement request that need a new ticket in bugzilla ;-). Cedric jennings, christofer BOZ j wrote: I'm curious why Tiles controllers can't be assigned in the put tag. As far as I can tell, a controller can only be assigned at the level of definition or input, which means that the controller must know enough to format data for mutiple put sections of a page or tile. What I want, though, is to have each put section (may we say node of a tile?) display independent data. I do not want a bunch of definitions that each wrap one put, but it seems this is the only answer. Am I wrong? If not, why can't a controller be assigned in the put tag? TIA ,boz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Body question
You can have a body acting as a body template which in turn insert other bodies ... Cedric James Prance wrote: In a classic template, the header, footer and menu could be common across your application. However the body would likely change depending on the business process. Is there a way to alter the 'body' value dynamically? I'm a bit confused by this at the moment and my current understanding is that you need a new 'layout' for each differing 'body' page.. is this correct or am i totally arse about face? James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting tiles attributes from a bean in different scopes
Hi, BaTien Duong wrote: Hello Cedric and the group: Issue: need to retrieve properties of *myBean* in user session scope as values for tiles attributes in request scope. You can't set the scope of a tiles attribute: a tiles attribute is defined with put nested in an insert. A tile attribute is always in the tiles scope (the tiles context). However, you can import (importAttribute) a tile attribute in any jsp scope, or use it (useAttribute) as java variable. So, I don't clearly see what you are trying to do ;-). Solution from a scratch of my head: jsp:useBean id=myBean scope=session / tiles:useAttribute id=myAttribute name=myAttribute scope=request className=java.lang.String / tiles:put name=myAttribute beanName=myBean beanProperty=myAttribute / This code is not valid because the put tag should be nested inside an insert tag. Questions: 1) The bean and attribute are in different scopes. Can one set tile attributes from session scope? You can set an attribute from a bean stored in any scope: tiles:insert ... tiles:put name=myAttribute beanName=myBean beanScope=session / /tiles:insert This declare and set an attribute for the tile to be inserted. The attribute is called myAttribute, its value is taken from the bean myBean which is in the session scope. 2) Is there a faster way to assign an attribute at the time of initialization in useAttribute tag so we do not need jsp:useBean and tiles:put tags? useAttribute .../ tag is used to declare a java variable inside the jsp page. This variable is initialized from an attribute of the current tiles. This attribute has been passed to the current tiles. A side effect of this tag is to declare also a bean in one of the jsp scope. 3) Assuming myAttribute is a nested level of myBean ( i.e. getMyBean().getMyLevel2().getMyAttribute() ), is there an EL way similar to JSTL? Remind that you can use the dot separator in the bean property name: beanProperty=myLevel2.myAttribute Cedric Thanks? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Tiles Body question
The examples in struts-documentation use a master layout (classicLayout.jsp), and the body is often made of tiles inserted with another layout (like columnsLayout, vboxLayout, tabsLayout...). You can easily define your own layout with an insert. It is also possible to insert the definition corresponding to a page inside a nested bodies (see the tabs in the example directory). Maybe I have miss something in what you are trying to do ... Cedric Roland Berger wrote: Yes, that's exactly what I also want to do. But it seems that I missed the big picture. When I set flush=true I get a Illegal to flush error. If I set flush=false the tile I want to insert into the body template is inserted at the top of the page and not where the insert tag is. Can you give a small example with tiles-defs.xml and the JSP Part? ( see also thread: 'tiles insert in sub layout' ) Thanks a lot. Roland. -Ursprüngliche Nachricht- Von: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 22. Februar 2003 14:13 An: Struts Users Mailing List Betreff: Re: Tiles Body question You can have a body acting as a body template which in turn insert other bodies ... Cedric James Prance wrote: In a classic template, the header, footer and menu could be common across your application. However the body would likely change depending on the business process. Is there a way to alter the 'body' value dynamically? I'm a bit confused by this at the moment and my current understanding is that you need a new 'layout' for each differing 'body' page.. is this correct or am i totally arse about face? James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TILES - Network Traffic...
Hi, Tiles doesn't use any javascript. It is a framework to build pages by assembling small pieces (tiles) on the server side. However, you can use your own javascript in tiles ... There was a discussion Sell me on tiles in the mailing list. Check the mailing list archive: http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=658517 Cedric Puneet Agarwal wrote: I am quite new to TILES and have a query abt the way it renders HTML pages. Does it embed the javaScript code into the HTML page itself or it has generic JavaScript Library files, and includes them using a JavaScript include directive in HTML for JavaScript file, so that it could be cached at client side and lead to smaller payload on network front. If not is there any other advantage of using TILES. For our project network traffic is the biggest concern, the decision to use TILES greatly depend on the above. Your view shall help us greatly. Cheers Puneet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles: dynamically adding definitions
Hi, The doc is temporarily available at http://www.lifl.fr/~dumoulin/howto/ It will be added to the official doc asap. It is not planned yet to add the feature you describe to Tiles. Such future can be implemented and used by extending the current core implementation, without changing it. If you use the extension mechanism, your implementation should survive any future enhancement of the Tiles core. However, if you make such extension, feel free to make it available to other users. If this feature is heavily used, we will add it. Cedric John Nikolai wrote: Thanks Cedric, I look forward to seeing the document. Is this a feature which may be added to Tiles at a future date? Or is this too specialized? Thanks again, - John On Thursday, February 27, 2003, at 10:46 AM, Cedric Dumoulin wrote: Hi, The answer is yes, but it need some coding. The default definition factory doesn't provide a well know API to add dynamically new definitions. What you can do is to implement your own definition factory to provide such functionality. You can extends the existing factory and add the methods you need. You have to know that the extends mechanism is resolved statically when the config file is loaded. After that, definitions are stored resolved. So, you have to resolve yourself your extend. This is however simple to do: get the definition referenced by extend, create a new definition initialized with the previously loaded one, add your own attributes, store your definition in the factory. I have a short document describing how to write a factory. I will make it accessible asap. Cedric John Nikolai wrote: Is it possible to define a few base tiles definitions (loaded using TilesPlugin) and, during runtime, read in other definitions which extend these base definitions? Here is an example use: We have an XML file which defines a web site and used to generate the web site navigation. If we add a new page to the site we need to update this XML file to update the navigation as well. Can I add a tiles definition to this XML file and add that definition into tiles for processing? nav path=/events file=events.jsp leftnav Events amp; Activities /leftnav breadcrumb Events amp; Activities /breadcrumb definition name=events.page extends=master.page put name=body value=/events/events.jsp / ... /definition /nav NOTE: master.page is defined in the default definitions loaded at startup using TilesPlugin. Doing it this way when I add a new file I only need to update a single XML file as opposed to several. Thanks for your help! - John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tiles] Q: Are paths always servlet relative (instead of modulerelative)?
Hi, James Young wrote: When using Tiles with multiple modules (with moduleAware=true), consider the following JSP fragment: tiles:insert page=/myTemplate.jsp tile:put name=main value=/myMain.jsp/ tile:put name=menu value=../myMain.jsp/ /tiles:insert 1. Are both /myTemplate.jsp and /myMain.jsp always servlet-context relative, not module relative? All paths interpreted by the Tiles framework are servlet-context relative. A module relative mechanism will be added later. 2. Is the same rule applied to definition path=.. and put value=.. in a Tiles XML definition file? Yes. Paths still servlet-context relative when defined in a config file. 3. What about definition controllerUrl=..? Is the action path servlet context relative or module relative? Servlet-context relative. You need to prefix a struts action with the appropriate module name. 4. Is ../myMain.jsp above valid? It is valid, but generally not useful. The problem is that you can't says from where a Tile is inserted, so it is hard to say to what ../ refers. 5. Can tiles:put page=.. and put page=.. refer to an action path instead of JSP? tiles:put page=.. doesn't exist. You can have tiles:insert page=.. ... or tiles:put value=.. In both case you can use an action path (prefixed with the appropriate module name). Cedric Thanks J. Young __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Frames and the Tile PutList
Hi, I don't really understand what you are trying to do ;-). Can't you pass your apps attribute as a simple attribute (put name=apps .../) instead of as a list (putList name=apps add value=/ ...) ? Cedric Jean Mercier wrote: Thanks for replying Cedric, I've created a scriptlet that removes the offending characters I'm able to pass request.getContextPath correctly but try as I might I can't get tiles:getAsString name=apps/ to be resolved and passed as /carosys/logon/logonApp.jsp when sent to the scriplet. At best I pass tiles:getAsString name=apps/ as a string. Is there something like eval() that I can use? Thanks in advance, Jean -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 3:48 AM To: Struts Users Mailing List Subject: Re: Frames and the Tile PutList Hi, The extra '[' ']' are there because you declare the apps attribute as a list. You should either declare it as a normal attribute (put .../), or use an index to peek up the appropriate element in the list (not supported by getAsString or get or insert, you should get the list and use a scriptlet). Cedric Jean Mercier wrote: Hi All, I searched the archive and I have not found a solution to this problem. I unfortunately am required to use frames so when I attempt to use putlist to extend my tiles definition, I get /BrokerPortalWeb[/carosys/logon/logonApp.jsp] when I would like to get /BrokerPortalWeb/carosys/logon/logonApp.jsp is there a way around this. I submit my definition and results. I've defined my tiles in tiles-config.xml definition name=layout.notree.frame path=/carosys/templateNoTreeFrame.jsp put name=popupscript value=/carosys/popupjs.jsp direct=true/ put name=banner value=/carosys/cmon/cmonBanner.jsp direct=true / put name=navigation value=/carosys/cmon/cmonBlankNvgt.jsp direct=true / put name=footer value=/carosys/cmon/cmonFooter.jsp direct=true / putList name=apps / /definition definition name=logonFrame extends=layout.notree.frame putList name=apps add value=/carosys/logon/logonApp.jsp/ /putList /definition and carosys/templateNoTreeFrame.jsp is defined as frameset rows=50,25, *,10 frame src=%=request.getContextPath()%tiles:getAsString name=banner / name=banner frame src=%=request.getContextPath()%tiles:getAsString name=navigation / name=navigation frame src=%=request.getContextPath()%tiles:getAsString name=apps / name=apps frame src=%=request.getContextPath()%tiles:getAsString name=footer / name=footer /frameset When forward to logonFrame the following is rendered all except apps comes back fine frameset rows=50,25, *,10 frame src=/BrokerPortalWeb/carosys/cmon/cmonBanner.jsp name=banner frame src=/BrokerPortalWeb/carosys/cmon/cmonBlankNvgt.jsp name=navigation frame src=/BrokerPortalWeb[/carosys/logon/logonApp.jsp] name=apps frame src=/BrokerPortalWeb/carosys/cmon/cmonFooter.jsp name=footer /frameset Regards, Jean Mercier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles: dynamically adding definitions
Hi, The answer is yes, but it need some coding. The default definition factory doesn't provide a well know API to add dynamically new definitions. What you can do is to implement your own definition factory to provide such functionality. You can extends the existing factory and add the methods you need. You have to know that the extends mechanism is resolved statically when the config file is loaded. After that, definitions are stored resolved. So, you have to resolve yourself your extend. This is however simple to do: get the definition referenced by extend, create a new definition initialized with the previously loaded one, add your own attributes, store your definition in the factory. I have a short document describing how to write a factory. I will make it accessible asap. Cedric John Nikolai wrote: Is it possible to define a few base tiles definitions (loaded using TilesPlugin) and, during runtime, read in other definitions which extend these base definitions? Here is an example use: We have an XML file which defines a web site and used to generate the web site navigation. If we add a new page to the site we need to update this XML file to update the navigation as well. Can I add a tiles definition to this XML file and add that definition into tiles for processing? nav path=/events file=events.jsp leftnav Events amp; Activities /leftnav breadcrumb Events amp; Activities /breadcrumb definition name=events.page extends=master.page put name=body value=/events/events.jsp / ... /definition /nav NOTE: master.page is defined in the default definitions loaded at startup using TilesPlugin. Doing it this way when I add a new file I only need to update a single XML file as opposed to several. Thanks for your help! - John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Frames and the Tile PutList
If you use a list, you should treat the attribute apps as a list: tiles:useAttribute name=adds classname=java.util.List / % String aValue = adds.get(0); % ... frame src=%=request.getContextPath() + aValue% name=apps ... Or ... frame src=%=request.getContextPath() + adds.get(0)% name=apps ... Cedric Jean Mercier wrote: Hi, Yes I can and that is what I'm doing at the moment but in the future I may need use a list so that my tiles can be a bit more dynamic. Also on a personal note, I spent way too much time trying to figure out way to do it yesterday. So am very curious on how it could be done, it's like not being able to finish puzzle. Anyway cheers!, Jean -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: February 27, 2003 1:31 PM To: Struts Users Mailing List Subject: Re: Frames and the Tile PutList Hi, I don't really understand what you are trying to do ;-). Can't you pass your apps attribute as a simple attribute (put name=apps .../) instead of as a list (putList name=apps add value=/ ...) ? Cedric Jean Mercier wrote: Thanks for replying Cedric, I've created a scriptlet that removes the offending characters I'm able to pass request.getContextPath correctly but try as I might I can't get tiles:getAsString name=apps/ to be resolved and passed as /carosys/logon/logonApp.jsp when sent to the scriplet. At best I pass tiles:getAsString name=apps/ as a string. Is there something like eval() that I can use? Thanks in advance, Jean -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 3:48 AM To: Struts Users Mailing List Subject: Re: Frames and the Tile PutList Hi, The extra '[' ']' are there because you declare the apps attribute as a list. You should either declare it as a normal attribute (put .../), or use an index to peek up the appropriate element in the list (not supported by getAsString or get or insert, you should get the list and use a scriptlet). Cedric Jean Mercier wrote: Hi All, I searched the archive and I have not found a solution to this problem. I unfortunately am required to use frames so when I attempt to use putlist to extend my tiles definition, I get /BrokerPortalWeb[/carosys/logon/logonApp.jsp] when I would like to get /BrokerPortalWeb/carosys/logon/logonApp.jsp is there a way around this. I submit my definition and results. I've defined my tiles in tiles-config.xml definition name=layout.notree.frame path=/carosys/templateNoTreeFrame.jsp put name=popupscript value=/carosys/popupjs.jsp direct=true/ put name=banner value=/carosys/cmon/cmonBanner.jsp direct=true / put name=navigation value=/carosys/cmon/cmonBlankNvgt.jsp direct=true / put name=footer value=/carosys/cmon/cmonFooter.jsp direct=true / putList name=apps / /definition definition name=logonFrame extends=layout.notree.frame putList name=apps add value=/carosys/logon/logonApp.jsp/ /putList /definition and carosys/templateNoTreeFrame.jsp is defined as frameset rows=50,25, *,10 frame src=%=request.getContextPath()%tiles:getAsString name=banner / name=banner frame src=%=request.getContextPath()%tiles:getAsString name=navigation / name=navigation frame src=%=request.getContextPath()%tiles:getAsString name=apps / name=apps frame src=%=request.getContextPath()%tiles:getAsString name=footer / name=footer /frameset When forward to logonFrame the following is rendered all except apps comes back fine frameset rows=50,25, *,10 frame src=/BrokerPortalWeb/carosys/cmon/cmonBanner.jsp name=banner frame src=/BrokerPortalWeb/carosys/cmon/cmonBlankNvgt.jsp name=navigation frame src=/BrokerPortalWeb[/carosys/logon/logonApp.jsp] name=apps frame src=/BrokerPortalWeb/carosys/cmon/cmonFooter.jsp name=footer /frameset Regards, Jean Mercier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Frames and the Tile PutList
Hi, The extra '[' ']' are there because you declare the apps attribute as a list. You should either declare it as a normal attribute (put .../), or use an index to peek up the appropriate element in the list (not supported by getAsString or get or insert, you should get the list and use a scriptlet). Cedric Jean Mercier wrote: Hi All, I searched the archive and I have not found a solution to this problem. I unfortunately am required to use frames so when I attempt to use putlist to extend my tiles definition, I get /BrokerPortalWeb[/carosys/logon/logonApp.jsp] when I would like to get /BrokerPortalWeb/carosys/logon/logonApp.jsp is there a way around this. I submit my definition and results. I've defined my tiles in tiles-config.xml definition name=layout.notree.frame path=/carosys/templateNoTreeFrame.jsp put name=popupscript value=/carosys/popupjs.jsp direct=true/ put name=banner value=/carosys/cmon/cmonBanner.jsp direct=true / put name=navigation value=/carosys/cmon/cmonBlankNvgt.jsp direct=true / put name=footer value=/carosys/cmon/cmonFooter.jsp direct=true / putList name=apps / /definition definition name=logonFrame extends=layout.notree.frame putList name=apps add value=/carosys/logon/logonApp.jsp/ /putList /definition and carosys/templateNoTreeFrame.jsp is defined as frameset rows=50,25, *,10 frame src=%=request.getContextPath()%tiles:getAsString name=banner / name=banner frame src=%=request.getContextPath()%tiles:getAsString name=navigation / name=navigation frame src=%=request.getContextPath()%tiles:getAsString name=apps / name=apps frame src=%=request.getContextPath()%tiles:getAsString name=footer / name=footer /frameset When forward to logonFrame the following is rendered all except apps comes back fine frameset rows=50,25, *,10 frame src=/BrokerPortalWeb/carosys/cmon/cmonBanner.jsp name=banner frame src=/BrokerPortalWeb/carosys/cmon/cmonBlankNvgt.jsp name=navigation frame src=/BrokerPortalWeb[/carosys/logon/logonApp.jsp] name=apps frame src=/BrokerPortalWeb/carosys/cmon/cmonFooter.jsp name=footer /frameset Regards, Jean Mercier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reuse Frames with Tiles
The Tiles insert mechanism use the RequestDispatcher.include(...) which only allows to include a resource from the same webapp. So, you can't insert a tile from another war file. A solution is to implement a tile that read its content from an external location. But, the external location will not have access to the current request and so on ... Cedric Bernhard Lenz wrote: We have multiple web applications (wars) which all use the same header (e.g. header.jsp). Currently since the jsp:include tag only works within a war's context we have to package/copy header.jsp into each war. Now every time header.jsp changes all applications have to be repackaged and redeployed. The goal is to store header.jsp only once e.g. in a common repository war and have all other wars access this common repository to obtain the header information. Is this possible with struts tiles? If so how? The examples that are provided with tiles all reside in a single web application / war. An inter war tile definitions example is missing. Your help is greatly appreciated. Greetings Bernie P.S.: The app server we're using is WL 6.1. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tile configuration problem: No value defined for bean
Hi, You should use tiles:insert name=sccLayout .../ rather than tiles:insert beanName=sccLayout .../ beanName is for retrieving a definition from the jsp scope. name is for retrieving a definition from the tiles factory. Cedric [EMAIL PROTECTED] wrote: Greetings, I'm experienced with Struts 1.0.2 and am trying to use 1.1 with Tiles for the first time, and have successfully created my layout, but now I can't seem to get my definitions to register in the tiles-defs.xml. I've been at this for two days and searched newsgroups and archives but can't seem to find a solution... I am using Struts 1.1 b3 on Weblogic 6.1 SP4 Using the struts-blank.war as my example, I placed the following in my struts-config.xml: controller processorClass =org.apache.struts.tiles.TilesRequestProcessor / message-resources parameter=resources.application / plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value =/WEB-INF/tiles-defs.xml / set-property property=moduleAware value=true / set-property property=definitions-parser-validate value=true / /plug-in then in the WEB-INF/tiles-def.xml, I have put: tiles-definitions definition name=sccLayout path=/common/layouts/upLayout.jsp put name=pageTitle value=CHANGEME/ put name=stylesheet value=css/scc.css / put name=menuoptions value=/common/scc-menuoptions.jsp / put name=body-content value=CHANGEME/ /definition /tiles-definitions Finally, in my jsp file, I have: tiles:insert beanName=sccLayout beanScope=request flush=true tiles:put name=pageTitle value=Shipment Cancellations direct=true type=string/ tiles:put name=body-content type=string html:errors/ centerh3bean:message key=index.heading//h3 table width=50% trtd bean:message key=index.message/ /td/tr /table /center /tiles:put /tiles:insert Any time I hit this jsp, I get the following error: Feb 21, 2003 12:08:06 PM CST Error HTTP [WebAppServletContext(3210383,scc,/scc)] Root cause of ServletException javax.servlet.jsp.JspException: Error - Tag Insert : No value defined for bean 'sccLayout' with property 'null' in scope 'request'. at org.apache.struts.taglib.tiles.InsertTag.processBean(InsertTag.java:629) at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:485) at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:445) at jsp_servlet._secure.__index._jspService(__index.java:110) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:321) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:250) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:436) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:312) at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2637) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2359) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) I have verifyed this layout will work, but only if I use it as a JSP include. Any clues? Am I missing something obvious here?? TIA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles plugin compatible with struts 1.0?
The Tiles plugin is for initializing the Tiles framework in struts1.1 The Tiles framework can be used in Struts1.0.x. You need a special tilesForStruts1.0.jar file, available in the distribution from http://www.lifl.fr/~dumoulin/tiles/doc/download.html. Also, the setup differ. Check the docs, or use the tiles-blank-struts1.0.war file in the previous distribution. Cedric Raymaker, Dora wrote: Is the tiles plugin compatible with struts 1.0, or only with 1.1? Thanks! -D. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TilesAction and Controller
David Graham wrote: The controllerClass attribute doesn't appear to be hooked into the Struts exception handling mechanism so I tried controllerUrl. I pointed the controllerUrl attribute at a /something.do action. That action throws an exception which does get delegated to the exception handling mechanism. However, the ActionForward returned from the ExceptionHandler is not recognized by Tiles so the user doesn't get forwarded to the error page, the tile shows up instead. When you use controllerUrl, Tiles do a RequestDispatcher.include() of your url. Any processing done from this include is taken into account. However, the goal of controllerUrl is to be able to associate a tiles controller which should normally only preprocess data (no rendering). So, you should avoid the use of ActionForward of forwards with an action used as tiles-controller. If you want to write a controller having different rendering views depending of errors/computation, you should better write a struts action used as controller, and do some forwards to tiles definition. The controller concept of Tiles is very basic: just one method called before the tile rendering; no error mechanism. Struts allow witting complex controllers as Actions. Cedric Help? Dave If you don't need the struts properties, use a Controller class and controllerClass. If you need the struts preprocessing or the struts properties in your controller, use a TilesAction and controllerUrl. A TilesAction is a regular Struts action which can be called through the servlet mechanism, and so can be catch and preprocessed by Struts. In addition, a TilesAction should be declare in the struts config file, and called throw its URL. Cedric _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]