• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to get EL to work

 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey folks,

I'm trying to create a simple web application using the IDE WSAD (WebSphere Studio Application Developmer - the commercial version of Eclipse) and I'm having difficulty getting EL to work.

Here's my current JSP file:



Obviously, it's a simple page and should pull the "user" attribute from the request twice. Unfortunately, it pulls it only once from the request (using the scriptlet), and the EL expression simply prints as if it were plain text - nothing is interpreted.

Here's the web.xml file I'm using (which was generated automatically by WSAD):



I had a suggestion from Kathy Sierra to change the webb-app tag to read like this:



Unfortunately, any time I try to change the web-app tag, I get a bunch of errors from WSAD that I can't seem to resolve.

Anyone run into this issue before? Anyone have any ideas as to what I can do to get this working?

Thanks,
Corey
[ October 25, 2004: Message edited by: Corey McGlone ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've only used Servlet 2.4 and JSP 2.0 with Tomcat 5 and Resin 3. Really dumb first question: are you sure that your instance of WSAD supports Servlet 2.4/JSP 2? The fact that it chokes on the 2.4 web.xml descriptor is suspicious.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
I've only used Servlet 2.4 and JSP 2.0 with Tomcat 5 and Resin 3. Really dumb first question: are you sure that your instance of WSAD supports Servlet 2.4/JSP 2? The fact that it chokes on the 2.4 web.xml descriptor is suspicious.



I've wondered the same thing, Bear. Unfortunately, I've never used WSAD and neither has anyone in the office, so I'm not even sure how to find out. I've done some poking around, but I haven't found it yet. Meanwhile, I posted that exact question in the IDE forum. Hopefully, I'll figure that out soon.

If you notice the current DTD included in the web.xml file, you'll see that it's referring to servlet v2.3, not 2.4. That doesn't necessarily mean that my app server doesn't support 2.4, but, like you said, it's suspicious. That still doesn't tell me which JSP spec it supports, though.
[ October 25, 2004: Message edited by: Corey McGlone ]
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahem. I may have found my problem. I managed to find this buried in a help file:


The Web development environment in WebSphere Studio provides the tools necessary to develop Web applications as defined in the Sun Microsystems Java Servlet 2.3 Specification and the Sun Microsystems JSP 1.2 Specification. Web applications include static Web pages, JavaServer Pages (JSPs), Java servlets, deployment descriptors (web.xml files), and other Web resources.





Gah! So that seems to be my problem - it doesn't understand EL because EL wasn't added until the JSP 2.0 spec. That, of course, brings up another question of mine (since I've been out of the web app world for a couple years) - what else has been added to the JSP 2.0 spec that I won't be able to use? Anyone know of a page (perhaps on java.sun.com) that lists the new features in JSP 2.0 that I won't have available to me?

I also need to find out if we can/will upgrade, but that's not a question for these forums.

Thanks, folks.
Corey
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSP 2.0 Spec will point out what's new over JSP 1.2.

You still can use the EL to a limited degree under JSP 1.2, but it is limited to attributes within the JSTL 1.0 implementation. To use the EL stand-alone within the pages as your example shows requires JSP 2.0.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help, Bear. I think I just needed someone to confirm what I had suspected. I have a feeling you're going to be seeing more of me in this forum in the near future.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Out of curiosity, what's the best way to get dynamic information into a JSP using the 1.2 spec? Obviously, I can't use EL, so, in that case, am I back to using scriptlets and expressions in my JSPs? Or is there a better way to get information from the request into my JSP files?

Thanks.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can still write scriptless pages in JSP 1.2; it's just not as easy as with JSP 2.0.

Get a copy of the JSTL 1.0 and use the <c:out> tag where you would use "stand-alone" EL expressions.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or, trade in WSAD for a more modern container. (I assume you have no choice in the matter?)
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,

Unfortunately, I don't really get much say in the matter of which IDE and container we'll be using. For the time being, it looks like I'm stuck in the J2EE 1.3 world.

Anyway, I was trying to get the JSTL tags to work in a sample web app and I'm having problems. First of all, let me point out that I'm using Tomcat 5 (which supports JSP 2) to run my little test and I'm still having problems so the issue isn't support. It has to be something with my app. Anyway, I made a simple .jsp file that looks like this:



My goal is simply to replace the scriptlet expression with the c:out tag, as you recommended. Unfortunately, if I try to execute this page, I get an error that looks like this:



I moved the jstl.jar file into my WEB-INF/lib directory, but is there something more I need to do? I actually copied that page directive from the file webapps/jsp-examples/tagplugin/choose.jsp (which is one of the sample JSPs that comes with Tomcat). I've executed choose.jsp and it works just fine, but I get the error when I try to execute my own jsp in my own web app.

Is there something else I need to do in order to get this to work? I thought copying the .jar file was all I needed, but that doesn't seem to be the case.

Thanks,
Corey
[ October 25, 2004: Message edited by: Corey McGlone ]
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I think I've got it resolved. The problem was that the TLD file which identified the jstl tags wasn't in the jstl.jar file. It's actually in a second .jar file (located in the same place), called standard.jar. I moved that file from the existing sample web app into my own web app and it started working properly.

Thanks.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also be aware of which JSTL version you are using. The URI http://java.sun.com/jsp/jstl/core is a JSTL 1.1 URI. You probably want to be using JSTL 1.0 with JSP 1.2.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Also be aware of which JSTL version you are using. The URI http://java.sun.com/jsp/jstl/core is a JSTL 1.1 URI. You probably want to be using JSTL 1.0 with JSP 1.2.



Yes, I am. I found that the URI for JSTL 1.0 is "http://java.sun.com/jstl/core", which is slightly different from the URI for JSTL 1.1.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just as a heads up, Websphere Server 6 (J2EE 1.4 compliant) will be available to my employer (big ol websphere shop) in November, as will WSAD 6 (based on eclipse 3 instead of 2.1x). I don't think that this is any kind of early access program or anything, so if your client/employer has a current IBM contract, you might look into it.
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic