Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Andrea Steelman

Author
+ Follow
since Jun 10, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrea Steelman

Our book just uses scriptlets. However, I'm sure the next revision will cover JSTL.
One of the problems that we found with JSTL was that at the time of writing the text, Tomcat didn't support it very well. And to do JSP programming, you need to know how to work with scriptlets, regardless if you like them or not.
I agree with you that scriptlets are messy and their use should be minimized as much as possible. In fact, we designed our book to use the MVC pattern to its fullest. When you use this pattern, you can eliminate the need for most scriptlets in your JSPs.
20 years ago
JSP
I think you can use the JSTL "if" tag and then use the "set" tag as described above. In the expression of the value attribute, you can increment your variable. Although I don't believe you can use the post increment operator, you can use regular addition notation. For example,
I'm using the following code in an application:
<c:set var="requests" scope="application" value="${requests + 1}"/>
Good luck.
20 years ago
JSP
If you have access to JSTL, you can use a JSTL tag as follows:
value=<c ut value="${param.SomeParameterName}"/>
To use this JSTL tag, you also need a taglib directive in the JSP as follows:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
JSTL does remove most of the scriptlet code from your JSPs. However, to use it, you must use a server that supports it. You may also have some configuration details to take of.
20 years ago
JSP
If you already know the Java language, you should be able to learn JSP and Servlets quite easily. Rather than focusing on the language, you can focus on how to use Java for web programming. This, in my opinion, is much more fun than trying to learn object-oriented programming!
A servlet is just a special class, so the code looks like regular Java code. JSPs use their own tags, so you'll have to learn how to work with them. However, they're not difficult to use.
JavaScript is not the same as JSP. In our book, we cover how to use JavaScript for simple data validation on the client. There, you'll find that the syntax is similar to Java, but they are not the same. Compared to ASP, I believe JSP/Servlets is similar. Rather than using VB classes in the background, you use servlets.
To get started, I'd (obviously!) recommend our book. This will get you started. In fact, you'll actually learn quite a bit. If you have background in web programming, you'll speed through much of the book since you already know the basics of web programming.
20 years ago
JSP
I think you're asking a fair question.
When we designed the book, we chose to teach a person all the skills needed to design, code, and test an e-commerce site. Since the book is meant for web beginners, we teach the basic web skills. However, we assume you already know Java.
Unlike other beginner books, we cover all the skills needed to design, code, and test a basic e-commerce site. That was the goal of the book. Although most books cover JSPs, servlets, and sessions, most don't cover JDBC, security, email, and custom tags. To write an e-commerce site, you need all of these components.
In addition, we believe the unique "paired pages" format is the best way to learn a subject. It's a methodical format that places all figures and examples of a single topic on the right-hand page, while the text that describes that topic is presented on the left-hand page.
Our book doesn't cover many advanced web programming topics, although we do introduce you to XML and EJBs. We designed the book this way. Once you finish our book, you'll be able to pick up an advanced web programming book and read it without any trouble.
20 years ago
JSP