This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a jsp which has a struts loop "logic:iterate" which displays all of the delivery basis entries in the database. However, once the loop has output a specific number of characters to the screen, it stops all output and the entire page breaks immediately.
The specific number of characters is evidenced by the fact that removing one character from what the loop outputs each iteration results in the loop outputting what appears as more of the page. For example the current loop looks like this:
There are currently 18 rows in the delivery basis table, but the break is happening before the loop can finish. As a result this loop outputs 12 tr's but on the last iteration it only gets as far as the "<a" for the removal link. Let's say you remove 1 character from the code, for example deleting 1 character from the href value. By doing this the number of characters output each iteration will decrease by 1. This will make the loop appear as if it outputs more of the code, when in reality it is outputting the exact same amount of characters.
In our example instead of stopping at "<a" the loop will stop at '<a style="text'. At first glance it would appear as if more characters had been output, but if you remember that we decreased the number of characters output during each iteration by 1, and the fact the there are currently 12 iterations, you realize that the same overall amount of characters has been output. If you notice, ' style="text' is exactly 12 characters.
My question is what could be causing this to happen? Is there a setting or configuration in the code that needs to be set properly?
David D Myers wrote:
My question is what could be causing this to happen?
My wild guess is that your server is buffering output, so your browser is receiving data in chunks and you are getting the latest chunk that has been completed before the error occurs in your processing. By tweaking the JSP, you can change what gets written to the browser before output terminates. While this is interesting behavior, it is not really relevant to the actual problem.
What causes the page to stop processing? Do you get an exception in the logs or console?