Beginner needs some help with JSP...

Hello,
I recently decided that I wanted to learn JSP. I have a background in j2se, and coldfusion. I downloaded and installed tomcat 6, and got a book called Beginning JSP 2, however, I am finding that none of the examples in the book seem to work with tomcat 6, it appears that it was designed for tomcat 5.0.16... anyways I am having trouble with the taglib directive... I am trying to do something really really simple like this:

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<html>
<body>
   <c:redirect url="http://www.yahoo.com">
</body>
</html>


Anyways can someone please point me in the direction of a good online JSP Tutorial, or recommend a good book to learn from, and possibly tell me how to get the above example to work?


Worth 500 points.

Thanks,
Rick
richardsimnettAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
rrzConnect With a Mentor Commented:
Download the Standard 1.1 Taglib
http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi 
and read this,
http://jakarta.apache.org/taglibs/doc/standard-doc/standard/GettingStarted.html 
Basically, put the two jars in <yourTomcatHome>\lib
               and use this on the top of your JSP.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
0
 
richardsimnettAuthor Commented:
ok.... one last question and I will give you the points. I am also trying to use the SQL JSTL package, and not having any luck... How do I get it to work cuz I get the following error:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /opencatch.jsp(20,0) Attribute datasource invalid for tag query according to TLD
      org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
      org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
      org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
      org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1198)

Also how do I determine the # of rows returned by a query? Here is my code so far:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

<c:forEach var="entry" items="${header}">
        Key: ${entry.key}<br>
        Value: ${entry.value}<br><br>
</c:forEach>

<!---- execute database update ---->
<sql:setDataSource var="ds"
     driver="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost/test"
     user="root" password="test" />

<sql:query var="login" datasource="${ds}">
        select * from users where username='${param.username}' and password='${param.password}'
</sql:query>

<h1>Database Access</h1>
UserID: ${login.id}


Thanks,
Rick

0
 
richardsimnettAuthor Commented:
nevermind I got it.

0
All Courses

From novice to tech pro — start learning today.