This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Do what, use the <html:frame> tag, use the HTML anchor tag's "target" attribute correctly, or writing all your code in the JSP?
If you're talking about using the anchor tag: in your example you're using the "href" value for the "target" attribute. If you're having issues with frames and HTML tags you'll probably want to post in the HTML forum--once you get the basic HTML worked out *then* you can get back to the Struts stuff.
If you're talking about writing all your code in the JSP, there's almost never any reason to do this. The reason servlets and JSPs exist is to separate code and presentation. The reason Struts exists is to further the abstraction: Java code should be written in Java files, JSP should be used to present data processed in the Java files.
Besides, the HTML you posted does not seem to be well-formed: issues like this can be seen readily when indentation is used consistently. Here you're starting a new table row inside a table cell, are opening potentially multiple div tags and never closing them, don't close the try/catch block, and so on. In short, it's a mess.It's easy to see when this is formatted consistently that something has gone wrong.
Besides the malformed HTML:
* None of this Java code should be in the JSP. It should be in a service object used by the action.
* The "tree.xml" file should be either on the classpath or use a path relative to the server context.
* It should be cached, otherwise you're parsing XML *every* time the page is loaded.
* If the attribute map is a *map* then why are you *iterating* over it to get the ID?! It's a map: get it using map access.
* The table cell containing everything has a height attribute of "1". That's really short, and almost certainly not what you want.
This would lead to JSP code much closer to the following (although not really understanding the structure you posted some of it is just a close approximation:I'd also consider moving the code for each individual line into a JSP-based custom tag file; this would clean up the main JSP page considerably, leading to the even cleaner:You're welcome! Consider having your employer make a donation.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com