Re: tiles question
Hi well this is ok tiles is used to manage many jsp sides with all nearly the same layouts over one configuration file this means you have to maintain (if you use full tiles power) minimum 3 files: the layout jsp (setting positions of header, body, footer, and so on) the content files (foreach (header,body,footer,and so on){ you have to make jsp sides;}) the configuration xml file ( setting which content file should be used at which position in layout file) the advantage is that if all websites have the same header and footer you only have to create the footer and header jsp once - Original Message - From: Kalra, Ashwani [EMAIL PROTECTED] To: Struts (E-mail) [EMAIL PROTECTED] Sent: Thursday, October 30, 2003 6:27 AM Subject: tiles question hi, I tiles you have to maintain two pages. One that includes all the sections like header, footer, variable content jsp, etc. and one jsp which contains your code(varible part). This doubles up the no of jsps ? Is it ok. any work around ? TIA Ashwani Kalra http://www.geocities.com/ashwani_kalra This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - 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
On 10/30/2003 09:00 AM Frers Michael wrote: Hi well this is ok tiles is used to manage many jsp sides with all nearly the same layouts over one configuration file this means you have to maintain (if you use full tiles power) minimum 3 files: the layout jsp (setting positions of header, body, footer, and so on) the content files (foreach (header,body,footer,and so on){ you have to make jsp sides;}) the configuration xml file ( setting which content file should be used at which position in layout file) the advantage is that if all websites have the same header and footer you only have to create the footer and header jsp once The saving in the number of pages comes when you have many pages. Take as an example a page with 3 parts. That means for your first page, you have to create 5 files: tiles-def.xml (config) layout.jsp (skeleton) header.jsp content.jsp footer.jsp Now you want another page. Assuming that your header and footer require only changes that you can take care of in the xml, then you only require one more file - the content.jsp for the new page. So for a 10 page website, you only need 10 content pages, plus 4 (xml, layout, header footer). I don't think I could live without it now. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tiles question
There's a method of reducing this duplication in Ted Husted's Struts in Action book - the method, I believe, is called the body wrap method and it addresses a particular situation that is common, that allows you to eliminate this duplication. Also, you can define and extend tile definitions in XML, that also help mitigate and leverage the scaleability of Tiles. I recommend you check out Ted's book or other Struts books that also address Tiles. Kalra, Ashwani wrote: hi, I tiles you have to maintain two pages. One that includes all the sections like header, footer, variable content jsp, etc. and one jsp which contains your code(varible part). This doubles up the no of jsps ? Is it ok. any work around ? TIA Ashwani Kalra http://www.geocities.com/ashwani_kalra This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: tiles question
If you use Tiles Definitions, you can get rid of this second jsp(holder jsp) per page.So you end up writing just one jsp(te body part jsp)per page.. Following is what you do. Write one jsp which include all the reusable jsps and have the common layout for your site. I call this CLassicLayout_template.jsp It will have includes like this. tiles:insert attribute=header / tiles:insert attribute=menu / tiles:insert attribute=bodyContent / tiles:insert attribute=footer / with proper layout offcourse. Then define a base definition for u r site like this in tiles-defs.xml.. definition name=base.classicLayout path=/WEB-INF/jsp/tiles/classicLayout_template.jsp put name=headervalue=/WEB-INF/jsp/tiles/header.jsp / put name=navigationvalue=/WEB-INF/jsp/tiles/sidebar.jsp / put name=content value=${content}/ put name=footervalue=/WEB-INF/jsp/tiles/footer.jsp / /definition Then per page you just extend this page and overridfe the body portion.. definition name=cs.admin.homepage extends=base.classicLayout put name=content value=/WEB-INF/jsp/pages/cs/admin_homepage.jsp/ /definition In fact, ted Husteds book(Struts In Action)has a very chapter about it.That should ehlp u. Regards, Shirish -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Thursday, October 30, 2003 3:48 PM To: Struts Users Mailing List Subject: Re: tiles question There's a method of reducing this duplication in Ted Husted's Struts in Action book - the method, I believe, is called the body wrap method and it addresses a particular situation that is common, that allows you to eliminate this duplication. Also, you can define and extend tile definitions in XML, that also help mitigate and leverage the scaleability of Tiles. I recommend you check out Ted's book or other Struts books that also address Tiles. Kalra, Ashwani wrote: hi, I tiles you have to maintain two pages. One that includes all the sections like header, footer, variable content jsp, etc. and one jsp which contains your code(varible part). This doubles up the no of jsps ? Is it ok. any work around ? TIA Ashwani Kalra http://www.geocities.com/ashwani_kalra This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - 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
Haven't gone into the details of it.. but could you pass in one definition (override) over the other where one putlist is different than the other and each has a role name on it? sandeep --- Alex Shneyderman [EMAIL PROTECTED] wrote: I have tiles definition file and and I use putList name=items item value=item1 link=link1 / item value=item2 link=link2 / /putList Suppose now I need item2 to be displayed only for user in role admin How would I go about doing it? There is no role attribute for item. Is there a good way to do it? Thanks, Alex. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles question
Can you explain what you want to do in english, rather than pseudocode? -Original Message- From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 10:54 AM To: [EMAIL PROTECTED] Subject: Tiles question I am looking to do something like what is listed below, is it possible or a way to do similar: tiles-defs.xml: definition name=doc.errorPage put name=title value=ACINT21 Contact Screening Status Viewer / put name=body value=/WEB-INF/view/main/error_page.jsp / /definition definition name=doc.userNotFound extends=doc.errorPage put name=title value=User Not Found / !-Here is where the problem is on how to do this so I am making it pseudo code -- use name=body / put name=longFormattedDisplayString This is an error: br Blah blah blahbrbr If this persists contact blah blah /put /use !-above here is where I don't know how to do this-- /definition error_page.jsp: ... tiles:getAsString name=longFormattedDisplayString / !-- Message: %= exception.getMessage() %br pWith the following stack trace: pre % exception.printStackTrace(new PrintWriter(out)); % /pre -- Basically, I want to have a reusable error page that has a configurable ( HTML formattable) message to the user. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles question
Look at the bottom of the original message. -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 12:02 PM To: 'Struts Users Mailing List' Subject: RE: Tiles question Can you explain what you want to do in english, rather than pseudocode? -Original Message- From: Bailey, Shane C. [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 10:54 AM To: [EMAIL PROTECTED] Subject: Tiles question I am looking to do something like what is listed below, is it possible or a way to do similar: tiles-defs.xml: definition name=doc.errorPage put name=title value=ACINT21 Contact Screening Status Viewer / put name=body value=/WEB-INF/view/main/error_page.jsp / /definition definition name=doc.userNotFound extends=doc.errorPage put name=title value=User Not Found / !-Here is where the problem is on how to do this so I am making it pseudo code -- use name=body / put name=longFormattedDisplayString This is an error: br Blah blah blahbrbr If this persists contact blah blah /put /use !-above here is where I don't know how to do this-- /definition error_page.jsp: ... tiles:getAsString name=longFormattedDisplayString / !-- Message: %= exception.getMessage() %br pWith the following stack trace: pre % exception.printStackTrace(new PrintWriter(out)); % /pre -- Basically, I want to have a reusable error page that has a configurable ( HTML formattable) message to the user. - 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
Here is a little more detail: I want a single reusable JSP error page which will have two pieces. 1. The message the user sees must be variable (was a prob., figured out a decent solution. I still want multi-line, formatted HTML to be sent to the JSP though) 2. The stacktrace printed in an HTML comment. (no problem) 3. Defined as a tile. (no problem) 4. JSP directive: errorPage=doc.specificError2 (this I'm not sure about) I can do everything except figure out how to have the tiles def called if a JSP error occurs. definition name=doc.errorPage put name=displayText value=Unexpected Error / put name=body value=/WEB-INF/view/main/error_page.jsp/ /definition definition name=doc.specificError extends=doc.errorPage put name=displayText Hello User: A specific Error occurred.br Please do this. /put /definition definition name=doc.specificError2 extends=doc.errorPage put name=displayText Hello User: A different specific Error occurred. Please do that instead of this.brbr More Text... /put /definition - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles question
Did you add Tiles plugin in your struts-config.xml ? - Original Message - From: Mykola Ostapchuk [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 6:48 PM Subject: Tiles question Hello, I'm new to tiles and can't make it work. I'm trying to display users list (body - users.jsp) and get an error: [ServletException in:/users.jsp] Cannot find bean usersList in scope request' . I'm populating 'usersList' bean and put it into request in my Action class. It displays header and footer well, but not the body. The link I'm calling: /usersAdm.do tiles-defs.xml: definition name=usersPage path=/layout.jsp put name=header value=/header.jsp / put name=footer value=/footer.jsp / put name=body value=/users.jsp / /definition layout.jsp: [EMAIL PROTECTED] contentType=text/html% html:html locale=true html:base/ body tiles:insert attribute=header / tiles:insert attribute=body/ tiles:insert attribute=footer / /body /html:html struts-config.xml: actionpath=/usersAdm type=com.name.wos.struts.common.DoFirst forward name=success path=usersPage/ /action DoFirst.java: 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; public class DoFirst extends Action { public ActionForward perform( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { return aMapping.findForward(success); } } - 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
Sure I did: !-- Tiles plugin -- 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 It works fine for header and footer. I think there's a problem (mostly I'm doing something wrong) with action forwarding. - Original Message - From: Sergey Smirnov [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Mykola Ostapchuk [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 10:12 PM Subject: Re: Tiles question Did you add Tiles plugin in your struts-config.xml ? - Original Message - From: Mykola Ostapchuk [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 6:48 PM Subject: Tiles question Hello, I'm new to tiles and can't make it work. I'm trying to display users list (body - users.jsp) and get an error: [ServletException in:/users.jsp] Cannot find bean usersList in scope request' . I'm populating 'usersList' bean and put it into request in my Action class. It displays header and footer well, but not the body. The link I'm calling: /usersAdm.do tiles-defs.xml: definition name=usersPage path=/layout.jsp put name=header value=/header.jsp / put name=footer value=/footer.jsp / put name=body value=/users.jsp / /definition layout.jsp: [EMAIL PROTECTED] contentType=text/html% html:html locale=true html:base/ body tiles:insert attribute=header / tiles:insert attribute=body/ tiles:insert attribute=footer / /body /html:html struts-config.xml: actionpath=/usersAdm type=com.name.wos.struts.common.DoFirst forward name=success path=usersPage/ /action DoFirst.java: 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; public class DoFirst extends Action { public ActionForward perform( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { return aMapping.findForward(success); } } - 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 question
Hi, The action DoFirst.java isn't putting the userList bean into the request. It should be doing something like request.setAttribute(userList, userListBean); It is also using the 'perform()' method, if you are using the latest struts then you should be using the 'execute()' method instead. -- Jason Lea Mykola Ostapchuk wrote: Hello, I'm new to tiles and can't make it work. I'm trying to display users list (body - users.jsp) and get an error: [ServletException in:/users.jsp] Cannot find bean usersList in scope request' . I'm populating 'usersList' bean and put it into request in my Action class. It displays header and footer well, but not the body. The link I'm calling: /usersAdm.do tiles-defs.xml: definition name=usersPage path=/layout.jsp put name=header value=/header.jsp / put name=footer value=/footer.jsp / put name=body value=/users.jsp / /definition layout.jsp: [EMAIL PROTECTED] contentType=text/html% html:html locale=true html:base/ body tiles:insert attribute=header / tiles:insert attribute=body/ tiles:insert attribute=footer / /body /html:html struts-config.xml: actionpath=/usersAdm type=com.name.wos.struts.common.DoFirst forward name=success path=usersPage/ /action DoFirst.java: 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; public class DoFirst extends Action { public ActionForward perform( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { return aMapping.findForward(success); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles question
I have request.setAttribute(userList, userListBean); string in execute() method. My Action class works well without tiles - it returns a bean to users.jsp and I see the users list. I'm wandering if I'm using DoFirst action forward class in a right way? Maybe because of this additional forwarding all the objects in request disappear? - Original Message - From: Jason Lea [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 10:47 PM Subject: Re: Tiles question Hi, The action DoFirst.java isn't putting the userList bean into the request. It should be doing something like request.setAttribute(userList, userListBean); It is also using the 'perform()' method, if you are using the latest struts then you should be using the 'execute()' method instead. -- Jason Lea Mykola Ostapchuk wrote: Hello, I'm new to tiles and can't make it work. I'm trying to display users list (body - users.jsp) and get an error: [ServletException in:/users.jsp] Cannot find bean usersList in scope request' . I'm populating 'usersList' bean and put it into request in my Action class. It displays header and footer well, but not the body. The link I'm calling: /usersAdm.do tiles-defs.xml: definition name=usersPage path=/layout.jsp put name=header value=/header.jsp / put name=footer value=/footer.jsp / put name=body value=/users.jsp / /definition layout.jsp: [EMAIL PROTECTED] contentType=text/html% html:html locale=true html:base/ body tiles:insert attribute=header / tiles:insert attribute=body/ tiles:insert attribute=footer / /body /html:html struts-config.xml: actionpath=/usersAdm type=com.name.wos.struts.common.DoFirst forward name=success path=usersPage/ /action DoFirst.java: 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; public class DoFirst extends Action { public ActionForward perform( ActionMapping aMapping, ActionForm aForm, HttpServletRequest aRequest, HttpServletResponse aResponse) { return aMapping.findForward(success); } } - 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
Mykola Ostapchuk wrote: I have request.setAttribute(userList, userListBean); string in execute() method. My Action class works well without tiles - it returns a bean to users.jsp and I see the users list. I'm wandering if I'm using DoFirst action forward class in a right way? Maybe because of this additional forwarding all the objects in request disappear? The definitions and forwarding look correct, but the DoFirst.java code you posted only had a perform() method, and no execute() method. And the code you posted for DoFirst.java doesn't add the bean to the request. When you access /usersAdm.do, Struts will match that request to the path /userAdm in struts-config.xml. Struts will then call the perform() or execute() method of com.name.wos.struts.common.DoFirst. From the code you posted, DoFirst.java will just return a forward called success. Struts will then match that to the path usersPage, which matches the tiles definition usersPage in tiles-def.xml. Nowhere in that process was a bean added to the request. You must have a different class file which does that somewhere. -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles question
Thank you for help - now it works. I just changes mapping class to the actual one. I was looking for an example of using tiles - and found one at http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html There in Solution 6 is actually what I was trying to implement in my case. - Original Message - From: Jason Lea [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:26 PM Subject: Re: Tiles question Mykola Ostapchuk wrote: I have request.setAttribute(userList, userListBean); string in execute() method. My Action class works well without tiles - it returns a bean to users.jsp and I see the users list. I'm wandering if I'm using DoFirst action forward class in a right way? Maybe because of this additional forwarding all the objects in request disappear? The definitions and forwarding look correct, but the DoFirst.java code you posted only had a perform() method, and no execute() method. And the code you posted for DoFirst.java doesn't add the bean to the request. When you access /usersAdm.do, Struts will match that request to the path /userAdm in struts-config.xml. Struts will then call the perform() or execute() method of com.name.wos.struts.common.DoFirst. From the code you posted, DoFirst.java will just return a forward called success. Struts will then match that to the path usersPage, which matches the tiles definition usersPage in tiles-def.xml. Nowhere in that process was a bean added to the request. You must have a different class file which does that somewhere. -- Jason Lea - 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
The answer is yes. Daniel Ritchey wrote: Can a tiles definition layout path reference a Struts action path? I need to be able to dynamically select which layout to use. Thanks in advance, Dan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tiles Question
Daniel Ritchey schrieb: Can a tiles definition layout path reference a Struts action path? I need to be able to dynamically select which layout to use. Your scenario seems to be similar to the TabbedLayout example. [...]\struts-tiles\layouts\tabsLayout.jsp is doing this - although with the classic jsp approach. gus -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Tiles question - menu items
Thanks for your answer. I don't use sub-applications. I would like to organize my Struts application into several sub-applications but I don't have a lot of time to develop my application. I am scared to loose time to implement this new feature. I am convinced that I will need of this architecture in the future. If you have a simple example of sub-applications (with multiple struts-config files, source code directory organisation), I am very very interested. I will be lucky to use sub-applications in my first version. About tiles-menu sub-items, I thought that it was more easy, and that we can do it with declaration. I don't understand very well your solution, you place your code in the JSP page but in my page I have the following lines: tiles:insert page=/layouts/classicLayout.jsp flush=true tiles:put name=title value=Tiles Basic Page / tiles:put name=header value=/tiles/common/header.jsp / tiles:put name=footer value=/tiles/common/footer.jsp / tiles:put name=menu value=/tiles/simpleMenu.jsp / I don't give information about sub-items of the menu and I use message keys for Home or Member in order to do internationalisation. Have you really use JSTL Core with Tiles components ? Is it the unique solution to customize the menu for each page ? -Original Message- From: Eddie Bush [mailto:[EMAIL PROTECTED]] Sent: 16 September 2002 20:20 To: Struts Users Mailing List Subject: Re: Tiles question - menu items If you're using sub-applications, you could use the bean tags to get a bean indicating which module you're in. From there, just use a c:choose from the JSTL. I've implemented a similar solution, and it works great. The only part I don't like is having to use a RTE in order to build the bean refering to the module I'm in. I do this: %@ taglib prefix=bean uri=/tags/struts-bean % %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % bean:define id=prefix name=%= org.apache.struts.action.Action.APPLICATION_KEY % property=prefix/ That gives me the prefix of the module (empty for the default and /module for each module). Then, you can use the power of the JSTL to do: c:choose c:when test='${empty prefix}' Home /c:when c:otherwise html:link forward='toDefault'Home/html:link /c:otherwise /c:choose c:choose c:when test='${prefix == /member}' Member /c:when c:otherwise html:link forward='toMember'Member/html:link /c:otherwise /c:choose Does that shed some light? Regards, Eddie Heligon Sandra wrote: I defined a menu bar as Tiles attribute, the menu contains several sub-elements Home, Admin, Login, Help. When we are on the Admin page the Admin element has not to be available in the menu bar, we have to customize the menu for each page. We will not define a menu.jsp for each page, how is it possible for a page to indicate only the sub-elements available ? Thanks a lot -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: tiles question
1. It appears the first is a comment - an optional suggested configuration. 2. Apparently, there is a method in MessageResources that requires this declarative setting; what's the big deal? Struts is still beta, after all. -Original Message- From: Vladislav Kamensky [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:59 AM I am trying to use tiles in Struts 1.1.b and i found in the examples that tiles-defs.xml is referenced twice in application 1. web.xml !--init-param param-namedefinitions-config/param-name param-value/WEB-INF/tiles-defs.xml/param-value 2. struts-config.xml plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml ^^ . Seems that reference in the web.xml is superfluous. Am i right ? And second question: In . struts-config.xml there is following string: !-- Not used by tiles or this website, but needed due to a bug in actual Struts version -- message-resources parameter=org.apache.struts.webapp.tiles.dev1-1.ApplicationResources null=false/ What does it mean ? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
Vladislav Kamensky wrote: Hi. I am trying to use tiles in Struts 1.1.b and i found in the examples that tiles-defs.xml is referenced twice in application 1. web.xml !--init-param param-namedefinitions-config/param-name param-value/WEB-INF/tiles-defs.xml/param-value 2. struts-config.xml plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml ^^ . Seems that reference in the web.xml is superfluous. Am i right ? The plugin loads the config from web.xml, and override them with the data from struts-config.xml. This allows to have a centralized point for default values of tiles config data. And second question: In . struts-config.xml there is following string: !-- Not used by tiles or this website, but needed due to a bug in actual Struts version -- message-resources parameter=org.apache.struts.webapp.tiles.dev1-1.ApplicationResources null=false/ What does it mean ? Try to comment the tag, and check if your application complains. If not, you can remove the tag. If there is an error, uncomment the tag. This was a bug in some Struts release where an error was thrown when no ApplicationResources was specified, even if you don't use this resources. Cedric -- Vlad Kamensky, @Business SPb. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
1. It appears the first is a comment - an optional suggested configuration. No. I commented it in order to test whether it makes sence. The answer from Cedric Dumoulin seems to be truth. The plugin loads the config from web.xml, and override them with the data from struts-config.xml. This allows to have a centralized point for default values of tiles config data. 1. web.xml !--init-param param-namedefinitions-config/param-name param-value/WEB-INF/tiles-defs.xml/param-value -- Vlad Kamensky, @Business SPb. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
Hi, can I mix servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class and my own RequestProcessor with Tiles and Struts 1.1? Do I have the full functionality of Tiles while keeping the functionality of my own RequestProcessor? Or, questioned the other way round: Do I need the TilesRequestProcessor for Struts 1.1? Thanks, Udo. Wellie W. Chao wrote: What version of struts are you using? I'm using 1.1 beta 1, and the forward to tiles definition feature works just fine. My action tags look just like what you specified. You may need to check and make sure you have the proper settings in web.xml. In web.xml, you should have: servlet-nameaction/servlet-name servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class Also, in struts-config.xml, you should have: controller processorClass=org.apache.struts.tiles.TilesRequestProcessor nocache=true/ (You can change the nocache if you want) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:25 PM To: [EMAIL PROTECTED] Subject: tiles question Hi, Is it possible to call a tiles layout definition from an action tag in my struts-config.xml file? Here's the tag in my struts-config.xml: actionpath=/resources forward=site.resources.page/ Here's the definition in my tiles-defs.xml: definition name=site.resources.page extends=site.mainLayout put name=body value=/tiles/resources.jsp / /definition When I try to invoke this action forward I get an exception: java.lang.IllegalArgumentException: Path site.services.page does not start with a / character The forward tag is expecting a value like '/resources.jsp', not a tiles layout. Is what I'm trying to do possible? Thanks, Eric. ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
You need the TilesRequestProcessor and ActionComponentServlet with Struts1.1. ActionComponentServlet takes in charge Tiles initialization. TilesRequestProcessor takes in charge Struts forward catching. You can have your own request processor extending the Tiles one, allowing functionalities from both. Hope this help, Cedric Udo Walker wrote: Hi, can I mix servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class and my own RequestProcessor with Tiles and Struts 1.1? Do I have the full functionality of Tiles while keeping the functionality of my own RequestProcessor? Or, questioned the other way round: Do I need the TilesRequestProcessor for Struts 1.1? Thanks, Udo. Wellie W. Chao wrote: What version of struts are you using? I'm using 1.1 beta 1, and the forward to tiles definition feature works just fine. My action tags look just like what you specified. You may need to check and make sure you have the proper settings in web.xml. In web.xml, you should have: servlet-nameaction/servlet-name servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class Also, in struts-config.xml, you should have: controller processorClass=org.apache.struts.tiles.TilesRequestProcessor nocache=true/ (You can change the nocache if you want) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:25 PM To: [EMAIL PROTECTED] Subject: tiles question Hi, Is it possible to call a tiles layout definition from an action tag in my struts-config.xml file? Here's the tag in my struts-config.xml: actionpath=/resources forward=site.resources.page/ Here's the definition in my tiles-defs.xml: definition name=site.resources.page extends=site.mainLayout put name=body value=/tiles/resources.jsp / /definition When I try to invoke this action forward I get an exception: java.lang.IllegalArgumentException: Path site.services.page does not start with a / character The forward tag is expecting a value like '/resources.jsp', not a tiles layout. Is what I'm trying to do possible? Thanks, Eric. ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
Hi, yes this helped. If I extend TilesRequestProcessor I only have to call the super methods first and then do my stuff? Thanks, Udo Cedric Dumoulin wrote: You need the TilesRequestProcessor and ActionComponentServlet with Struts1.1. ActionComponentServlet takes in charge Tiles initialization. TilesRequestProcessor takes in charge Struts forward catching. You can have your own request processor extending the Tiles one, allowing functionalities from both. Hope this help, Cedric Udo Walker wrote: Hi, can I mix servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class and my own RequestProcessor with Tiles and Struts 1.1? Do I have the full functionality of Tiles while keeping the functionality of my own RequestProcessor? Or, questioned the other way round: Do I need the TilesRequestProcessor for Struts 1.1? Thanks, Udo. Wellie W. Chao wrote: What version of struts are you using? I'm using 1.1 beta 1, and the forward to tiles definition feature works just fine. My action tags look just like what you specified. You may need to check and make sure you have the proper settings in web.xml. In web.xml, you should have: servlet-nameaction/servlet-name servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class Also, in struts-config.xml, you should have: controller processorClass=org.apache.struts.tiles.TilesRequestProcessor nocache=true/ (You can change the nocache if you want) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:25 PM To: [EMAIL PROTECTED] Subject: tiles question Hi, Is it possible to call a tiles layout definition from an action tag in my struts-config.xml file? Here's the tag in my struts-config.xml: actionpath=/resources forward=site.resources.page/ Here's the definition in my tiles-defs.xml: definition name=site.resources.page extends=site.mainLayout put name=body value=/tiles/resources.jsp / /definition When I try to invoke this action forward I get an exception: java.lang.IllegalArgumentException: Path site.services.page does not start with a / character The forward tag is expecting a value like '/resources.jsp', not a tiles layout. Is what I'm trying to do possible? Thanks, Eric. ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
Udo Walker wrote: Hi, yes this helped. If I extend TilesRequestProcessor I only have to call the super methods first and then do my stuff? Yes. But only for methods you overload (like init(...), doInclude(...), doForward(...)). Otherwise don't care about them. Cedric Thanks, Udo Cedric Dumoulin wrote: You need the TilesRequestProcessor and ActionComponentServlet with Struts1.1. ActionComponentServlet takes in charge Tiles initialization. TilesRequestProcessor takes in charge Struts forward catching. You can have your own request processor extending the Tiles one, allowing functionalities from both. Hope this help, Cedric Udo Walker wrote: Hi, can I mix servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class and my own RequestProcessor with Tiles and Struts 1.1? Do I have the full functionality of Tiles while keeping the functionality of my own RequestProcessor? Or, questioned the other way round: Do I need the TilesRequestProcessor for Struts 1.1? Thanks, Udo. Wellie W. Chao wrote: What version of struts are you using? I'm using 1.1 beta 1, and the forward to tiles definition feature works just fine. My action tags look just like what you specified. You may need to check and make sure you have the proper settings in web.xml. In web.xml, you should have: servlet-nameaction/servlet-name servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class Also, in struts-config.xml, you should have: controller processorClass=org.apache.struts.tiles.TilesRequestProcessor nocache=true/ (You can change the nocache if you want) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:25 PM To: [EMAIL PROTECTED] Subject: tiles question Hi, Is it possible to call a tiles layout definition from an action tag in my struts-config.xml file? Here's the tag in my struts-config.xml: actionpath=/resources forward=site.resources.page/ Here's the definition in my tiles-defs.xml: definition name=site.resources.page extends=site.mainLayout put name=body value=/tiles/resources.jsp / /definition When I try to invoke this action forward I get an exception: java.lang.IllegalArgumentException: Path site.services.page does not start with a / character The forward tag is expecting a value like '/resources.jsp', not a tiles layout. Is what I'm trying to do possible? Thanks, Eric. ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
Yes it is ;-) Have you specify to use the appropriate Tiles processor (if struts1.1) or tiles action servlet (struts1.0.x) ? In struts1.1, add following to your struts-config file : !-- Here we specified the tiles processor -- controller processorClass=org.apache.struts.tiles.TilesRequestProcessor /controller In struts 1.0, specify to use ComponentActionServlet in web.xml. Check documentation or examples. Other users have already got this problem, check struts archive for Weird problem with tiles and struts forward. Hope this help, Cedric [EMAIL PROTECTED] wrote: Hi, Is it possible to call a tiles layout definition from an action tag in my struts-config.xml file? Here's the tag in my struts-config.xml: actionpath=/resources forward=site.resources.page/ Here's the definition in my tiles-defs.xml: definition name=site.resources.page extends=site.mainLayout put name=body value=/tiles/resources.jsp / /definition When I try to invoke this action forward I get an exception: java.lang.IllegalArgumentException: Path site.services.page does not start with a / character The forward tag is expecting a value like '/resources.jsp', not a tiles layout. Is what I'm trying to do possible? Thanks, Eric. ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tiles question
Hi Struts, etco Is it possible to call a tiles layout definition from an action tag in my etco struts-config.xml file? etco Here's the tag in my struts-config.xml: etco actionpath=/resources etcoforward=site.resources.page/ etco Here's the definition in my tiles-defs.xml: etco definition name=site.resources.page extends=site.mainLayout etco put name=body value=/tiles/resources.jsp / etco /definition etco When I try to invoke this action forward I get an exception: etco java.lang.IllegalArgumentException: Path site.services.page does not start etco with a / character etco The forward tag is expecting a value like '/resources.jsp', not a tiles etco layout. Is what I'm trying to do possible? I have the same problem with struts1.1b1. The doc says that it should be used like you said so long Ingo Bruell --- [EMAIL PROTECTED] [EMAIL PROTECTED] ICQ# 40377720 OldenburgPGP-Fingerprint: CB01 AE12 B359 87C4 BF1C 953C 8FE7 C648 169E E5FC Germany PGP-Public-Key available at pgpkeys.mit.edu -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: tiles question
What version of struts are you using? I'm using 1.1 beta 1, and the forward to tiles definition feature works just fine. My action tags look just like what you specified. You may need to check and make sure you have the proper settings in web.xml. In web.xml, you should have: servlet-nameaction/servlet-name servlet-classorg.apache.struts.tiles.ActionComponentServlet/servlet-class Also, in struts-config.xml, you should have: controller processorClass=org.apache.struts.tiles.TilesRequestProcessor nocache=true/ (You can change the nocache if you want) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 5:25 PM To: [EMAIL PROTECTED] Subject: tiles question Hi, Is it possible to call a tiles layout definition from an action tag in my struts-config.xml file? Here's the tag in my struts-config.xml: actionpath=/resources forward=site.resources.page/ Here's the definition in my tiles-defs.xml: definition name=site.resources.page extends=site.mainLayout put name=body value=/tiles/resources.jsp / /definition When I try to invoke this action forward I get an exception: java.lang.IllegalArgumentException: Path site.services.page does not start with a / character The forward tag is expecting a value like '/resources.jsp', not a tiles layout. Is what I'm trying to do possible? Thanks, Eric. ** This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. TIAA-CREF ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically?
Hello, Cedric: Thank you for responding to my question. As you stated, I can add/overload an attribute in the current context. Specifically, I am adding a new item to an existing list. However, each item in the list is the key to a Tile definition. Most of the definitions are in the XML file, but I want to add a new Tile definition dynamically so that the new item in the list is a reference to the new Tile definition. Is this possible? Thanks again, Chris -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 10:29 AM To: Struts Users Mailing List Subject: Re: Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically? Hello, If you are in a tile controller, you don't have to create a new ComponentDefinition, you can set the attributes of the current tiles (because you are in the controller). To add / overload an attribute in the context, do something like : String attribute = (String)context.getAttribute(attributeName); attribute = new value; context.setAttribute(attributeName, attribute); To add a list, create the list, add elements, and add the list to context. You can overload a previously defined list. Do not modify content of an existing list, because it is shared between inherited instances. : List list = new java.util.ArrayList(); list.add( a value ); list.add( another value); context.setAttribute(listAttributeName, list); Hope this help, Cedric P.S. : The DefinitionsUtil.setActionDefinition( aDefinition ); is to be used when you are inside a Struts action called by Struts mechanism. It has not effect when used inside a tile controller Chris Cool wrote: Hi, I have a tile that reads items from a PutList list and then inserts each item into the current page. struts_logic:iterate id=item name=itemList scope=page type=String tiles:insert name='%=item%' flush=true/ /struts_logic:iterate When the items in the list are tiles defined in my tileDefinitions.xml file, the tiles are inserted into my JSP correctly. However, I want to dynamically create a tile definition and insert it into the page context. I am generating the ComponentDefinition in my tile controller and accessing the itemList where I add the name of the dynamically generated definition: /* get the item list and insert new tile def into it */ ArrayList itemList = (ArrayList)context.getAttribute(itemList); if (itemList != null) { HashMap map = new HashMap(); map.put(name, newtarget); map.put(link, newtarget.do); ComponentDefinition newItem = new ComponentDefinition(new.item, /mytiles/simpleItem.jsp, map); DefinitionsUtil.setActionDefinition( request, breadCrumbItem ); itemList.add(new.item); } In my tile, the itemList contains the new.item entry, but it does not appear to find the ComponentDefinition I created. Thanks for you help. Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically?
Yes and no ;-) No, this is not a feature directly supported by Tiles Yes, as you have sources, and you know which definition factory you use, you can add directly a definition to the factory. How : create definition, retrieve the factory from context, cast it to its real implementation, use available methods to add definition. This added definition will be available from all your application. Be care to not overwrite an existing definition ! Cedric Chris Cool wrote: Hello, Cedric: Thank you for responding to my question. As you stated, I can add/overload an attribute in the current context. Specifically, I am adding a new item to an existing list. However, each item in the list is the key to a Tile definition. Most of the definitions are in the XML file, but I want to add a new Tile definition dynamically so that the new item in the list is a reference to the new Tile definition. Is this possible? Thanks again, Chris -Original Message- From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 10:29 AM To: Struts Users Mailing List Subject: Re: Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically? Hello, If you are in a tile controller, you don't have to create a new ComponentDefinition, you can set the attributes of the current tiles (because you are in the controller). To add / overload an attribute in the context, do something like : String attribute = (String)context.getAttribute(attributeName); attribute = new value; context.setAttribute(attributeName, attribute); To add a list, create the list, add elements, and add the list to context. You can overload a previously defined list. Do not modify content of an existing list, because it is shared between inherited instances. : List list = new java.util.ArrayList(); list.add( a value ); list.add( another value); context.setAttribute(listAttributeName, list); Hope this help, Cedric P.S. : The DefinitionsUtil.setActionDefinition( aDefinition ); is to be used when you are inside a Struts action called by Struts mechanism. It has not effect when used inside a tile controller Chris Cool wrote: Hi, I have a tile that reads items from a PutList list and then inserts each item into the current page. struts_logic:iterate id=item name=itemList scope=page type=String tiles:insert name='%=item%' flush=true/ /struts_logic:iterate When the items in the list are tiles defined in my tileDefinitions.xml file, the tiles are inserted into my JSP correctly. However, I want to dynamically create a tile definition and insert it into the page context. I am generating the ComponentDefinition in my tile controller and accessing the itemList where I add the name of the dynamically generated definition: /* get the item list and insert new tile def into it */ ArrayList itemList = (ArrayList)context.getAttribute(itemList); if (itemList != null) { HashMap map = new HashMap(); map.put(name, newtarget); map.put(link, newtarget.do); ComponentDefinition newItem = new ComponentDefinition(new.item, /mytiles/simpleItem.jsp, map); DefinitionsUtil.setActionDefinition( request, breadCrumbItem ); itemList.add(new.item); } In my tile, the itemList contains the new.item entry, but it does not appear to find the ComponentDefinition I created. Thanks for you help. Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tiles question: Is it possible to insert a ComponentDefinition into a Tile context dynamically?
Hello, If you are in a tile controller, you don't have to create a new ComponentDefinition, you can set the attributes of the current tiles (because you are in the controller). To add / overload an attribute in the context, do something like : String attribute = (String)context.getAttribute(attributeName); attribute = new value; context.setAttribute(attributeName, attribute); To add a list, create the list, add elements, and add the list to context. You can overload a previously defined list. Do not modify content of an existing list, because it is shared between inherited instances. : List list = new java.util.ArrayList(); list.add( a value ); list.add( another value); context.setAttribute(listAttributeName, list); Hope this help, Cedric P.S. : The DefinitionsUtil.setActionDefinition( aDefinition ); is to be used when you are inside a Struts action called by Struts mechanism. It has not effect when used inside a tile controller Chris Cool wrote: Hi, I have a tile that reads items from a PutList list and then inserts each item into the current page. struts_logic:iterate id=item name=itemList scope=page type=String tiles:insert name='%=item%' flush=true/ /struts_logic:iterate When the items in the list are tiles defined in my tileDefinitions.xml file, the tiles are inserted into my JSP correctly. However, I want to dynamically create a tile definition and insert it into the page context. I am generating the ComponentDefinition in my tile controller and accessing the itemList where I add the name of the dynamically generated definition: /* get the item list and insert new tile def into it */ ArrayList itemList = (ArrayList)context.getAttribute(itemList); if (itemList != null) { HashMap map = new HashMap(); map.put(name, newtarget); map.put(link, newtarget.do); ComponentDefinition newItem = new ComponentDefinition(new.item, /mytiles/simpleItem.jsp, map); DefinitionsUtil.setActionDefinition( request, breadCrumbItem ); itemList.add(new.item); } In my tile, the itemList contains the new.item entry, but it does not appear to find the ComponentDefinition I created. Thanks for you help. Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Tiles question: Using bean:message inside tiles:put
i use this technique all the time, though i specify the type (can't remember why...): tiles:put name=title type=string bean:message key=commissions.signingBonus.title/ /tiles:put ab -Original Message- From: Molitor, Stephen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 10:37 AM To: 'Struts Users Mailing List'; [EMAIL PROTECTED] Subject: Tiles question: Using bean:message inside tiles:put Is it OK to use bean:message to look up a message inside a tiles:put tag? For example: tiles:put name=title bean:message key=commissions.signingBonus.title/ /tiles:put The instantiating page might get the title like this: titletiles:getAsString name=title//title Is anyone else doing this? Usually this works for me, but sometimes the servlet container (WebLogic SP8) blows up on the getAsString. Thanks! Steve Molitor [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tiles Question
Hi, I have no ideas on an xml/xsl architecture using tiles. But, for dynamic portal, I have added such an example in the latest distribution (tiles/tutorial/dynPortal). This example allows to choose tiles to render in portal. You can choose in a list of available tiles, and move tiles between columns. It is not difficult to extend this example to select dynamically the layout used for the portal. Hope this help, Cedric [EMAIL PROTECTED] wrote: Cedric, The response time seems OK , I ported it on another weblogic box and it seems OK now. Another question on tiles: What is your view on using an xml/xsl architecture in the jsp pages ( tiles) instead of having just plain html, I mean even for the layouts, An example would be my.yahoo.com kindof personilized portal, which allows the users to change the layout as they please. albeit that these are predefined layouts out of which the user chooses one. I am wondering how I could implement a personalized portal in which the users could choose what tile they wish to see or even the admin setting some kindof security setting such that all users can view 5/6 tiles in my layout , whereas a few managers are able to see the 6th tile. I could generate the basic page dynamically but I wanted to get your inputs ?? Thanks Srini