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 JSTL version causing exceptions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSTL version causing exceptions?" Watch "JSTL version causing exceptions?" New topic
Author

JSTL version causing exceptions?

Rex Norm
Ranch Hand

Joined: Dec 11, 2010
Posts: 41
I'm porting a Resin webapp using Struts 1.2.7 with Tiles plug-in to Tomcat 6.0.29 and Struts 1.3.10 I'm using the taglibs provided by the Struts 1.3.10 release and the jakarta standard libs 1.1.2 My confusion is around whether the same taglibs used on Resin with Struts 1.2.7 can be used in 1.3.10-- it would keep me form re-coding each jsp if they did. If so, what libs need importing?

The old app works fine in Resin, but seems to fail with JSTL NumberFormat and other such JSTL-type errors when run on Tomcat / Struts 1.3.10. Could this be due to a JSTL taglib version? The Struts 1.3.10 distribution comes with EL tld files, and I wonder if I need to import these too? I have the following in my WEB-INF/lib folder:


Here is a JSP example that fails. The variables are of type double and are passed as such to the request object. The tld defs are in the /WEB-INF/tld/ directory, and have been installed from the struts 1.3.10/src.../tld directory -- but only because I saw it on a post elsewhere. This may be my mistake.



At the risk of boredom, here are the taglib defs that I created for each one of these (I don't use them all):



Any ideas on why this would work on Resin and Struts 1.2.7 and not on Tomcat 6 with Struts 1.3.10? Other things? I only see partial pages because this fails and the Tiles don't come up (which could also be the problem).

I could really use some pointers in troubleshooting this. Not quite sure where to start. I'd love an RTFM reference too.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

As you are not using the standard URIs for the JSTL taglibs (why not?), it's not clear what versions you are using.

In any case, this seems sufficiently Struts-focused to be moved to the Struts forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rex Norm
Ranch Hand

Joined: Dec 11, 2010
Posts: 41
thanks for the quick reply... part of this is that I'm new to struts and taglibs. part of it is that I inherited this app from someone else, and I took a "do no harm" approach-- so I left what I didn't understand alone until now.

From your comments it sounds as if you also think the JSTL versioning is a problem.

Can you point me to a good reference that shows the difference between the two versions of taglibs? I've not been able to find one. I'd like to know how I should formulate the URI.

thanks again, and my apologies for the wrong post.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

The JSTL Specification tells all!

I have no idea if it's a version problem -- but it's difficult to rule it out known what versions are being used.
san krish
Ranch Hand

Joined: Aug 11, 2010
Posts: 41
I want to use a JSTL c:foreach loop.<c:foreach>
The loop should start with the current year and end with current year-100(2011 to 1911).
I used scriptlets for begin and end tag
//
SimpleDateFormat simpleDateformat = new SimpleDateFormat("yyyy");
int year = Integer.parseInt(simpleDateformat.format(date));
int numYears = 100;
//
what would be the value for 'step' variable for decrement operation? i mean if i give step='-1' i get error. How do i write the decrement operation?
can someone provide me for loop for the above functionality? Thanks in advance
Rex Norm
Ranch Hand

Joined: Dec 11, 2010
Posts: 41
Some more developments....I'd appreciate your or others' inspection of my logic... I've read the specs and poked a bit on this site to discover that:

  • - my expression language on the jsp's is not being run (i.e. ${object.variable} shows up as a string: "${object.variable}") and THIS leads to numberFormatExceptions where I end up trying to format a string (literally "${object.variable}") when I need an int or a double.
  • - this leads me to believe that there is an incompatibility with the JSTL version used and what the servlet container can support.


  • I'm using:
  • tomcat 6.029
  • Struts 1.3.10
  • Tiles 1.x (need to get this)
  • Jre6


  • The tlds that come with Struts 1.3.10 seem to support JSTL 1.1 (opened up the tld files). Thus, technically I'll need:
  • Tomcat 5.5 --> to give Servlets 2.4, JSP 2.0, JSTL 1.1 support
  • to configure my web.xml for 2.4 with the appropriate header (see this link)
  • get jstl 1.1 jars and put them in WEB-INF\lib-- but Struts 1.3.10 comes with standard-1.0.6.jar and jstl-1.0.2.jar-- can I use these?
  • get the URI's right on the pages


  • Regarding URI's for JSTL 1.1 -- can i define <taglib></taglib> in my web.xml?
    WHen I do this, it works on tomcat5.5 with no errors but not on tomcat 6. The only thing is that the css and images are not showing up, and I've got to sort that out now.

    hope my experience helps someone. I'm going to mark this as "resolved" -- I was not aware of the JSP compatibility mode in Tomcat, and now I know.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: JSTL version causing exceptions?