Link to home
Start Free TrialLog in
Avatar of richardsimnett
richardsimnett

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of richardsimnett
richardsimnett

ASKER

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

nevermind I got it.