-
Notifications
You must be signed in to change notification settings - Fork 765
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
Fixing issue #4122 #4124
Fixing issue #4122 #4124
Conversation
I would do a small change.
WDYT? |
I guess, if there is no row, just an empty tbody ( when grid.getChildren() is empty ), a closing tr will be placed on the output, which will be invalid again |
I hope I understand well, what do you mean. If I undertand well, the tdody will be always writen out, and the encodeDynamicBody will be always called, if the columns attribute is larger then 0. But it is not the actual number of elements in the PanelGrid component. So if you specify columns=2, and do not put any single component inside the PanelGrid, wrong output is generated, if you do your suggestions. public void encodeTableBody(FacesContext context, PanelGrid grid, int columns) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("tbody", grid);
if (columns > 0) {
encodeDynamicBody(context, grid, grid.getColumns());
}
else {
encodeStaticBody(context, grid);
}
writer.endElement("tbody");
} |
Not sure, i just don't like the naming probably. It feels not correct as the default value is true (and we don't know yet if the row will be closed really) |
Maybe the name isn't perfect, but this variable is for signaling if we should close a row in the end or not. I’m quite sure that the modification you suggested would result a closing tr without an opening one, if there is no item in the panelGrid. I haven't tested it, but seeing the code, I'm quite certain. |
WDYT about if we count the closing and opening trs? if (opening > closing) { I think it's much easier to read and to understand the actual logic. |
Your suggestion seems right to me. I’d like to ask your opinion on a situation. The error in the panelGrid is obvious. But I’m even more concerned about the JSF 2.3 implementation, which I think is very dangerous with this incorrectly implemented tag renaming functionality. Besides my case there is a similar one (jboss/mojarra#21), and I’m sure as people starting to move towards JSF 2.3 it is likely that the number problems it causes will rise. I’m worried about the future magical errors it will cause in our systems. I opened an issue about this bug at the JSF project: The JSF development team closed this issue despite the fact how vulnerable JSF become to component rendering problems, like this one we are about to fix. Do you think the behavior of the JSF implementation should be accepted? |
I always have 2 opinions in such cases :D
I will apply my change now, hope you can retest it then. |
The problem with MyFaces does not exists. Unfortunately wildfly uses mojarra. |
Yes, i'm aware of that. But the goal should be that PrimeFaces always produces correct HTML and no "hacks/failsafe features" should be required in the JSF impls. |
Actually there is no need for doing hacks. The HtmlResponseWriter’s endElement method do not receive the componentForElement parameter, and has no information about passthrough attributes, so the elementNames stack away was introduced as a hack, causing troubles. I have several ideas how to modify the current implementation to become safer. But my idea isn’t perfect, and I still hope the JSF team will solve this problem better than I can. |
Fixing the issue descibed here: #4122