aspose file tools*
The moose likes JSP and the fly likes How do I choose my JSP version? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How do I choose my JSP version?" Watch "How do I choose my JSP version?" New topic
Author

How do I choose my JSP version?

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2861
    
  11

I'm maintaining an ancient project running on Oracle AS 10g, OC4J. According to what documentation I can find, it should support JSP 2.0, but it doesn't look like it is. Into one of the JSPs, I put the line:



and it printed out, "1.1".

It's been so long since I've worked with JSP at that I don't remember how to configure different versions. As far as I can tell, the JSP version should be set by setting the corresponding Servlet version in the web.xml file, although this seems oddly indirect and doesn't ring any bells for me at all.

Mine starts:



However, Servlet 2.3 should correspond to JSP 1.2, so I'm confused. Does anyone have an example of a web.xml that selects for JSP 2.0. Also, is there other configuration required?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61608
    
  67

Servlet containers supporting Servlets 2.4 will use JSP 2 if the web app is configured as a 2.4 web.

Using the Servlets 2.3 DTD, as you've seen, will select JSP 1.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2861
    
  11

I found an example at http://www.devx.com/webdev/Article/16973, which showed:



That caused Oracle to log an error every five seconds, showing it tried to start the application but failed, then tried again, failed again, etc. I'm sure it logged why it failed somewhere, but it keeps dozens of log files, and I'm still figuring out where they all are. I notice this example specified a 2.3 DTD and a 2.4 XSD. Is that the problem? Would this work instead?:



Also, if Servlets 2.3 DTD specifies JSP 1.2, why does my page think it's using 1.1?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61608
    
  67

Greg Charles wrote:I found an example at ...

Wow. How very very wrong. That makes any information you'd find at that site very suspect.

The deployment descriptor should never have both a DTD and an XML Schema declaration. One would think that you found this example at roseindia.com or some other site that's known to have the worst examples on the face of the earth. I guess we can add devx.com to that list.

Remove the DOCTYPE declaration completely to deploy for 2.4.

Also, if Servlets 2.3 DTD specifies JSP 1.2, why does my page think it's using 1.1?

Where does the DTD specify a JSP version?

In any case, why are you worrying about Servlets 2.3 and JSP 1.x at all? They're over a decade old and supporting them should be a non-issue at this point.

If you're stuck with a legacy app, you're kinda stuck with what the legacy container supports.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
>Also, if Servlets 2.3 DTD specifies JSP 1.2, why does my page think it's using 1.1?

I don't believe that info comes from the web.xml.
Instead it comes from the server you are using, and is fixed for that server.

I would suggest the following jsp to get the full information:
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2861
    
  11

The output is:

Working with server: Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)
Servlet Specification: 2.3
JSP version: 1.1
Java Version: 1.4.2_06


I tried changing the web.xml header to:



I also changed orion-web.xml to:



on a vague idea that it would be a good idea to make those numbers match.

I restarted the application and it's in that Started -- Critical Error -- Stopped cycle again. It may just be the web.xml isn't following proper 2.4 syntax. Eclipse isn't showing any errors, but it doesn't seem to be validating at all since I changed the header. It's telling me that no DTD or XSD is specified. I suppose that's because there's no DOCTYPE anymore. I'll look into how I can configure Eclipse, or get a better tool.

@Bear -- you are preaching to the choir mon frere! I've worked in some pretty strange development environments before, but this is by far the worst. Java 1.4? I can't even remember the syntax. Every single JSP uses scriptlets, and the Java code is rife with Vectors. (Because I guess you don't want to upgrade to the "new" Java Collections API all at once.) Every day I encounter something that makes my head explode.

Good call on DEVX. I'll avoid them in the future. Another tipoff: they're running a banner ad for Intersystems Cache, a MUMPS-based relational database that was crated to track how many rocks D'leh owed to Thag for painting his cave (and which we also use at this company).



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61608
    
  67

Are you sure that the container support 2.4?

What happens if you try to start the web app with Tomcat 6?
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2861
    
  11

No, I'm not sure. I thought I was because I saw release notes saying it supported Servlet 2.4 and JSP 2.0, but at the time I assumed that we were at least using the latest Oracle AS 10g (Release 3) given that it's been out for seven years. It's kind of shock to realize that we're actually on the older Release 2. I have to redo my research and see if I was being overly optimistic. I'm having trouble finding a compatibility matrix for Release 2 at the moment, but I'm sure that's just because no one in their right mind would still be using it.

The long range plan is to migrate to Oracle 11 (i.e., WebLogic), but <span class="gross-understatement"> things move slowly on this project</span>. I was hoping with a few configuration tweaks, I could be using 21st century technology today. That may not be in the cards though. Thanks to both of you for your help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I choose my JSP version?