×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how is jsp?

how is jsp?

how is jsp?

(OP)
I work mostly with asp but I am looking into doing some java development for future projects. I have written a number of basic servlets and found the whole java thing pretty nice to work with (except for replacing existing servlets).

I am curious about jsp because examples I've seen look like asp except that the "objects" are actually java which I assume you can write yourself. So it's sounds sort of like COM without the hassles of dealing with C++ or VB. I this at all accurate as an assessment? Please, comments.

Since a servlet has to be generated first then compiled (at least that's how I understood it) is jsp slower than working with straight servlets?

Has anyone experienced any serious downsides to jsp? Any warnings?

--Will Duty
wduty@radicalfringe.com

RE: how is jsp?

Dear Will,

> Since a servlet has to be generated first then compiled (at least that's how I understood it) is jsp slower than working with straight servlets?

No the jsp engine compiles all files into servlet byte code files, then this is how they are executed. The engine uses the file date and time stamps to know when the jsp files need to be re-compiled into servlet byte code.

There is one catch, at least using the Java Web Server, the jsp engine only catches the outer most file. I mean if home.jsp inclues a.jsp and b.asp and you modify a.jsp the engine will not see that re-compilation is required. You must also modify the outer file (home.jsp) to get the engine to recompile the files.

> Has anyone experienced any serious downsides to jsp?

No, jsp itself is great, now how does the all the rest of the technology that you must use since you are not in the ASP IIS environment stack up? There is the real meat of this issue.

Those that have been used to microsoft development environments will be in for a shock. If you were not weaned on the 4GL drag and drop development environments you should not have a problem once you get the jang of java compiler/classpath issues.

> look like asp except that the "objects" are actually java which I assume you can write yourself.

Exactly correct! In JSP you can decide when you want binary components or script components. You can compile a java class into it's byte code .class file and place that where the web servers environment can find it and you have a binary component that can be created and used in your jsp code. You can also code(define) classes in jsp files!

// file name: inc_foo.jsp
<%!
public class foo{
  public foo(){}
  public String getHello(){ return new String("Hello"); }
}
%>

// in another jsp file
<%@ include file="inc_foo.jsp" %>
// now import a class from a class file named 'myclass.class' that belongs to a package 'mypackage'
<%@ import class="mypackage.*" %>

<% // script block using java since this is jsp
String mystr = new String("MyString.");
foo myfoo = new foo();
mystr += myfoo.getHello();
mystr += ".";
myclass oclass = new myclass();
mystr += oclass.getHello();
%>
<script language=javascript>
<!--
function showmsg(){
  alert("<%=mystr%>");
}
//-->
</script>
<body onload="showmsg()">
</body>

Hope this helps
-pete

RE: how is jsp?

(OP)
Wow that was fast and thorough!

Actually, since I posted this earlier today, I've been translating an old cold-fusion ecommerce site I wrote into java servlets. I'm basically replacing the old CF sections with servlet includes. It's working a-ok (java is very nice to work with I must say). At least for this site which doesn't have dynamic content woven through the whole page but only in very specific places, it seems quite possible to do the whole site using servlets with ssi. I can see where the jsp approach would be better if I had a lot of scattered content all over the place. Besides that is there any other reason why this approach would not be advisable? Beans would handle state and user issues better maybe or be more economical?

As for the classpath, and manual compilation issues, no problem - I've written enough java that I'm totally used to the slower pace and the difference from the padded environment of asp.

Another question: I'm using Java Web Server 2.0 which I downloaded from sun (for the umpteenth time) to run this stuff locally. I've also heard of people using Jrun. Is this correct? What are the differences? What other server implementations are there for running java/jsp/servlets?

--Will Duty
wduty@radicalfringe.com

RE: how is jsp?

I don't know all of them but yeah JRun is a jsp engine that plugs into Apache. Not sure about what platforms it's available on nor how well it works. JWS is the only JSP server I've worked with. It's not recommended for high volume production sites, so you should probably start looking into JRun and any other commercial products that are available if you need 'high volume commercial use'.

Good luck
-pete

RE: how is jsp?

wduty: You can also look into Tomcat at:
http://jakarta.apache.org/
Of course there are many application servers utilizing JSP (BEA, Silverstream), a free one (if you are noncommercial) is Orion at:
http://www.orionserver.com/
The BEA/Silverstream/Orion application servers, however, have additional tags/framework.

I use Tomcat, it is straight JSP and runs great.  I think Sun will emphasize Tomcat over JWS (Sun pretty much did Tomcat).

RE: how is jsp?

> I think Sun will emphasize Tomcat over JWS (Sun pretty much did Tomcat).

ummm... Tomcat is JWS, it's the next version(s) having been turned over to the open source group established to continue on with the Java Web Server.

-pete

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close