Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #246: Header must be fetched from jakarta.ee #293

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

yashTEF
Copy link

@yashTEF yashTEF commented Jan 10, 2024

PR for #246

This PR addresses changes required for fetching the header/footer html fragments from: https://jakarta.ee.

@eclipse-starter-bot
Copy link

Can one of the admins verify this patch?

@yashTEF
Copy link
Author

yashTEF commented Jan 10, 2024

While the changes do the job of fetching the header and footer fragments, there are still some menu links which have relative path as source which will need to be converted to absolute(refer: #246 (comment)) for this PR to be successfully merged.

@autumnfound, I can submit a patch to https://github.com/jakartaee/jakarta.ee for the changes required in the templates for you to review?

@autumnfound
Copy link

@autumnfound, I can submit a patch to https://github.com/jakartaee/jakarta.ee for the changes required in the templates for you to review?

If you feel comfortable submitting a patch, absolutely! Otherwise, you can create an issue and we can triage and take care of it in the near future as well.

@yashTEF yashTEF changed the title [WIP] Fix #246 Fix #246 Jun 1, 2024
@yashTEF
Copy link
Author

yashTEF commented Jun 1, 2024

@kito99, this PR is functional and maybe reviewed now.

@m-reza-rahman while this PR addresses the issue of fetching the headers/footers,
I am not sure how the layout and styling for the UI are supposed to work as the existing starter UI available at: https://start.jakarta.ee is quite different to the above proposed.

Copy link
Contributor

@m-reza-rahman m-reza-rahman Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be done every time? It looks like this is static. Why can't be do this in the Maven build too? Also, why can’t we just directly include the file if it can be valid XHTML?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my first time seeing this PR. My first impression is that using the JSF Facelets <ui:include> feature is an easier way to accomplish what the FetchHtmlUtility is doing.

At a very high level, using Java code to generate markup is an anti-pattern. A more current (but certainly not the only) way to do it is to keep in XHTML as much as possible and use Expression Language elements in the XHTML to pull in the parts that need to be dynamic.

This is a StackOver Flow question that talks about this. https://stackoverflow.com/questions/8947425/how-to-conditionally-include-a-file-in-my-template-using-jsf-and-facelets

Copy link
Author

@yashTEF yashTEF Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some existing XHTML code present in the topbar.xhtml which was needed along with the html code fetched from the url, some parsing along with placing the code inside ui:composition tag made me think of the above approach as it was a bit straightforward but as Reza mentioned I did not take into the consideration the performance issue of doing the above repeatedly.

I'll try to find some out of the box feature present in maven plugins which does the above so that all of this can be done during the build itself.

Copy link
Contributor

@m-reza-rahman m-reza-rahman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this now ready to merge? If so, can you address the question?

Copy link

@edburns edburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-reza-rahman m-reza-rahman changed the title Fix #246 Fix #246: Header must be fetched from jakarta.ee Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants