You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Satish Talim <sa...@hotmail.com> on 2004/10/13 08:00:56 UTC
Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
I am using JBoss 4.0 (which I believe is a Servlet 2.4 / JSP 2.0 container) and Struts 1.2.4.
I want to use JSTL 1.1 with Struts and JBoss. For example, I would like to use something like this:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
..
<c:choose>
<c:when test="${empDbInfo.rowCount == 0}">
<sql:update>
INSERT INTO Employee
(UserName, Password, FirstName, LastName, Dept,
EmpDate, EmailAddr, ModDate)
VALUES(?, ?, ?, ?, ?, ?, ?, ?)
<sql:param value="${param.userName}" />
<sql:param value="${param.password}" />
<sql:param value="${param.firstName}" />
<sql:param value="${param.lastName}" />
<sql:param value="${param.dept}" />
<sql:dateParam value="${parsedEmpDate}" type="date" />
<sql:param value="${param.emailAddr}" />
<sql:dateParam value="${now}" />
</sql:update>
</c:when>
<c:otherwise>
<sql:update>
UPDATE Employee
SET Password = ?,
FirstName = ?,
LastName = ?,
Dept = ?,
EmpDate = ?,
EmailAddr = ?,
ModDate = ?
WHERE UserName = ?
<sql:param value="${param.password}" />
<sql:param value="${param.firstName}" />
<sql:param value="${param.lastName}" />
<sql:param value="${param.dept}" />
<sql:dateParam value="${parsedEmpDate}" type="date" />
<sql:param value="${param.emailAddr}" />
<sql:dateParam value="${now}" />
<sql:param value="${param.userName}" />
</sql:update>
</c:otherwise>
</c:choose>
..
a. How do I use this in Struts 1.2.4?
b. I can see a folder C:\jakarta-struts-1.2.4\contrib\struts-el\lib on my hard-disk. Do I use the jar and tld files there?
c. If these are to be used then what's the difference between sql.tld and sql-rt.tld?
d. Also, should my application context's web.xml contain:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
All this is very confusing for lack of proper documentation. I appreciate all help on this. Thanks.
Re: Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
Posted by Satish Talim <sa...@hotmail.com>.
Rick, well if you look at myjsppage.jsp, I had to use core_rt in the uri. If
I use just core in the uri, I get an error as:
"According to TLD or attribute directive in tag file, attribute value does
not accept any expressions"
<!-- myjsppage.jsp -->
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<html>
<head>
<title>jauth Application</title>
</head>
<body>
The User Entering the application is : <c:out value="${data.name}" />
</body>
</html>
Why do I need to use core_rt and not core. I think core_rt is for JSTL 1 and
not 1.1 ?
Any ideas?
----- Original Message -----
From: "Rick Reumann" <st...@reumann.net>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, October 14, 2004 8:17 AM
Subject: Re: Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
Satish Talim wrote the following on 10/13/2004 9:39 PM:
> Rick, I ain't doing this db stuff in my jsp - I know it's bad practice; I
> had just put some code here that was there in some jsp test application
that
> did not use Struts.
I figured:) I was just being a dork by opening my mouth:)
> However, I am still unclear. Karr mentioned "The features provided by
> Struts-EL are all natively provided in the container. " - so how does this
> JBoss container evaluate <c:out tag (if used) when there is no c.tld or
the
> required jar file? Any ideas?
The latest container uses Tomcat 5 which is JSP2.0 compliant so all that
el stuff you'd need c:out for is built in.
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
Posted by Rick Reumann <st...@reumann.net>.
Satish Talim wrote the following on 10/13/2004 9:39 PM:
> Rick, I ain't doing this db stuff in my jsp - I know it's bad practice; I
> had just put some code here that was there in some jsp test application that
> did not use Struts.
I figured:) I was just being a dork by opening my mouth:)
> However, I am still unclear. Karr mentioned "The features provided by
> Struts-EL are all natively provided in the container. " - so how does this
> JBoss container evaluate <c:out tag (if used) when there is no c.tld or the
> required jar file? Any ideas?
The latest container uses Tomcat 5 which is JSP2.0 compliant so all that
el stuff you'd need c:out for is built in.
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
Posted by Satish Talim <sa...@hotmail.com>.
Rick, I ain't doing this db stuff in my jsp - I know it's bad practice; I
had just put some code here that was there in some jsp test application that
did not use Struts.
However, I am still unclear. Karr mentioned "The features provided by
Struts-EL are all natively provided in the container. " - so how does this
JBoss container evaluate <c:out tag (if used) when there is no c.tld or the
required jar file? Any ideas?
----- Original Message -----
From: "Rick Reumann" <st...@reumann.net>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, October 13, 2004 10:01 PM
Subject: Re: Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
A much more important question is why are you doing this db stuff in
your JSP!
Satish Talim wrote the following on 10/13/2004 2:00 AM:
> I am using JBoss 4.0 (which I believe is a Servlet 2.4 / JSP 2.0
container) and Struts 1.2.4.
>
> I want to use JSTL 1.1 with Struts and JBoss. For example, I would like to
use something like this:
>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
> ..
> <c:choose>
> <c:when test="${empDbInfo.rowCount == 0}">
> <sql:update>
> INSERT INTO Employee
> (UserName, Password, FirstName, LastName, Dept,
> EmpDate, EmailAddr, ModDate)
> VALUES(?, ?, ?, ?, ?, ?, ?, ?)
> <sql:param value="${param.userName}" />
> <sql:param value="${param.password}" />
> <sql:param value="${param.firstName}" />
> <sql:param value="${param.lastName}" />
> <sql:param value="${param.dept}" />
> <sql:dateParam value="${parsedEmpDate}" type="date" />
> <sql:param value="${param.emailAddr}" />
> <sql:dateParam value="${now}" />
> </sql:update>
> </c:when>
> <c:otherwise>
> <sql:update>
> UPDATE Employee
> SET Password = ?,
> FirstName = ?,
> LastName = ?,
> Dept = ?,
> EmpDate = ?,
> EmailAddr = ?,
> ModDate = ?
> WHERE UserName = ?
> <sql:param value="${param.password}" />
> <sql:param value="${param.firstName}" />
> <sql:param value="${param.lastName}" />
> <sql:param value="${param.dept}" />
> <sql:dateParam value="${parsedEmpDate}" type="date" />
> <sql:param value="${param.emailAddr}" />
> <sql:dateParam value="${now}" />
> <sql:param value="${param.userName}" />
> </sql:update>
> </c:otherwise>
> </c:choose>
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Using JSTL 1.1 with Struts 1.2.4 and JBoss 3.2.5 or 4.0?
Posted by Rick Reumann <st...@reumann.net>.
A much more important question is why are you doing this db stuff in
your JSP!
Satish Talim wrote the following on 10/13/2004 2:00 AM:
> I am using JBoss 4.0 (which I believe is a Servlet 2.4 / JSP 2.0 container) and Struts 1.2.4.
>
> I want to use JSTL 1.1 with Struts and JBoss. For example, I would like to use something like this:
>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
> ..
> <c:choose>
> <c:when test="${empDbInfo.rowCount == 0}">
> <sql:update>
> INSERT INTO Employee
> (UserName, Password, FirstName, LastName, Dept,
> EmpDate, EmailAddr, ModDate)
> VALUES(?, ?, ?, ?, ?, ?, ?, ?)
> <sql:param value="${param.userName}" />
> <sql:param value="${param.password}" />
> <sql:param value="${param.firstName}" />
> <sql:param value="${param.lastName}" />
> <sql:param value="${param.dept}" />
> <sql:dateParam value="${parsedEmpDate}" type="date" />
> <sql:param value="${param.emailAddr}" />
> <sql:dateParam value="${now}" />
> </sql:update>
> </c:when>
> <c:otherwise>
> <sql:update>
> UPDATE Employee
> SET Password = ?,
> FirstName = ?,
> LastName = ?,
> Dept = ?,
> EmpDate = ?,
> EmailAddr = ?,
> ModDate = ?
> WHERE UserName = ?
> <sql:param value="${param.password}" />
> <sql:param value="${param.firstName}" />
> <sql:param value="${param.lastName}" />
> <sql:param value="${param.dept}" />
> <sql:dateParam value="${parsedEmpDate}" type="date" />
> <sql:param value="${param.emailAddr}" />
> <sql:dateParam value="${now}" />
> <sql:param value="${param.userName}" />
> </sql:update>
> </c:otherwise>
> </c:choose>
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org