You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Hans Bergsten <ha...@gefionsoftware.com> on 2002/10/31 06:30:55 UTC

[ANN] Part 3 of my JSTL article at ONJava.com

Guys,

I just wanted to let you know that the third (and final) part of my
JSTL article series is now available at ONJava.com:

   <http://www.onjava.com/pub/a/onjava/2002/10/30/jstl3.html>

This part describes how you can leverage a number of JSTL classes and
interfaces when you develop your own custom tag libraries.

I hope you'll find it useful.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
JavaServer Pages	http://TheJSPBook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANN] Part 3 of my JSTL article at ONJava.com

Posted by "Steve A. Olson" <st...@ait-inc.com>.
I haven't read the book but I did enjoy the article.  Actually, I found it
quite usefull because I was looking for some guidance on embedding EL into
my own tags.

--Steve

----- Original Message -----
From: "Hans Bergsten" <ha...@gefionsoftware.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Cc: "A mailing list about Java Server Pages specification and reference"
<JS...@JAVA.SUN.COM>; "Tag Libraries Developers List"
<ta...@jakarta.apache.org>
Sent: Thursday, October 31, 2002 3:23 PM
Subject: Re: [ANN] Part 3 of my JSTL article at ONJava.com


> Tony LaPaso wrote:
> > Hans, Does the article contain anything that's *not* in your book?
>
> Look at it this way. The article series gives you an overview of what
> JSTL 1.0 is all about, with some brief examples of how to use it, but
> I don't expect anyone to learn all that's needed to use JSTL effectively
> from reading the articles. The book, on the other hand, aims to teach
> you all you need to know about using JSP, including JSTL, with much more
> detailed coverage and examples.
>
> If you're simply asking "If I've read the book, will I learn anything
> new from reading the articles", the answer is "no". But if you feel
> that you need to refresh your memory about what JSTL can do for you, the
> articles may help you see the "big picture" so that you can then better
> understand the details in the book.
>
> Hans
> --
> Hans Bergsten hans@gefionsoftware.com
> Gefion Software http://www.gefionsoftware.com
> JavaServer Pages http://TheJSPBook.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANN] Part 3 of my JSTL article at ONJava.com

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Tony LaPaso wrote:
> Hans, Does the article contain anything that's *not* in your book?

Look at it this way. The article series gives you an overview of what
JSTL 1.0 is all about, with some brief examples of how to use it, but
I don't expect anyone to learn all that's needed to use JSTL effectively
from reading the articles. The book, on the other hand, aims to teach
you all you need to know about using JSP, including JSTL, with much more
detailed coverage and examples.

If you're simply asking "If I've read the book, will I learn anything
new from reading the articles", the answer is "no". But if you feel
that you need to refresh your memory about what JSTL can do for you, the
articles may help you see the "big picture" so that you can then better
understand the details in the book.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
JavaServer Pages	http://TheJSPBook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jstl & jsp: working progress

Posted by Lorenzo Sicilia <ar...@kemen.it>.
Shawn Bayern wrote:
> Once again, I'll strongly recommend that you use JSTL to access the Result
> object; it wasn't designed for easy access in Java.  What are you
> expecting to get from scriptlets in this case?

The goal is convert a recordSet in a String. Flash MX load the jsp 
output and convert in a Flash MX recordSet.

I must use jsp because I can control "\n" output. Now the output is more 
compress ^_^

I have understand some things about JAVA world thanks to all.
This is my last script with JSTL and JSP integration.


<%@ page import="javax.servlet.jsp.jstl.sql.Result" %>
<%@ taglib uri="/WEB-INF/tld/sql.tld" prefix="sql" %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ include file="/global/connection.jsp" %>
<!-- After I use ? and getParam ^_^ -->
<c:set var="language_set" value="it" />
<sql:query var="elenco" >
SELECT 	ID_news,data,
		titolo_<c:out value="${language_set}" /> as titolo,
		abstract_<c:out value="${language_set}" /> as abstract,
		testo_<c:out value="${language_set}" /> as testo,
		data
FROM tb_news
</sql:query>

<%
// elenco is a JSTL recordSet
// RecordSet Compresion for Flash MX
// costanti per i terminatori

String tRow = "##";
String tColum = "#";
String initData = "####";

Result rs = (Result)pageContext.findAttribute("elenco");
int max = rs.getRowCount();
String[] columnNames = rs.getColumnNames();
// Start print Column
String rsString = "response=";


for (int c = 0; c < columnNames.length;c++){
	rsString += columnNames[c] + tColum;
}
// Column end
rsString += initData;
// Start print recordSet Data
for (int row = 0; row < max; row++ ){
	for (int column = 0; column < columnNames.length; column++){
		rsString += rs.getRows()[row].get(columnNames[column])+ tColum; //--> 
Error: "No field name"
	}
	rsString += tRow;
}
rsString += "&";
out.print(rsString);
%>


Best Regards Lorenzo Sicilia

-- 
"Il fatto che un'opinione sia condivisa ampiamente non prova che non sia 
completamente assurda"
Bertrand Russell


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql, choose and scope

Posted by Lorenzo Sicilia <ar...@kemen.it>.
flare wrote:
> perhaps you should use "and" instead of "or" :)
> 
> <c:when test="${empty param.fSessionId && empty param.sqlRequest }" >

Actualy is just a test! After I make a true autentification system. 
Anyway thanks.

Best Regards

Lorenzo Sicilia


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql, choose and scope

Posted by flare <fl...@flare.it>.
> <c:choose>
> <c:when test="${empty param.fSessionId || empty param.sqlRequest }" >
>   <c:out value="LOGIN KO" />
> </c:when>

> sqlRequest was correct 	but the first WHEN was always True.

perhaps you should use "and" instead of "or" :)

<c:when test="${empty param.fSessionId && empty param.sqlRequest }" >
 

 ciao 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql, choose and scope

Posted by Lorenzo Sicilia <ar...@kemen.it>.
Pierre Delisle wrote:
> I suspect the body of the when clause is not executed
> because its condition evaluates to false.
> 
> You should print the value of param.sqlRequest prior
> to the <c:choose> to make sure it has the value "1".
> 
>     -- Pierre

Perfect now all work fine!Before I don't had understand choose tag.

True Script:
<c:choose>
<c:when test="${empty param.fSessionId || empty param.sqlRequest }" >
		<c:out value="LOGIN KO" />
</c:when>
<c:when test="${param.sqlRequest == 1}" >
		<c:out value="Entro!" />
		<sql:query var="flashRecordSet" >
		SELECT 	ID_news,data,
			titolo_it as titolo,
			abstract_it as abstract,
			testo_it as testo
		FROM tb_news
		</sql:query>
</c:when>
</c:choose>
sqlRequest was correct 	but the first WHEN was always True.
Now I have understand is quite equal to Switch ;o)

Best Regards Lorenzo Sicilia


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: sql, choose and scope

Posted by Pierre Delisle <pi...@sun.com>.
I suspect the body of the when clause is not executed
because its condition evaluates to false.

You should print the value of param.sqlRequest prior
to the <c:choose> to make sure it has the value "1".

    -- Pierre

Lorenzo Sicilia wrote:
> 
> A problem about scope:
> 
> my script
> 
> <c:choose >
>         <c:when test="${param.sqlRequest == 1}"  >
>                         <sql:query var="flashRecordSet" >
>                         SELECT  ID_news,data,
>                                 titolo_it as titolo,
>                                 abstract_it as abstract,
>                                 testo_it as testo
>                         FROM tb_news
>                         </sql:query>
>         </c:when>
> </c:choose>
> 
> Result rs = (Result)pageContext.findAttribute("flashRecordSet");
> 
> I can't find flashRecordSet. If SQL tag is out the tags Choose and When
> all work fine.
> Some one can explain me why? I need just the path to get flashRecordSet
> 
> thanks Lorenzo Sicilia
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


sql, choose and scope

Posted by Lorenzo Sicilia <ar...@kemen.it>.
A problem about scope:

my script

<c:choose >
	<c:when test="${param.sqlRequest == 1}"  >
			<sql:query var="flashRecordSet" >
			SELECT 	ID_news,data,
				titolo_it as titolo,
				abstract_it as abstract,
				testo_it as testo
			FROM tb_news
			</sql:query>
	</c:when>
</c:choose>


Result rs = (Result)pageContext.findAttribute("flashRecordSet");

I can't find flashRecordSet. If SQL tag is out the tags Choose and When 
all work fine.
Some one can explain me why? I need just the path to get flashRecordSet

thanks Lorenzo Sicilia


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jstl & jsp: working progress

Posted by Shawn Bayern <ba...@essentially.net>.
On Thu, 31 Oct 2002, Lorenzo Sicilia wrote:

> // Why the fRow var is not read by the SortedMap objcet? Cast?

Java doesn't work like that.  You can't write sortedMap[foo] in Java.  You
have to write sortedMap.get("foo").

Once again, I'll strongly recommend that you use JSTL to access the Result
object; it wasn't designed for easy access in Java.  What are you
expecting to get from scriptlets in this case?

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


jstl & jsp: working progress

Posted by Lorenzo Sicilia <ar...@kemen.it>.
thanks to all list for the aid during these days.
the quite new question

<%
//elenco is a JSTL recordSet
Result rs = (Result)pageContext.findAttribute("elenco");
int max = rs.getRowCount();

for (int fRow = 0; fRow<= max; fRow++ ){
//	out.print(rs.getRowsByIndex()[row][2]+"#");
//	out.println(fRow);  --> Output: 0,1,2,3....
//	out.print(rs.getRows()[0].data); --> Error: "No field name"
	out.print(rs.getRowsByIndex()[0][0]); // output--> 1,1,1,1,...
// 
***********************************************************************		
// 	My Problem:		
//	out.print(rs.getRowsByIndex()[fRow][0]); // Error: "<head><title>JRun 
Servlet Error</title></head><h1>500 7</h1><body>7</body>
//	***********************************************************************

}
	
%>
//	Why the fRow var is not read by the SortedMap objcet? Cast?

thanks

Lorenzo Sicilia


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


how to replace any taglib class with the chaged source code in struts??

Posted by Shalu Goel <sh...@mind-infotech.com>.
Hello!!!
struts is open source code MVC framework right???
meand we can make changes in the taglib classes as and when required suiting
our application specific requirement.....i have thus made a small change in
FormTag class lying under html taglib....
But now my confusion is how do i go about replacing the changed file??? coz.
i just have struts.jar in my lib directory and *.tld (six of them)in my
classes folder...where and how to chage the code provided by struts
framework???


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANN] Part 3 of my JSTL article at ONJava.com

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Tony LaPaso wrote:
> Hans, Does the article contain anything that's *not* in your book?

Look at it this way. The article series gives you an overview of what
JSTL 1.0 is all about, with some brief examples of how to use it, but
I don't expect anyone to learn all that's needed to use JSTL effectively
from reading the articles. The book, on the other hand, aims to teach
you all you need to know about using JSP, including JSTL, with much more
detailed coverage and examples.

If you're simply asking "If I've read the book, will I learn anything
new from reading the articles", the answer is "no". But if you feel
that you need to refresh your memory about what JSTL can do for you, the
articles may help you see the "big picture" so that you can then better
understand the details in the book.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
JavaServer Pages	http://TheJSPBook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANN] Part 3 of my JSTL article at ONJava.com

Posted by Tony LaPaso <tl...@attbi.com>.
Hans, Does the article contain anything that's *not* in your book?



----- Original Message -----
From: "Hans Bergsten" <ha...@gefionsoftware.com>
To: "A mailing list about Java Server Pages specification and reference"
<JS...@JAVA.SUN.COM>; "Tag Libraries Developers List"
<ta...@jakarta.apache.org>; "Tag Libraries Users List"
<ta...@jakarta.apache.org>
Sent: Wednesday, October 30, 2002 11:30 PM
Subject: [ANN] Part 3 of my JSTL article at ONJava.com


> Guys,
>
> I just wanted to let you know that the third (and final) part of my
> JSTL article series is now available at ONJava.com:
>
>    <http://www.onjava.com/pub/a/onjava/2002/10/30/jstl3.html>
>
> This part describes how you can leverage a number of JSTL classes and
> interfaces when you develop your own custom tag libraries.
>
> I hope you'll find it useful.
>
> Hans
> --
> Hans Bergsten hans@gefionsoftware.com
> Gefion Software http://www.gefionsoftware.com
> JavaServer Pages http://TheJSPBook.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANN] Part 3 of my JSTL article at ONJava.com

Posted by Shawn Bayern <ba...@essentially.net>.
On Wed, 30 Oct 2002, Vernon Wu wrote:

>    Config.set(session, Config.FMT_LOCALE, obj);
> 
> I current pass a locale string as the third argument into the method.
> It works magically well, although I am not sure whether I use it right
> or not. According to the document on java.sun.com site, the third
> argument is an object. It shall be a locale string or a locale object?

It can be a String or a java.util.Locale; both are intended to work (and
teh Config.set() call is intended to be used with multiple configuration
settings), which requires the use of Object as the type.

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [ANN] Part 3 of my JSTL article at ONJava.com

Posted by Vernon Wu <ve...@gatewaytech.com>.
Great work, Mr. Bergsten! The online posting is very handy for people like me who are working in front of a compute all 
day long.

I have a question in regarding of the content of previous article. In the i18n section, you mention that locale can be set 
in the container by calling the method of  javax.servlet.jsp.jstl.core.Config:

			Config.set(session, Config.FMT_LOCALE, obj);

I current pass a locale string as the third argument into the method. It works magically well, although I am not sure  
whether I use it right or not. According to the document on java.sun.com site, the third argument is an object. It shall be 
a locale string or a locale object? 

Thanks,

Vernon

 
10/30/2002 9:30:55 PM, Hans Bergsten <ha...@gefionsoftware.com> wrote:

>Guys,
>
>I just wanted to let you know that the third (and final) part of my
>JSTL article series is now available at ONJava.com:
>
>   <http://www.onjava.com/pub/a/onjava/2002/10/30/jstl3.html>
>
>This part describes how you can leverage a number of JSTL classes and
>interfaces when you develop your own custom tag libraries.
>
>I hope you'll find it useful.
>
>Hans
>-- 
>Hans Bergsten		hans@gefionsoftware.com
>Gefion Software		http://www.gefionsoftware.com
>JavaServer Pages	http://TheJSPBook.com
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>