|
What is the best way to include an external tile in a template definition?
For example, suppose I have an a web application called INTERNAL. I have reusable view components in another application called EXTERNAL. So I want http://server:1234/INTERNAL/eligibilitySearch/search.action to include a common customer tile located in the EXTERNAL application. My definition I am imagining would look something like this: <definition name="layout.content " template="/WEB-INF/webtiles/search/searchLayout.jsp"> <put-attribute name="customer" type="redirect" value="/EXTERNAL/tiles/DisplayCustomerTile.jsp" /> </definition> Of course, the URL is not found, because value refers to the application context. I know there is not a type called redirect, but that is the type of functionality I'm looking for, to reset the context so that an external tile can be included in the definition. Regards, Brian Stewart This message is confidential, intended only for the named recipient and may contain information that is privileged or exempt from disclosure under applicable law. If you are not the intended recipient, you are notified that the dissemination, distribution or copying of this message is strictly prohibited. If you receive this message in error, or are not the named recipient, please notify the sender at the email address listed above. |
|
2009/11/23 Brian Stewart <[hidden email]>:
> What is the best way to include an external tile in a template definition? There is no way, currently, to include an external resource at all. > <definition name="layout.content " template="/WEB-INF/webtiles/search/searchLayout.jsp"> > <put-attribute name="customer" type="redirect" value="/EXTERNAL/tiles/DisplayCustomerTile.jsp" /> > </definition> However you got the right path: probably the best way is to create a renderer that manages external resources. For info about renderers see: http://tiles.apache.org/2.1/framework/tutorial/advanced/attribute-rendering.html or http://tiles.apache.org/framework/tutorial/advanced/attribute-rendering.html (for Tiles 2.2.x) You might be interested in the HTTPClient project, to connect to the resource: http://hc.apache.org/httpcomponents-client/index.html Ciao Antonio |
|
I'm having a similar problem and was hoping someone could post sample code. I'm a front-end developer and am not too comfortable with Java but need to write this custom renderer so I can get to the front-end JSP components.
So similar to Brian, I would like to be able to refer to a JSP template that is located in another application. This is because the header template, for example, is identical across six web application, and my goal is to have one common application that contains all the common templates and refer to these templates in all six other web applications. I attempted to write a renderer but as I mentioned above, I don't really know what I'm doing and since it appears to be fairly straight forward for experienced Java developers, I was hoping someone could post the classes needed to implement this solution. Thanks |
|
No kape, you haven't a "similar problem", please do not hijack others'
threads and start your own asking what you need. Antonio 2011/9/26 kape <[hidden email]> > I'm having a similar problem and was hoping someone could post sample code. > I'm a front-end developer and am not too comfortable with Java but need to > write this custom renderer so I can get to the front-end JSP components. > > So similar to Brian, I would like to be able to refer to a JSP template > that > is located in another application. This is because the header template, > for > example, is identical across six web application, and my goal is to have > one > common application that contains all the common templates and refer to > these > templates in all six other web applications. > > I attempted to write a renderer but as I mentioned above, I don't really > know what I'm doing and since it appears to be fairly straight forward for > experienced Java developers, I was hoping someone could post the classes > needed to implement this solution. > > Thanks > > -- > View this message in context: > http://struts.1045723.n5.nabble.com/Including-External-Tiles-in-a-Template-tp3552714p4842776.html > Sent from the tiles users mailing list archive at Nabble.com. > |
|
First of all, I'm really disappointed at how helpful your response was Antonio. Second of all, how is my problem not similar? It's the EXACT same problem. I want to "include an external tile in a template definition" which is exactly what Brian was asking for. I merely asked for an example. Thanks anyway.
|
|
2011/9/27 kape <[hidden email]>
> First of all, I'm really disappointed at how helpful your response was > Antonio. Second of all, how is my problem not similar? It's the EXACT > same > problem. I want to "include an external tile in a template definition" > which is exactly what Brian was asking for. I merely asked for an example. > Thanks anyway. > > Sorry I mistook this thread, I thought it was another. Anyway this thread is about a thing 2 years ago. Please start another thread, we have not such memory :-D So please, if you want to reintroduce this topic, start a new thread. Antonio |
|
In reply to this post by kape
Hi!
As Antonio pointed out, this is a rather old thread and you may have easier solutions nowadays, depending on what you're trying to achieve. If you just want to avoid code duplication, you've got a real problem with JSP before JavaEE 6. Grouping common JSPs in a separate webapp will just lead to more trouble because each webapp maintains its own user session (and authentication, unless you're using SSO, which is not trivial either). With JavaEE 6 you can put JSPs under META-INF/resources into a simple JAR file, and share the JAR like any other JAR between your webapps. With older servers, I'd advise a switch to velocity or freemarker: since the template engine is under the control of the application and not the server, it will provide you with the flexibility you need. hope this helps, Nick On 11-09-26 04:15 PM, kape wrote: > I'm having a similar problem and was hoping someone could post sample code. > I'm a front-end developer and am not too comfortable with Java but need to > write this custom renderer so I can get to the front-end JSP components. > > So similar to Brian, I would like to be able to refer to a JSP template that > is located in another application. This is because the header template, for > example, is identical across six web application, and my goal is to have one > common application that contains all the common templates and refer to these > templates in all six other web applications. > > I attempted to write a renderer but as I mentioned above, I don't really > know what I'm doing and since it appears to be fairly straight forward for > experienced Java developers, I was hoping someone could post the classes > needed to implement this solution. > > Thanks > > -- > View this message in context: http://struts.1045723.n5.nabble.com/Including-External-Tiles-in-a-Template-tp3552714p4842776.html > Sent from the tiles users mailing list archive at Nabble.com. |
| Powered by Nabble | Edit this page |
