File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Same html:multibox tag - different generated java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Same html:multibox tag - different generated java" Watch "Same html:multibox tag - different generated java" New topic

Same html:multibox tag - different generated java

Richard Berger

Joined: Feb 25, 2006
Posts: 4
I have spent the last several hours trying to figure out why my Struts application was not behaving correctly - the code that I have in one area works fine when initializing multiboxes, but the same code in a different area does not initialize the multiboxes correctly. I know enough to realize that if the program is behaving differently, then the code couldn't be the same. So, I copy/paste the html:multibox snippet to make sure the JSP is the same. I inspect the values being sent to make sure they are the same. Everything appears identical, except for the results. So, on a whim, I try to look at the generated java code (e.g. from the JSPs) - and the code for the html:multibox tag is different! (Differences shown below). Is this a bug or is this something that is wrong with my configuration?

I am on JBoss 4.0.1, and I think I am on Struts 1.2.

Thank you SO MUCH in advance if you can help me resolve this mystery.

My JSP (in both pages) looks like:

The generated Java code is shown below - with a comment indicating the section that is missing in one of the files.

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This looks like a head-scratcher. Here's my advice:

Rather than focus on the generated code from the JSP which you have no control over, I'd focus on the context in which your JSP tags appear, which you do have control over. If the container generated different code, it's becuase there's something different about the two contexts in which you used these tags. I'd try to figure out what's different about the two contexts.

Just a few things I'd look at:

The Tag lib definitions
The jar files in WEB-INF/lib (Different versions?)
The code surrounding these tags, especially any <bean efine> tags or <jsp:useBean> tags.

It also might help is identify the problem if you'd identify what specifically is going wrong with the page that's failing.

Consultant, Sima Solutions
Richard Berger

Joined: Feb 25, 2006
Posts: 4

Thank you for the reply. Your approach is sound - as there must be something different about the contexts - although they are just two different JSPs inside the same application. In fact, I have two that work and one that doesn't.

Turns out that I found a way around the problem entirely, by shifting to what I think is a better UI (I hope I am not rationalizing ). But in doing that I may have discovered a subtle difference in the JSP pages. I haven't gone back to check out whether this is the cause, but I have left all the old code around so that one day I can come back and resolve the mystery.

Thanks again for the reply!
Richard Berger

Joined: Feb 25, 2006
Posts: 4
Well, I finally got around to doing some more testing on this. I deployed my application to a different JBoss server (version 4.0.3sp1 rather than 4.0.1sp1) and everything works as one would expect. Very strange indeed.
I agree. Here's the link:
subject: Same html:multibox tag - different generated java
It's not a secret anymore!