Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / October 2007

Tip: Looking for answers? Try searching our database.

Resin 3 + Struts problem with JSP compilation

Thread view: 
Ambar - 10 Sep 2007 08:33 GMT
I'm trying to run a webapp using Resin 3 and JDK 1.5
Wherever a jsp page contains the <logic:iterate> tag, I encounter the
following error:

****error snippet******

/jsp/LocationReportMain.jsp:246: not a statement
[19:36:22.319]             java.lang.Integer null;
[19:36:22.319]                      ^
[19:36:22.319] /jsp/LocationReportMain.jsp:246: ';' expected
[19:36:22.319]             java.lang.Integer null;
[19:36:22.319]                               ^
[19:36:22.319] /jsp/LocationReportMain.jsp:498: not a statement
[19:36:22.319]             java.lang.Integer null;
[19:36:22.319]                      ^
[19:36:22.319] /jsp/LocationReportMain.jsp:498: ';' expected
[19:36:22.319]             java.lang.Integer null;
[19:36:22.319]                               ^
[19:36:22.319] /jsp/LocationReportMain.jsp:545: not a statement
[19:36:22.319]             java.lang.Integer null;
[19:36:22.319]                      ^
[19:36:22.319] /jsp/LocationReportMain.jsp:545: ';' expected
[19:36:22.319]             java.lang.Integer null;
*******************************************************************************

The generated .java code appears like this:

java.lang.Integer null;
null = (java.lang.Integer)pageContext.findAttribute("null");
****snip irrelevant code***
com.caucho.jsp.BodyContentImpl _jsp_endMyTag = null;

The app was running fine when I used Resin 2 + JDK 1.5. The Struts
version being used is Struts 1.1, but the problem persists with Struts
1.3.8 as well.

Would appreciate any help on this.

TIA
Lew - 10 Sep 2007 14:23 GMT
> I'm trying to run a webapp using Resin 3 and JDK 1.5
> Wherever a jsp page contains the <logic:iterate> tag, I encounter the
[quoted text clipped - 33 lines]
>
> Would appreciate any help on this.

You'll get better help if you
- stop multi-posting (sending the same message /independently/ to different
newsgroups) and
- show the JSP.

Clearly you named something "null" in your JSP, since both
>> java.lang.Integer null;
and
>> null = (java.lang.Integer)pageContext.findAttribute("null");

are illegal Java.

Isn't <logic:iterate> a Struts tag?  Is Struts related to Resin?

Either way, I'd use JSTL <c:forEach> in preference to third-party tags.

Signature

Lew

Ambar - 10 Sep 2007 15:59 GMT
> Clearly you named something "null" in your JSP, since both
>
[quoted text clipped - 3 lines]
>
> are illegal Java.

As I mentioned, this code was working just fine with Resin 2x. There
is no variable named null :)
The part of the jsp causing the problem is:

<logic:iterate id="driverValues"
name="SingleUserLocReportInitializer"  property="teamMembers"
type="java.util.Hashtable"><html:option value='<
%=driverValues.get("USER_ID").toString()%>'> <
%=driverValues.get("NAME").toString()%></html:option></logic:iterate>

My application uses the logic:iterate tag extensively, and Resin 3.1
is generating the following code for every single one of these
instances:

java.lang.Integer null;
null = (java.lang.Integer)pageContext.findAttribute("null");

Whereas, with Resin 2x, the generated code is this:
java.util.Hashtable driverValues;
driverValues =
(java.util.Hashtable)pageContext.findAttribute("driverValues");

> Isn't <logic:iterate> a Struts tag?  Is Struts related to Resin?
>
> Either way, I'd use JSTL <c:forEach> in preference to third-party tags.
>
> --
> Lew

I don't really have a choice in the matter - the tag has been used
extensively throughout the app, and was working just fine with Resin
2. Its been in production for years now

TIA,
Ambar
Lew - 11 Sep 2007 00:11 GMT
> The part of the jsp causing the problem is:

(quote: newlines doubled so newsreaders won't eliminate them)

<logic:iterate id="driverValues"

name="SingleUserLocReportInitializer"  property="teamMembers"

type="java.util.Hashtable"><html:option value='<

%=driverValues.get("USER_ID").toString()%>'> <

%=driverValues.get("NAME").toString()%></html:option></logic:iterate>

(END quote)

Is this where the newlines fall in your actual JSP source (obviously not
doubled)?  I'm not sure what happens if you put a newline between the opening
angle bracket and the percent sign in a "<%=" expression, but surely it messes
up the ability to read the content as scriptlet.

If that isn't where the newlines appear in your actual source, then that
doesn't apply and you should reconsider how you post code to Usenet.

I'd say in that case that either "USER_ID" or "NAME" is missing.

<http://struts.apache.org/1.3.8/struts-taglib/tlddoc/index.html>
states that the logic:iterate type attribute holds the
> [f]ully qualified Java class name of the element to be exposed
> through the JSP bean named from the id attribute. If not present,
> no type conversions will be performed.
> NOTE: The actual elements of the collection must be assignment-
> compatible with this class, or a request time ClassCastException will occur.

This tells me that your "driverValues" is a Hashtable which in turn is an
element of the collection held in the "teamMembers" property of
"SingleUserLocReportInitializer".  Is that correct?

I can't see the rest of the JSP, so I have to ask.  Are you sure that
"SingleUserLocReportInitializer" is declared at that point in the JSP, either
through <jsp:useBean> (preferred) or <bean:define>?

Incidentally since you aren't leveraging the synchronized nature of Hashtable
calls it's not helpful to use the archaic java.util.Hashtable class.

Signature

Lew

Daniel Pitts - 02 Oct 2007 01:22 GMT
> > Clearly you named something "null" in your JSP, since both
>
[quoted text clipped - 39 lines]
> TIA,
> Ambar

What version of Resin 3 are you using? Older versions are more likely
to do strange type conversions (or not do type conversions).
I've noticed similar odd behavior on 3.0.14 and 3.0.19, but the same
JSPs work with 3.0.22.

Resin 3 is NOT backward compatible with Resin 2 in many ways, you're
likely to have to rework large portions of your webapp to get it
working. We've run into the same issues where I work.

Good luck,
Daniel.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.