File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts Loop breaks at specific number of characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Loop breaks at specific number of characters" Watch "Struts Loop breaks at specific number of characters" New topic
Author

Struts Loop breaks at specific number of characters

David D Myers
Greenhorn

Joined: Dec 14, 2011
Posts: 3
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?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8895
    
    8

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?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Loop breaks at specific number of characters