<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>JSP customization by using 'Dynamic includes' approach</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121982799" />
  <subtitle>JSP customization by using 'Dynamic includes' approach</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121982799</id>
  <updated>2026-04-06T20:16:39Z</updated>
  <dc:date>2026-04-06T20:16:39Z</dc:date>
  <entry>
    <title>RE: RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121985328" />
    <author>
      <name>txapeldot .</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121985328</id>
    <updated>2023-08-18T07:48:18Z</updated>
    <published>2023-08-18T07:48:17Z</published>
    <summary type="html">&lt;p&gt;Hi David, thanks for your reply.&lt;/p&gt;
&lt;p&gt;I'm really sorry but I don't see your point. You suggest I fix the
  original code, but the original code is the code of the Liferay's
  out-of-the-box Document and Media Portlet; it sounds kind a
  intimidating doing such a thing like that.&lt;/p&gt;
&lt;p&gt;Since I'm a newcomer to world of the customization of Liferay's
  Portlets, I think I'm going to embrace the Fragment Bundle based
  solution. When I become a more experienced developer I'll come back to
  the portlet configuration based solution you propose. Thanks.&lt;/p&gt;</summary>
    <dc:creator>txapeldot .</dc:creator>
    <dc:date>2023-08-18T07:48:17Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121985066" />
    <author>
      <name>txapeldot .</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121985066</id>
    <updated>2023-08-18T07:32:12Z</updated>
    <published>2023-08-18T07:32:11Z</published>
    <summary type="html">&lt;p&gt;As for the Portlet Filter based solution, I was thinking about
  trasforming the text-based response to an XML-based response, so that
  it can be easily manipulable; then, and once removed/added the
  intended/needed xml elements, converting the modified XML-based
  response to a text-based response to be sent to the client. But it
  might still be being a recipe for a disaster...&lt;/p&gt;
&lt;p&gt;Regarding the Fragment Bundle based solution you propose, I see your
  point! And the idea of decomposing a single page into individual pages
  is more than an elegant solution. Thanks a lot.&lt;/p&gt;</summary>
    <dc:creator>txapeldot .</dc:creator>
    <dc:date>2023-08-18T07:32:11Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121984651" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121984651</id>
    <updated>2023-08-17T22:12:15Z</updated>
    <published>2023-08-17T22:12:14Z</published>
    <summary type="html">&lt;p&gt;I would not use a portlet filter for this. The portlet filter needs
  to basically buffer the rendered response from the portlet, then it
  needs to manipulate it without breaking it...&lt;/p&gt;
&lt;p&gt;It's a recipe for disaster.&lt;/p&gt;
&lt;p&gt;Using the D&amp;amp;M as your example, you can see where the entries are
  being handled by the view_entries.jsp file. So if you added or removed
  columns, a JSP fragment bundle gets the job done.&lt;/p&gt;
&lt;p&gt;It doesn't need to be overly complicated and have all kinds of
  &amp;quot;dynamic includes&amp;quot; to support changing the columns. Adding
  that in for your own implementation just makes things more complicated
  and is typically not something that users of your portlet will take
  advantage of.&lt;/p&gt;
&lt;p&gt;You know how many &amp;quot;dynamic includes&amp;quot; I have written for my
  many years of Liferay development? Zero. They're typically at the
  wrong place, don't allow me to remove things that shouldn't be there
  and basically they have zero benefit to me as a customizer.&lt;/p&gt;
&lt;p&gt;You know how many fragment bundles I have written? Too many to keep
  track of. If I need to manipulate a JSP, the fragment bundle is the
  right way to do it and the only way to have total control over what is changed.&lt;/p&gt;
&lt;p&gt;You can promote this by decomposing a single page w/ all columns into
  individual JSP files that are included by a main one, or you can just
  have the table managed by a single JSP that's easy to override. Either
  way, it is better taking this route than trying to figure out what
  someone &lt;em&gt;might&lt;/em&gt; want to do with a dynamic include.&lt;/p&gt;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2023-08-17T22:12:14Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121984589" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121984589</id>
    <updated>2023-08-17T22:03:20Z</updated>
    <published>2023-08-17T22:03:19Z</published>
    <summary type="html">&lt;p&gt;So the &amp;quot;liferay way&amp;quot; (if we could call it that) is to use a
  separate jsp(f) file for the column guys.&lt;/p&gt;
&lt;p&gt;That way, if you needed to change the columns, a simple fragment
  bundle will get you there.&lt;/p&gt;
&lt;p&gt;But again, I wouldn't do this for code that you own. I mean, you have
  the code for the original, just fix the original code and mark it as done.&lt;/p&gt;
&lt;p&gt;This kind of thing is only useful when someone else, who doesn't have
  the code for the original, wants to affect their own changes. But
  separating it out to its own JSP means it can be easily changed (from
  the column perspective) to include/exclude what you want via a
  fragment bundle.&lt;/p&gt;
&lt;p&gt;Personally, though, I'd forget all of this. I'd have portlet
  configuration set up so you could show/hide some columns and then
  leverage that configuration for the rendering of the portlet. If end
  users need some control over which columns are displayed, you can give
  them that ability without having them code up some sort of JSP
  solution to get the job done.&lt;/p&gt;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2023-08-17T22:03:19Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121984025" />
    <author>
      <name>txapeldot .</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121984025</id>
    <updated>2023-08-17T07:27:26Z</updated>
    <published>2023-08-17T07:27:25Z</published>
    <summary type="html">&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Maybe I didn't express myself correctly, I didn't talk about adding
  my own tags into a own JSP file but adding the
  '&amp;lt;liferay-util:dynamic-include&amp;gt;' tag in other places within a
  .jsp file of a Liferay portlet, other that the top and bottom places
  where they are already placed.&lt;/p&gt;
&lt;p&gt;Just for setting out a concrete example, what I'm facing is the
  customization of the jsp(s) files in charge of displaying the
  documents in the Liferay's Documents &amp;amp; Media portlet. Let's
  suppose (on the basis that the documents are displayed on a
  table-displaying setting), I want to remove the 'status' column and I
  want to add an additional column showing a value from an expando (for instance).&lt;/p&gt;
&lt;p&gt;I concluded (I might be wrong) it's not possible to accomplish the
  intended task on the basis of a 'Dynamic include' approach, mainly
  because I need to remove elements of a .jsp file.&lt;/p&gt;
&lt;p&gt;Do you think the Liferay's'Portlet Filter' approach is valid for the
  intended task?&lt;/p&gt;</summary>
    <dc:creator>txapeldot .</dc:creator>
    <dc:date>2023-08-17T07:27:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121983958" />
    <author>
      <name>txapeldot .</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121983958</id>
    <updated>2023-08-17T07:12:20Z</updated>
    <published>2023-08-17T07:12:19Z</published>
    <summary type="html">&lt;p&gt;Thank you very much for your reply.&lt;/p&gt;
&lt;p&gt;Maybe my initial question was very general, and I think I should
  narrow it, because when I talk about customization of .jsp files, I
  mean customization of .jsp files of Liferay portlets. Setting out a
  concrete example, what I'm facing is the customization of the jsp(s)
  files in charge of displaying the documents in the Liferay's Documents
  &amp;amp; Media portlet.&lt;/p&gt;
&lt;p&gt;Let's suppose (on the basis that the documents are displayed on a
  table-displaying setting), I want to remove the 'status' column and I
  want to add an additional column showing a value from an expando (for instance).&lt;/p&gt;
&lt;p&gt;From your reply, I know I won't be allowed to change the content of
  the corresponding JSP, so the Liferay's 'Dynamic include' approach is
  not a valid approach for the intended task. Moreover,
  the '&amp;lt;liferay-util:dynamic-include&amp;gt;' tags are placed at the top
  and bottom of the JSP page, which is useless for the intended task.&lt;/p&gt;
&lt;p&gt;In your opinion, what is the rigth approach I should embrace to
  accomplish the intended task? Maybe 'Fragment bundles'? BTW, when you
  say 'fragment bundle' you mean 'OSGi fragments', don't you? But this
  approach is discouraged by Liferay, isn't it?.&lt;/p&gt;</summary>
    <dc:creator>txapeldot .</dc:creator>
    <dc:date>2023-08-17T07:12:19Z</dc:date>
  </entry>
  <entry>
    <title>RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121982891" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121982891</id>
    <updated>2023-08-18T07:49:01Z</updated>
    <published>2023-08-16T15:35:18Z</published>
    <summary type="html">&lt;p&gt;Dynamic includes work for Liferay JSPs that already support them. It
  allows you to inject code (typically at the top and bottom of the JSP
  page), but won't allow you to change the &lt;em&gt;content&lt;/em&gt; of the JSP itself.&lt;/p&gt;
&lt;p&gt;You can add dynamic includes to existing pages, but you'd need to use
  a fragment bundle to override the JSP to do that. And then you need to
  ask yourself, if I'm already doing a fragment bundle to change the
  JSP, why just insert a dynamic include when I can just put my changes
  directly in and be done with it?&lt;/p&gt;
&lt;p&gt;Finally, you might also consider adding a dynamic include into your
  own JSP files. There's nothing wrong with that and may allow you to
  ship a portlet and let customizers have the chance to introduce JSP
  w/o having to override your portlet. But the use cases here are going
  to be pretty few, yeah? I mean, if you write a custom portlet you
  already have control over the JSP, so adding a dynamic include would
  only &lt;em&gt;complicate&lt;/em&gt; your portlet, so you would only do this if
  you really needed that kind of flexibility.&lt;/p&gt;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2023-08-16T15:35:18Z</dc:date>
  </entry>
  <entry>
    <title>RE: JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121982755" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121982755</id>
    <updated>2023-08-16T14:56:32Z</updated>
    <published>2023-08-16T14:56:31Z</published>
    <summary type="html">&lt;p&gt;You can totally add your own tags (or rather those tags with your own
  keys) - to Liferay's as well as to your own JSPs.&lt;/p&gt;
&lt;p&gt;Personally, if I really really &lt;em&gt;really&lt;/em&gt;
  &lt;em&gt;have to&lt;/em&gt; override a JSP, I even prefer to leave the original
  JSP as unchanged as possible, and introduce everything I need in a
  dynamic include. Sometimes the nature of the change makes it work,
  sometimes it doesn't.&lt;/p&gt;
&lt;p&gt;However, if adding a single DI is easy, typically writing a portlet
  filter is similarly easy. And that filter is - at least typically, for
  me - easier to maintain.&lt;/p&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2023-08-16T14:56:31Z</dc:date>
  </entry>
  <entry>
    <title>JSP customization by using 'Dynamic includes' approach</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121982798" />
    <author>
      <name>txapeldot .</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121982798</id>
    <updated>2023-08-16T13:42:56Z</updated>
    <published>2023-08-16T13:42:06Z</published>
    <summary type="html">&lt;p&gt;Regarding the 'Dynamic includes' approach Liferay encourages to use
  for JSP customization, is it possible to add
  '&amp;lt;liferay-util:dynamic-include&amp;gt;' additional tags wherever you
  want within a .jsp file, or, on the contrary, are you forced to work
  with the '&amp;lt;liferay-util:dynamic-include&amp;gt;' tags included by
  default within the .jsp file?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</summary>
    <dc:creator>txapeldot .</dc:creator>
    <dc:date>2023-08-16T13:42:06Z</dc:date>
  </entry>
</feed>
