RE: Evaluating expression in 2.3 specifications
From what little I see, this is what you'll have to change: 1. A JSP 2.0 container uses JSTL 1.1.x You'll have to use the latest JSTL 1.0.x taglib. Note that the URI for those two versions are different. Make sure you use the correct one. 2. A JSP 1.2 container does not natively evaluate EL expressions in attribute values, except for the ones in the JSTL tags. Fortunately, you're using the Struts taglib. In a JSP 1.2 container, you should use the Struts-EL taglib instead of the default Struts taglib (although you'll need both the strutsel and struts jars), as Struts-EL uses code to pass attribute values through the Jakarta EL engine. In your struts-el taglib definitions, make it use the same prefix as the regular taglib, so you don't have to change the tags themselves. Just change the URI to match struts-el. -Original Message- From: chuanjiang lo [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 14, 2006 9:07 AM To: taglibs-user@jakarta.apache.org Subject: Evaluating expression in 2.3 specifications Hi all, I have developed my web application based on 2.4 specifications and now i have to deploy onto a server that is based on the 2.3 specifications. I have change the web.xml conforming to 2.3 specifications and the expression in my jsp page is not being evaluated. I have read on the net and realize that 2.4 specifications would evaluate the expression. So what should i do now so that my expression can be evaluated and i do not wish to change the implementation of my codes. Appreciate any help sample of my jsp [EMAIL PROTECTED] uri=http://java.sun.com/jsp/jstl/core; prefix=c% ... .. bean:define id=biz_link type=String name=Biz_Bean property=business_id/ html:link action=/viewBiz/ViewBusinessDetail?business_id=${biz_link} ${biz_link} is not evaluated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: import for dynamic content
The c:import tag is like the JSP include action, as opposed to the JSP include directive. It's important to understand the difference between these two. The latter includes at compile time, and the former includes at run time. In other words, the include action executes the specified resource and returns the data it generates. The include directive just inserts the text of the specified file before compiling the JSP. The resource specified by the include action is a URL, and for the include directive, a file. What's interesting is that apparently referencing a JSP with a file URL generates dynamic content, but it's simply the text in the file. This really gets down to determining what it is you really need. Do you need to insert the contents of that file into the calling JSP at compile time, or do you need the container to execute the JSP and return the dynamic content? I'm guessing you really mean the former. If that's the case, then just use a JSP include directive (although you might consider changing the extent on the included file to .jspf, for JSP fragment). -Original Message- From: Robert Butera [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 8:53 PM To: taglibs-user@jakarta.apache.org Subject: c:import for dynamic content I am attempting to import a JSP file into a JSP using the c:import tag. The line looks something like this: ... c:import url=file://c:/dira/dirb/imported-file.jsp/ .. imported-file.jsp is being found ok, but it is not being processed as a JSP, it is appearing as static text. I am using some struts tags in imported-file.jsp that are just getting sent to the browser. Is there something I'm doing wrong here? Is there something I need to place around the c:import to make the imported file get processed? I am running this on jboss 4.0.1 (tomcat 5.0) with JSTL 1.1. Any help would be greatly appreciated. Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems using Taglibs 1.1: c:out
I believe you'll need to make your web.xml use the Servlet 2.4 schema. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 09, 2005 3:22 AM To: taglibs-user@jakarta.apache.org Subject: Problems using Taglibs 1.1: c:out Hi, i'm new to jstl: i downloaded jakarta-taglibs-standard-1.1.2 and copied jstl.jar and standard.jar in the web-inf directory of my web-application (i'm using tomcat 5.0.19). i tried the following code-example: %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % c:forEach var='item' begin='5' end='10' value = c:out value='${item}'/br /c:forEach this example results in the - for me - unexpected output: value = ${item} value = ${item} value = ${item} value = ${item} value = ${item} value = ${item} i have no idea what's here going wrong. any help would be appreciated, michael winkler austria - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to do this with JSTL
Hold on there. I think you've misunderstood the intent of integrating JSTL with Struts. The idea is not to replace all Struts tags with JSTL tags. That's not practical. In general, you should look at the functionality available in the JSTL. If there's something that the JSTL does, and there's a similar tag in Struts, then just use the JSTL tag. However, any of the html tags in Struts cannot be easily replaced with a JSTL tag. You should, however, look at using the Struts-EL tags instead of the Struts tags. This will allow you to use the expression language in attribute values, as opposed to using scriptlets. In the example you provide here, you would want to have a setup action which places certain constant values into your application or session context, resulting in something like this: html:options collection=${expenseTypes} property=id labelProperty=description/ -Original Message- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Monday, July 25, 2005 12:08 PM To: Tag Libraries Users List Subject: how to do this with JSTL hello all, i am trying to port my application from using struts tag towards using JSTL tags, but i got stuck in a point where i have to display a selectable list.. below was the original struts code.. html:select name=entry property=type html:options collection=%= Constants.EXPENSE_TYPES% property=id labelProperty=description/ /html:select Basically,thi swill lproduce a selectable list where the selected value is the one corresponding to thep roperty.. am i correct that, if i want ot use JSTL, i have to use a c:forEach for displaying the collection, and a c:if to test teh value for each value in teh collection? anyone can give any hints? thanx and regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: combining tags
To clarify some comments from other responders: It is a good idea to use Struts-EL if you're going to use the JSTL. However, for this particular example, the Struts tag library itself has knowledge of c:forEach, as opposed to logic:iterate, so an html Struts tag that uses indexed=true will work inside a c:forEach, at least with respect to generating the correct indexed property values. -Original Message- From: Tom Holmes Jr. [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 06, 2005 8:02 AM To: Tag Libraries Users List Subject: combining tags I used to have some JSP code that looked like: logic:iterate name=myForm property=myDataList id=iter html:checkbox name=iter property=checkedRes indexed=true/ bean:write name=iter property=roomType/ html:text name=iter property=numItems indexed=true style=width:40/ /logic:iterate I'd like to switch to something likes this: c:forEach items=${SelectedRoomsForm.roomsList} var=data varStatus=status html:checkbox name=data property=checkedRes indexed=true/ c:out value=${data.roomType}/ html:text name=data property=numItems indexed=true style=width:40/ /c:forEach The c:out tag I am sure works, but I am not sure about the html:checkbox or the html:text Does this code look ok, or is there something I have to change? Thanks. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: question about tags and includes
It is trying to do the include at compile time, but your input is not well-formed. You can't start an element in one file and end it in another. -Original Message- From: Luca Passani [mailto:[EMAIL PROTECTED] People, this one got me by surprise. I always thought that the statuc include directive would force the inclusion to take place before any kind of compilation: %@ include file=somefile.inc % alas, it's not like this. If I have a JSP page like: tag:a tag:b/ /tag:a this split will work: tag:a %@ include file=b_tag.inc % /tag:a but this *will not*: %@ include file=start_a_tag.inc % tag:b/ %@ include file=end_a_tag.inc % I get an error like: Unterminated lt;tag:agt; tag The error is identical on both Tomcat 4.1 and 5.5, which makes me suspect that I am missing something (otherwise, this would look like a tomcat bug to me). Anyone who can share some light? Thank you Luca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL Question
It's a little hard to tell exactly what you're trying to do here, but it might be helpful to know that '${restaurant.cuisine}' is the same as '${restaurant[param.field]}' if param.field is equal to cuisine. With this, you would need only the single case. This strategy is only useful if you really can guarantee that you know all the possible values of param.field. If you can't be certain, then this could produce unexpected problems down the road. -Original Message- From: Jack Lauman [mailto:[EMAIL PROTECTED] Sent: Sunday, April 10, 2005 1:37 PM To: Tag Libraries Users List Subject: JSTL Question I have the following 'working' code to produce a table. The value of ${param.field} determines which field will be displayed in column 3. Can I move this out of the c:forEach loop and assign a temp variable to it using c:if/c:set so that I only need to evaluate the value of ${param.field} once and not on every line? ${param.field} will always equal city, cuisine or name. Thanks, Jack c:forEach items=${restaurantInfo.restaurants} var=restaurant c:set target=${restaurant} property=filterField value=${param.field} / c:if test=${fn:containsIgnoreCase(restaurant.filterValue, param.value)} .. c:choose c:when test=${param.field eq 'city'} td width=79 div align=leftfont size=1 face=Verdana, Arial, Helvetica, sans-serif c:out value=${restaurant.cuisine} / /font/div /td /c:when c:otherwise td width=79 div align=leftfont size=1 face=Verdana, Arial, Helvetica, sans-serif c:out value=${restaurant.city} / /font/div /td /c:otherwise /c:choose - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL Question
If you want to save the result of an evaluation into another variable, then just use c:set to set a variable from a value. -Original Message- From: Jack Lauman [mailto:[EMAIL PROTECTED] Sent: Monday, April 11, 2005 9:32 AM To: Tag Libraries Users List Subject: Re: JSTL Question David: The 'field'(s) are defined in RestaurantBean.java if they're not there nothing happens. cuisine and city field's are exact matches. The name field is user input and is case insensitive and will any partial part of a matching name. What I want to do is to have param.field or ${restaurant[param.field]} evaluated only once at the beginning of the table. param.field only needs to be evaluated once as it becomes the name of the table. Thanks, Jack Karr, David wrote: It's a little hard to tell exactly what you're trying to do here, but it might be helpful to know that '${restaurant.cuisine}' is the same as '${restaurant[param.field]}' if param.field is equal to cuisine. With this, you would need only the single case. This strategy is only useful if you really can guarantee that you know all the possible values of param.field. If you can't be certain, then this could produce unexpected problems down the road. -Original Message- From: Jack Lauman [mailto:[EMAIL PROTECTED] Sent: Sunday, April 10, 2005 1:37 PM To: Tag Libraries Users List Subject: JSTL Question I have the following 'working' code to produce a table. The value of ${param.field} determines which field will be displayed in column 3. Can I move this out of the c:forEach loop and assign a temp variable to it using c:if/c:set so that I only need to evaluate the value of ${param.field} once and not on every line? ${param.field} will always equal city, cuisine or name. Thanks, Jack c:forEach items=${restaurantInfo.restaurants} var=restaurant c:set target=${restaurant} property=filterField value=${param.field} / c:if test=${fn:containsIgnoreCase(restaurant.filterValue, param.value)} .. c:choose c:when test=${param.field eq 'city'} td width=79 div align=leftfont size=1 face=Verdana, Arial, Helvetica, sans-serif c:out value=${restaurant.cuisine} / /font/div /td /c:when c:otherwise td width=79 div align=leftfont size=1 face=Verdana, Arial, Helvetica, sans-serif c:out value=${restaurant.city} / /font/div /td /c:otherwise /c:choose - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: alternative of bean-el:write
I would try this: logic:iterate id=testScoreGraphResults name=printPreviewByTestBean property=profLevelTOList indexId=testScoreGraphIndex tr td width=2% bgcolor='c:out value=${printPreviewByTestBean.profColorMapping[testScoreGraphResults.t estScoreGraphIndex]}/' nbsp;nbsp /td td bean:write name=testScoreGraphResults property=levelCode/ /td /tr /logic:iterate -Original Message- From: anuradha.vaidya [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 11:01 PM To: Tag Libraries Users List Subject: alternative of bean-el:write Hi All I wanted to use bean-el:write this way-- logic:iterate id=testScoreGraphResults name=printPreviewByTestBean property=profLevelTOList indexId=testScoreGraphIndex tr td width=2% bgcolor=bean-el:write name=printPreviewByTestBean property=profColorMapping('${testScoreGraphResults.testScoreG raphIndex}')/ nbsp;nbsp/td tdbean:write name=testScoreGraphResults property=levelCode//td /tr /logic:iterate Now that there is no support for bean-el:write is there an alternative I can use for the same? Kindly help Regards Anuradha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: alternative of bean-el:write
-Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] From: anuradha.vaidya [EMAIL PROTECTED] Now that there is no support for bean-el:write is there an alternative I can use for the same? Is this a Struts question? If so, look at the README.txt file in the contrib/struts-el directory of the Struts distribution to see what you should use with Struts-EL instead of the 'classic' Struts tags. bean:write is replaced by JSTL's c:out And you can use c:forEach instead of logic:iterate (unless you need its support for indexed properties.) The code in the tags that support indexed properties checks for both logic:iterate or c:forEach as the parent iterating tag (essentially). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts-logic counterpart of this...
-Original Message- From: luca [mailto:[EMAIL PROTECTED] Karr, David wrote: If your web container doesn't support JSP 2.0, and you want to use the EL in the attributes of your Struts tags, then you'll need to utilize the Struts-EL library, which you'll find in the contrib directory of the Struts distribution. OK, but what would: c:set var=gridsize value=3 / become in that case? What does it become? I'm not sure I know what you mean by that, but in the case of that single line, a page-scoped attribute will be created (if not already) and set with the value 3. Or are you asking what this line would be instead if you were using Struts-EL? The answer is that it wouldn't change at all. Using Struts-EL instead of Struts makes it even easier to integrate JSTL tags with Struts tags. -Original Message- From: luca [mailto:[EMAIL PROTECTED] Hi, I'm a bit familiar with JSTL, but right now I need to integrate with some existing JSP code which uses the struts tag-lib and I am a bit lost there. How do I turn this JSTL: c:set var=gridsize value=2 / c:if test=${someELvar = 120} c:set var=gridsize value=3 / /c:if into something that works with the struts-logic tags? I understand that I can use something like: logic:greaterThan parameter=someELvar value=120 ??? /logic:greaterThan How do I set/read EL using the struts taglibs? thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts-logic counterpart of this...
Well, first of all, there's no technical reason you can't use the JSTL and Struts taglibs on the same page. An important question is what web container you're using. If your web container supports JSP 2.0, then you can use the EL in your JSP (assuming you use the servlet 2.4 doctype, and a couple of other provisos). If your web container doesn't support JSP 2.0, and you want to use the EL in the attributes of your Struts tags, then you'll need to utilize the Struts-EL library, which you'll find in the contrib directory of the Struts distribution. -Original Message- From: luca [mailto:[EMAIL PROTECTED] Hi, I'm a bit familiar with JSTL, but right now I need to integrate with some existing JSP code which uses the struts tag-lib and I am a bit lost there. How do I turn this JSTL: c:set var=gridsize value=2 / c:if test=${someELvar = 120} c:set var=gridsize value=3 / /c:if into something that works with the struts-logic tags? I understand that I can use something like: logic:greaterThan parameter=someELvar value=120 ??? /logic:greaterThan How do I set/read EL using the struts taglibs? thanks Luca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Custom tags
Placing the TLD in the taglib jar works in JSP 1.2 also. That is not a new feature. In order to take advantage of it, you need the following: * Keep the TLD in the taglib jar * Do not put the taglib directive in the web.xml * Specify a taglib directive in the JSP that uses the URI specified in the TLD. -Original Message- From: Steve Lewis [mailto:[EMAIL PROTECTED] If you place the tld in the jar JSP 2.0 will find it - there is no need to separately place tld files in WEB-INF For the other problem within el expressions consider ' rather than At 04:39 PM 9/30/2004, you wrote: I am developing a custom tag, I was wondering if this is the right place for my question I developed my tag and then want to use it in a different application so: - I deployed a jar file containing the tags I developed - I took the tld file and placed it under WEB-INF directory in the new application - and placed the jar in the lib directory - I added an entry in the xml file for my tld - then in my jsp I included %@ taglib uri=/WEB-INF/jupTaglib.tld prefix=JUPFieldValue % My questions are: - does the jar file have to contain the tld file??? - When I did the previous steps, I got several errors complying my jsp one of them saying: -- Error(1): Expecting quoted value, got character: - Sorry for my long question, hope could anyone help. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Putting custom tag inside a custome tag
Note that this only works in a JSP 2.0 container, with the EL enabled. If you're using Tomcat 4, or you haven't enabled the Servlet 2.4 version of web.xml, or other hand-waving, then this won't work. However, this is the best way to do it, if you can get it. -Original Message- From: Helios Alonso [mailto:[EMAIL PROTECTED] Try custom:shipping state=${state}/ The ${state} is the var you want to write with bean:write. At 11:48 27/09/2004 +0530, you wrote: It is a parameter to be passed. rgds Anto Paul On Sun, 26 Sep 2004 22:27:22 -0700, Martin Cooper [EMAIL PROTECTED] wrote: On Mon, 27 Sep 2004 10:22:16 +0530, Anto Paul [EMAIL PROTECTED] wrote: Hi all, Is it possible to put a custom tag inside another custom tag. No, it's not. It is not legal JSP syntax, and is also not legal XML syntax. You'll need to use something like: custom:shipping bean:write name=state/ /custom:shipping -- Martin Cooper Both tags rtexprvalue is true. I tried custom:shipping state='bean:write name=state/'/ But it prints as bean:write name=state/. Thanks in advance. Anto Paul -- To strive,to seek,to find and not to yield -- --- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To strive,to seek,to find and not to yield - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: standard-1.1.1 expression language not working
I'm assuming by that comment that you didn't understand what I said. Struts-EL is intended to be used with JSP 1.2 containers. You don't need to use it with JSP 2.0 containers, as the expression language is used natively in the JSP 2.0 compiler. In fact, if you try to use Struts-EL with a JSP 2.0 container, it just won't work. Just use Struts by itself in a JSP 2.0 container and all the tags can use the EL (for attributes that have rtexprvalue set to true). -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] On 20/9/04 10:11 pm, Karr, David [EMAIL PROTECTED] wrote: Other replies indicated your problem with the web.xml and JSP page. Another point is that you don't use Struts-EL with JSP 2.0. well I finally made a simple jsp page with EL to work and everything well configured... but for what you wrote it was a waste of time. whatever! -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 10:07 AM To: [EMAIL PROTECTED] Subject: standard-1.1.1 expression language not working Hi to everyone! I have already used taglibs before but I am having some trouble making jstl core 1.1.1 taglib to evaluate expression languages on Tomcat 5.0.27. I have all of the required libraries on WEB-INF/lib/ (jstl, standard, jdbc_2_0_stdext, xalan and xerces). Tomcat does not give any missing taglib handler... so I supposed it finds all of the necessary classes. I am also using Struts and Struts-el taglibs and they are working correctly. Am I missing something? my jsp file: %@ taglib uri=/WEB-INF/tld/struts-html-el.tld prefix=html % %@ taglib uri=/WEB-INF/tld/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=http://java.sun.com/jsp/jstl/fmt; prefix=fmt % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ taglib uri=/WEB-INF/tld/struts-tiles.tld prefix=tiles % %@ taglib uri=/WEB-INF/tld/struts-tiles-el.tld prefix=tiles-el % ... c:set var='a'1/c:setc:out value='${a}'/ (the output is ${a}) ... my web.xml, taglib declaration: taglib taglib-uri/WEB-INF/tld/struts-html.tld/taglib-uri taglib-location/WEB-INF/tld/struts-html.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-html-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-html-el.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-logic.tld/taglib-uri taglib-location/WEB-INF/tld/struts-logic.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-logic-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-logic-el.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-bean.tld/taglib-uri taglib-location/WEB-INF/tld/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-bean-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-bean-el.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-tiles.tld/taglib-uri taglib-location/WEB-INF/tld/struts-tiles.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-tiles-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-tiles-el.tld/taglib-location /taglib taglib taglib-urihttp://java.sun.com/jsp/jstl/fmt/taglib-uri taglib-location/WEB-INF/tld/fmt-1.1.1.tld/taglib-location /taglib taglib taglib-urihttp://java.sun.com/jsp/jstl/core/taglib-uri taglib-location/WEB-INF/tld/c-1.1.1.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/displaytag-el-12.tld/taglib-uri taglib-location/WEB-INF/tld/displaytag-el-12.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/displaytag-12.tld/taglib-uri taglib-location/WEB-INF/tld/displaytag-12.tld/taglib-location /taglib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: standard-1.1.1 expression language not working
Other replies indicated your problem with the web.xml and JSP page. Another point is that you don't use Struts-EL with JSP 2.0. -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 10:07 AM To: [EMAIL PROTECTED] Subject: standard-1.1.1 expression language not working Hi to everyone! I have already used taglibs before but I am having some trouble making jstl core 1.1.1 taglib to evaluate expression languages on Tomcat 5.0.27. I have all of the required libraries on WEB-INF/lib/ (jstl, standard, jdbc_2_0_stdext, xalan and xerces). Tomcat does not give any missing taglib handler... so I supposed it finds all of the necessary classes. I am also using Struts and Struts-el taglibs and they are working correctly. Am I missing something? my jsp file: %@ taglib uri=/WEB-INF/tld/struts-html-el.tld prefix=html % %@ taglib uri=/WEB-INF/tld/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=http://java.sun.com/jsp/jstl/fmt; prefix=fmt % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ taglib uri=/WEB-INF/tld/struts-tiles.tld prefix=tiles % %@ taglib uri=/WEB-INF/tld/struts-tiles-el.tld prefix=tiles-el % ... c:set var='a'1/c:setc:out value='${a}'/ (the output is ${a}) ... my web.xml, taglib declaration: taglib taglib-uri/WEB-INF/tld/struts-html.tld/taglib-uri taglib-location/WEB-INF/tld/struts-html.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-html-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-html-el.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-logic.tld/taglib-uri taglib-location/WEB-INF/tld/struts-logic.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-logic-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-logic-el.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-bean.tld/taglib-uri taglib-location/WEB-INF/tld/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-bean-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-bean-el.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-tiles.tld/taglib-uri taglib-location/WEB-INF/tld/struts-tiles.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/struts-tiles-el.tld/taglib-uri taglib-location/WEB-INF/tld/struts-tiles-el.tld/taglib-location /taglib taglib taglib-urihttp://java.sun.com/jsp/jstl/fmt/taglib-uri taglib-location/WEB-INF/tld/fmt-1.1.1.tld/taglib-location /taglib taglib taglib-urihttp://java.sun.com/jsp/jstl/core/taglib-uri taglib-location/WEB-INF/tld/c-1.1.1.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/displaytag-el-12.tld/taglib-uri taglib-location/WEB-INF/tld/displaytag-el-12.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/tld/displaytag-12.tld/taglib-uri taglib-location/WEB-INF/tld/displaytag-12.tld/taglib-location /taglib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How jsp assigns the variable type for c:set /
Those results seem reasonable. You should assume the value is a string, unless you specifically have an integer type. In your case, the value 1 is a string. Now, if you did ${1}, that might give you an integer. -Original Message- From: Starting out [mailto:[EMAIL PROTECTED] i seemed to ask this on tomcat list, anyway here it is i fetched an int type from mysql and assign to variable c:set var=eid value=${rs.rows[0].eid} scope=session / it seems that its assigning type int since if i String test = (String) pageContext.getAttribute(eid); i get a cast error but if i c:set var=eid value=1 scope=session / the ff String test = (String) pageContext.getAttribute(eid); would work - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: page redirect problem in jstl or jsp?
If it isn't obvious yet, try: c:redirect url=/SearchAction.do/ -Original Message- From: Gao Di [mailto:[EMAIL PROTECTED] i use struts framework in my project,and use the jstl in the jsp page.now i want to write a page which will auto forward to a struts action class,but whatever i use jstl or jsp ,it can't find the url either. in jstl i use:c:redirect url=SearchAction.do/ and in jsp i use: jsp:forward page=SearchAction.do/ if i change the url to xxx.jsp or a simple hello world servlet,it's ok.but if i use struts action,evertime i got page 404,url not found. cause i think the struts action is also a servlet in essential,maybe there is a way to solve this problem. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Scriplet OK, JSTL OK - result different!!
It might be interesting to see what it does with the following: c:out value=${node.title}/ c:if test=${empty node} is empty node /c:if c:if test=${empty node.title} is empty node.title /c:if -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] OK guys, this is an odd one. Have been using JSTL 1.1 for a short while with no problems until today. I am adding a request attribute called node. The following is in my JSP... % Node node = (Node) request.getAttribute(node); out.println(node.getTitle()); % c:if test=${empty requestScope.node} is empty node /c:if The top scriplet section DOES print out the value of the node title, e.g A Title. The JSTL IF block DOES print is empty node. Therefore JSTL _is_ working, just not _finding_! How can this be that JSTL is not able to find my node object but traditional scriplet can? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: passing JSTL to custom tag attribute
I would say there are several basic ideas here: 1. Use a JSP 2.0 container, like Tomcat 5. The JSTL is implemented natively there. 2. Use solution 1. 3. Build a second tag library that's implemented exactly like Struts-EL. Each tag class in Struts-EL is a subclass of the corresponding tag in the base library, and the only functionality in the Struts-EL tag is to pass the attribute value through the EL engine from the Jakarta JSTL implementation. 4. Do not build a tag library that implements your business logic AND references the Jakarta EL engine. When you move to a JSP 2.0 container, you'll then have to spend more time yanking it out. -Original Message- From: Paul Wallace [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 8:15 PM To: [EMAIL PROTECTED] Subject: passing JSTL to custom tag attribute Hi, I wish to call a custom tag, passing a dynamic value for its attribute. I retrieve the value thus: c:set var=userid value=${param.userid}/ and I wish to call my custom tag passing 'userid' as an attribute. Curently I have: my:execute userid=${userid} but the literal string ${userid} is passed into the handler. To acheive the desired results I could of course use: my:execute userid=%= request.getParameter(userid) % but that would mean embedding JSP, when I wish to encompass all logic in tags. Does anyone have any suggestions how I might pass the JSTL value, dynamically to the attribute of my custom tag please? Thanks Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Referencing scriptlet variable in expression language
If you read the JSTL specification, you would have learned that the EL doesn't reference scriptlet variables. -Original Message- From: Derek [mailto:[EMAIL PROTECTED] This has got to be a really trivial thing, but this doesn't work for me: % String test = Happy Days; % ptest: ${test} I was expecting: test: Happy Days However, it just prints out blank. I can make it work by doing this: % String test = Happy Days; % c:set var=test value=%=test%/ ptest: ${test} How do I reference a scriptlet variable directly in EL without having to use c:set? I must be missing something simple. Thanks! Derek = __ Do you Yahoo!? Yahoo! Tax Center - File online by April 15th http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSP2.0 Tag File question
How many items are in the collection? Four? Show us the class represented by your employee object. That is probably the key. -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Saturday, April 03, 2004 10:42 PM To: Tag Libraries Users List Subject: JSP2.0 Tag File question This is just for a demo, but I'm trying to pass in collection into a Tag File. I'm doing something wrong though as I'm getting Unable to find a value for name in object of class java.lang.String using operator . so, I'm thinking maybe I need to do the following differently when in a Tag File. Below is the Tag File: %@ attribute name=employees % %@ taglib uri=jstl/c prefix=c % table border=0 cellpadding=2 cellspacing=2 tr thName/th thAge/th thDepartment/th /tr c:forEach var='employee' items='${employees}' tr tda href=${employee.name}/td td${employee.age}/td td${employee.deptId}/td /tr /c:forEach /table I'm passing in employees from a JSP like: emp:Employees employees=${employees}/ The forEach above works fine in a standard JSP. It even 'sort of' works in this case also since if I replace the tr../tr section above with 'testbr', four test lines print out. Can you not nest a for each with expressions like I'm trying to do in a Tag File? Thanks for any help. -- Rick Before you criticize someone, walk a mile in their shoes. That way, you'll be a mile from them, and you'll have their shoes. /Jack Handey - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using JSTL 1.0.5 ExpressionEvaluatorManager for custom tags
I'm not sure what is wrong. I used ExpressionEvaluatorManager (not ExpressionUtil) to write Struts-EL, so you could inspect that code to look for examples. Ask about enabling aspects of Struts logging in struts-user. It uses commons-logging, so you should be able to set up a logging.properties file with a higher debug level than the default. -Original Message- From: Lionel PASQUIER [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 1:21 AM To: Tag Libraries Users List Subject: RE: using JSTL 1.0.5 ExpressionEvaluatorManager for custom tags Hello Karr, You said that the bean labels is a java.util.List. However, you also said table being the String The error message, Well, I should have been more precise: the table String is actually ${labels}, or at least I believe it is: it is the String set by setTable(String) corresponding to the parameter table of the selectitem tag: mytags:selectitem table=${labels} index=${iteratecount} item=item So I thought that ${labels} should expand through ExpressionUtil.evalNotNull into the List behind the bean labels. Am I wrong? Also note that your c:forEach is putting the iterated item into iterateCount, but I think you meant that to be the loop counter, which yes indeed I was talking about the counter, not the item. Since foreach has only begin and end parameter, it seems it stores an Integer in var. Well at least this part works in my tests. My real problem is about the expand of ${labels} that leads to the error I stated previously. PS: any idea about my log problem? maybe I should ask that in another mail... Lionel -Original Message- From: Lionel PASQUIER [mailto:[EMAIL PROTECTED] Sent: Thursday, March 04, 2004 11:58 AM To: [EMAIL PROTECTED] Subject: using JSTL 1.0.5 ExpressionEvaluatorManager for custom tags Hello, I am willing to create custom tags that have the expression evaluation of the JSTL 1.0.5. I am using tomcat 4, JDK1.4, thus cannot switch to JSTL1.1 . I found the org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager class that seems to be pretty cool. So I made my tags use it, but without success. In my case I have a tag like: c:forEach begin=${0} end=${labelssize - 1} var=iteratecount mytags:selectitem table=${labels} index=${iteratecount} item=item /c:forEach where the bean labels contains a java.util.List . selectitem is supposed to return in the bean named item the Object at index ${iteratecount} of labels. So in the java code I put: Object object = ExpressionUtil.evalNotNull(SelectItem, table, table, List.class, this, pageContext); *table being the String set by parameter table of cours* which, unfortunatly returns an error: An error occurred while evaluating custom action attribute table with value labels: Attempt to convert String labels to type java.util.List, but there is no PropertyEditor for that type (null) Isn't ExpressionUtil.evalNotNull not supposed to returned the Object found behind the bean of resulting parsed String? Maybe the org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager is not supposed to be used for custom tags? Is there a howto about this? I have also another question, but this might not be the best mailing list to ask this: I am using taglibs with tomcat and struts. But I have a lot of logs that never show up anywhere :p (such as the taglib is not found, throws an error, or struts does not find the action, etc...). Could you suggest me a link or two to help me figure out how to configure the stuff correctly? Sorry if these questions have been asked many times already, but I could not find a suitable google answer... Lionel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using JSTL 1.0.5 ExpressionEvaluatorManager for custom tags
You said that the bean labels is a java.util.List. However, you also said table being the String The error message, stating 'Attempt to convert String labels ...' appears to concur with the last statement (that labels is a String, not a List). It sure seems like labels is a String, not a List. Also note that your c:forEach is putting the iterated item into iterateCount, but I think you meant that to be the loop counter, which would mean you should have used varStatus instead of var, and probably change the reference to it later. -Original Message- From: Lionel PASQUIER [mailto:[EMAIL PROTECTED] Sent: Thursday, March 04, 2004 11:58 AM To: [EMAIL PROTECTED] Subject: using JSTL 1.0.5 ExpressionEvaluatorManager for custom tags Hello, I am willing to create custom tags that have the expression evaluation of the JSTL 1.0.5. I am using tomcat 4, JDK1.4, thus cannot switch to JSTL1.1 . I found the org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager class that seems to be pretty cool. So I made my tags use it, but without success. In my case I have a tag like: c:forEach begin=${0} end=${labelssize - 1} var=iteratecount mytags:selectitem table=${labels} index=${iteratecount} item=item /c:forEach where the bean labels contains a java.util.List . selectitem is supposed to return in the bean named item the Object at index ${iteratecount} of labels. So in the java code I put: Object object = ExpressionUtil.evalNotNull(SelectItem, table, table, List.class, this, pageContext); *table being the String set by parameter table of cours* which, unfortunatly returns an error: An error occurred while evaluating custom action attribute table with value labels: Attempt to convert String labels to type java.util.List, but there is no PropertyEditor for that type (null) Isn't ExpressionUtil.evalNotNull not supposed to returned the Object found behind the bean of resulting parsed String? Maybe the org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager is not supposed to be used for custom tags? Is there a howto about this? I have also another question, but this might not be the best mailing list to ask this: I am using taglibs with tomcat and struts. But I have a lot of logs that never show up anywhere :p (such as the taglib is not found, throws an error, or struts does not find the action, etc...). Could you suggest me a link or two to help me figure out how to configure the stuff correctly? Sorry if these questions have been asked many times already, but I could not find a suitable google answer... Lionel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Subtracting 2 values from different collections using for:each and el
Read the specification. These questions are easily answered there. In short, use the varStatus attribute. -Original Message- From: Adam Bickford [mailto:[EMAIL PROTECTED] Sent: Thursday, February 12, 2004 12:36 PM To: Tag Libraries Users List Subject: Subtracting 2 values from different collections using for:each and el In a nutshell, I want to iterate over a collection and subtract a value from a different collection with the same position as the current collection. The problem is, I don't know how to reference the current iterator. For example, how would I do something like this: int[] a = {0,1,2,3,4,5,6,7,8,9}; int[] b = {9,8,7,6,5,4,3,2,1,0}; for(int i = 0; i a.length; i++){ System.out.println(b[i]-a[i]); } How could I achieve that in JSTL using el? c:forEach var=total items=${dailyTotals} td c:out value=${total-(value in another collection with the same index as this loop)}/ /td /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problems with c:forEach and c:redirect
So the code above the redirect is only doing computation, and is not intentionally generating output, correct? You might have to make your code look ugly to prevent emitting newlines. As the number of items you have to iterate through gets larger, the computation-only loop will be generating more newlines. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 11:27 AM To: [EMAIL PROTECTED] Subject: Problems with c:forEach and c:redirect I am having a strange problem with the c:forEach tag in conjuction with c:redirect. I am using the Standard 1.0.4 taglib on a WebLogic 7.0SP2 container. The problematic code is below (sorry if it formats strangely in email). I save the various roles into a session-scoped variable named userRoles. It is a string and always starts with a comma. If I have more than 21 roles in this string, any c:redirect I have below the code below refuses to work and I get a message in my logs about the response already being committed. Anyone have any ideas? --- Code Below c:forEach var=userRole items=${userRoles} c:choose c:when test=${userRole == 'DEVELOPER'} c:set var=accessDevGranted value=TRUE / /c:when c:when test=${userRole == 'SECRETARIAT'} c:set var=accessSecGranted value=TRUE / /c:when c:when test=${GroupAbbrevs.rowCount 0} c:forEach var=row items=${GroupAbbrevs.rows} varStatus=rowStatus c:set var=fgl value=FGL_${row.abbrev} / c:set var=fgsl value=FGSL_${row.abbrev} / c:if test=${userRole == fgl || userRole == fgsl} c:set var=accessFGGranted value=TRUE / c:set var=lead_count value=${lead_count + 1} / c:set var=lead_list value=${lead_list},${row.abbrev} / /c:if /c:forEach /c:when /c:choose /c:forEach --- End of code --- Stephen Letschin [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Redirect from imported file
Whether it works or not, note that redirecting in JSP isn't really considered a good idea. You run a risk of having your initial buffer already being flushed to the client, which would throw an exception (InvalidStateException?). It's best to make redirection decisions in your application logic, not in the view pages. -Original Message- From: Dima Gutzeit [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 4:30 AM To: [EMAIL PROTECTED] Subject: Redirect from imported file Dear list members, I am expiriencing the following behaviour : c:redirect/ Tag does not work from within JSP file , that was imported using c:import/ or jsp:include/. Instead of redirecting , the execution of JSP file continues after the import statement. Has anyone expierenced such thing ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Performance issues
My point is, it would be good to make sure your measurements don't include the initial generation and compile of the servlet. This will take quite a while, relatively, and will only happen once. Depending on how much continuous load you're providing, it may be less of a factor, but you should be aware of that, in any case. -Original Message- From: Colin Chalmers [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 5:17 AM To: Tag Libraries Users List Subject: Re: Performance issues Karr, David wrote: Just in case, are you doing your measurements AFTER the first generation/compile of the servlet? It's not meaningful to measure taglib performance before then. Measurements are taking place during a continuous load of approx 60 users. With respect to caching evaluation results, it's probably not worth it, as it would have to do most of the evaluation before it could determine that nothing has changed, causing a cache read. OK, thx for the reply Colin -Original Message- From: Colin Chalmers [mailto:[EMAIL PROTECTED] Hi all, We've just started implementing TagLibs in our App and are seeing a couple of performance issues which I'd like to check with the group. We make heavy use of theExpressionEvaluationManger, is there any way to tweak this so that it pools/caches results? We also make a lot of use of the choose/when/otherwise Can this be a potential bottleneck compared to using a simple if loop? Thx Colin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Performance issues
Just in case, are you doing your measurements AFTER the first generation/compile of the servlet? It's not meaningful to measure taglib performance before then. With respect to caching evaluation results, it's probably not worth it, as it would have to do most of the evaluation before it could determine that nothing has changed, causing a cache read. -Original Message- From: Colin Chalmers [mailto:[EMAIL PROTECTED] Hi all, We've just started implementing TagLibs in our App and are seeing a couple of performance issues which I'd like to check with the group. We make heavy use of theExpressionEvaluationManger, is there any way to tweak this so that it pools/caches results? We also make a lot of use of the choose/when/otherwise Can this be a potential bottleneck compared to using a simple if loop? Thx Colin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: c:forEach, c:import and variable scope?
I can't see how that could work. The c:import operation is processing that URL in an external context. You'd probably have to use jsp:include for that sort of thing. -Original Message- From: otisg [mailto:[EMAIL PROTECTED] Here is the problem (using [] to avoid problems with email clients not handling HTML well). Summary: c:forEach loop, inside it c:import, but the c:import-ed JSP does not see the var from the c:forEach loop. [c:forEach var=foo items=${bars}] [c:import url=some/page.jsp/] [/c:forEach] In this page.jsp I try to access ${foo}, like so: [c:out value=${foo}/] No go. ${foo} seems undefined there :( page.jsp does not see it. Scope issue? I then tried adding the following inside that c:forEach: [c:set var=newFoo value=${foo} scope=request/] However, that c:import-ed page.jsp does not see ${newFoo} either. :( I am using jakarta-taglibs 1.0.3 with JBoss/Jetty. Is the above supposed to work? How do I get the import-ed page.jsp to see a variable defined in the page that imported it? Thanks, Otis Get your own 800 number Voicemail, fax, email, and a lot more http://www.ureach.com/reg/tag - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: New to JSTL
Well, I can see several things here. First of all, it's important for us to know what container and version you're using. From the error you got from the JSTL test case, I'm guessing you're using one of the revisions of Tomcat 5. You talk about a bean that does some JDBC work. That certainly can work, but it sends up a red flag for me. It's best to have bean classes that are simple containers, and business logic in other classes which populate those beans. In the JSTL, you work with beans and their properties. In JSP 2.0, you have some limited ability to call functions, but I wouldn't focus on that too much. If you have a bean that has a getCustomerList() method, this represents the customerList property, so you would reference this in the EL with ${foundryCustomer.customerList}. Your attempt to mix scriptlets with the JSTL doesn't work because the EL only reads page-scoped attributes, not scriptlet variables. If you haven't read the JSTL specification, read it. -Original Message- From: William R Briggs [mailto:[EMAIL PROTECTED] I've done a small amount of JSP and servlet programming in the past, but most of my java programming has not been web-based. I am currently trying to write a small JSP web application in order to learn more about it. In my app, I have a bean that performs some database access via JDBC. The bean has a method that returns an ArrayList of customer names, and I want to list these names in a pull-down. Prior to using JSTL, I would have done this: select name=custName % ArrayList custNames = foundryCustomerQuery.getCustomerList(); for(int i = 0; i custNames.size(); i++) { option selected=selected %= custNames.get(i) % /option% } % /select This works fine, just as I expect it would. Now, trying to do this with JSTL: c:forEach var=customer items=${foundryCustomerQuery.getCustomerList()} optionc:out value=${customer} //option /c:forEach I receive the error The function getCustomerList must be used with a prefix when a default namespace is not specified. I'm stumped, as my knowledge of JSTL is not great enough to figure out what is going on here. I have also tried mixing a scriptlet with the JSTL tags (not something I want to do), like so: % ArrayList custNames = foundryCustomerQuery.getCustomerList(); % c:forEach var=customer items=${custNames} optionc:out value=${customer} //option /c:forEach This produces no errors, but the forEach loop provides no output. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Unstandard Library Source / Developing custom EL taglibs
As another poster pointed out, the source for the Struts-EL taglib is one example of a library that specifically uses the EL. I would recommend that you don't write a standalone library that uses the EL, but instead extend a non-EL library, and keep all the real business logic in the non-EL library. If you have a JSP 2.0 web container, you can use the base library, and still use the EL wherever you want (and even more than with the EL library in JSP 1.2). -Original Message- From: Chaimungkalanot, Mark [mailto:[EMAIL PROTECTED] Sent: Sunday, November 09, 2003 2:52 PM To: Tag Libraries Users List Subject: Unstandard Library Source / Developing custom EL taglibs Hi there, I'm looking for examples of Taglibs that uses EL and so I thought that a relatively simple library like the Unstandard taglibs in sandbox would be the most appropriate. I've downloaded the src dist. for Jakarta taglibs but the source for unstandard doesn't seem to be there. Does anyone know where I can d/l this from? Or does anyone have a good reference site for developing custom taglibs with EL? Thanks Mark C ** IMPORTANT MESSAGE ** This e-mail message is intended only for the addressee(s) and contains information which may be confidential. If you are not the intended recipient please advise the sender by return email, do not use or disclose the contents, and delete the message and any attachments from your system. Unless specifically indicated, this email does not constitute formal advice or commitment by the sender or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: out unable to find value
-Original Message- From: Morrow, Steve D. [mailto:[EMAIL PROTECTED] I have a session-scoped bean structured (in part) as follows: public class Customer { public Integer id; public String name; public Integer getId() { return id; } public String getName() { return name; } } In the JSP, c:out value=${customer.name} / works as expected. However, c:out value=${customer.id} / does not - it throws an error that the JSP is unable to find a value for id in object... I added the following Did you try changing id to be a string property, instead of Integer? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Storing JSTL/EL statements?
You might get mileage out of something like this: ${requestScope[expression]}. -Original Message- From: [EMAIL PROTECTED] i have, what is hopefully, a very brief question. does anyone know of a way to evaluate an EL statement that is cached in request/session/etc scope? say you have business.name expression stored in request scope (tied to expression) alongside a business object. i'd essentially like to do something like this: c:out value=${${expression}} / which would perform 2 evaluations giving - in theory: c:out value=${business.name} / Business Foobar (assuming Business Foobar is the name attribute of hte business attribute). this one's killin' me! :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with c:import (JSTL 1.0)
Looks like you're missing a at the end of the c:if. -Original Message- From: Stephen Letschin [mailto:[EMAIL PROTECTED] I am having a problem with a c:import that I hope someone has an answer to. lines deleted %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % %@ taglib uri=http://java.sun.com/jstl/fmt; prefix=fmt % fmt:setLocale value=en-US / fmt:setBundle basename=resources.application / fmt:parseDate var=lastModDate value=10/23/2003 pattern=MM/dd/ scope=request / c:if test=${empty lastModifiedDate || lastModDate lastModifiedDate} c:set var=lastModifiedDate value=${lastModDate} scope=request / /c:if Thanks. Stephen Letschin [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help with JSTL...
-Original Message- From: Jacob Wilson [mailto:[EMAIL PROTECTED] I am developing a new application in Struts and just wanted to see how to implement JSTL in my jsps... I am trying to iterate a loop using a jstl tag... I am specifying a collection object in the items attribute of the iterator action. I get this following error... org.apache.jasper.JasperException: An error occurred while evaluating custom action attribute value with value ${actual.name}: Unable to find a value for name in object of class java.lang.String using operator . (null) My jsp goes something like this... table align=center border=0 cellspacing=1 cellpadding=1 width=748 tr bgcolor=#99 th bgcolor=#cc class=blueLink align=center width=User Name/th th bgcolor=#cc class=blueLink align=center width=Password/th /tr c:forEach var=actual items=${loginForm.clientCollection} tr bgcolor=#9EC6FF td class=content align=left c:out value=${actual.name}/br The collection in the clientCollection property has to be a collection of JavaBeans, each of which has a name property (and others) referenced by standard JavaBean accessors. From your error message, I'm guessing that clientCollection is a collection of java.lang.String objects. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tag Lifecycle
-Original Message- From: Lukas Bradley [mailto:[EMAIL PROTECTED] What is the lifecycle of custom tags? Are tag objects reused throughout a page? It seems as if my tags are not always being created. They are not *always* reused however. The custom tag lifecycle is probably the biggest and most obscure stumbling block for tag writers. You should read the JSP specification for the details on this. Basically, a tag instance will be reused for another occurrence of the tag on the page if it has all the same attributes, and all the same values. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can EL take variables?
One way to get indirection is to use the fact that the several variable scopes are all hashmaps available to the EL. So, if you have a variable named formName that contains the name of a variable you want to reference, you can reference pageScope[formName] to reference that variable. If you use this technique, you have to know what scope the variable is in (page, request, session, or application). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2003 9:38 AM To: [EMAIL PROTECTED] Subject: Can EL take variables? I'm hoping there is a way to do this but I haven't figured it out yet... I have a DynaActionForm but the form name is a variable since the user could be coming from two different sections and I'm trying to utilize one page to handle either request... So I have a c:set tag that defines the formName like so... c:set var=formName value=${formName}/ but when I try to use this in my conditional statements, EL is treating formName as a string and not a form c:if test=${formName.map.} %-- Whatever --% /c:if I'm getting a compilation error. 'formName' should be translated to the actual form bean name such as 'kmoCreateComplexForm' or 'kmoCreateSimpleForm' depending on where the user is coming from. Is there a way to do this? What am I doing wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: writing a custom tag that can use EL
-Original Message- From: Eric W Hauser [mailto:[EMAIL PROTECTED] On Wed, 3 Sep 2003, Felipe Leme wrote: - you *have* to add the code that evaluates the expression. With JSP 2.0 you won't need to, it's done automatically Although this is obviously a valid point, waiting for JSP 2.0 is not really a good solution for the present. Especially if you are someone who is programming for a container such a Websphere, meaning that you probably won't see JSP 2.0 for over another year. If you're lucky enough to use something like Resin, you'll probably have access to a 1.4 container in the next month, but I people will have access to use this in the near future. - the settters of your tag ahndler have to take an String as parameter, even if the expression will be evaluated in another type (for instance, the value attribute on fmt:formatDate is a java.util.Date) Yes, I agree this is more work. But more work programming your taglib isn't necessarily a bad thing, especially if it is going to save you time down the road by eliminating annoying and lengthy scriptlets. One mitigation strategy that can help (which I somewhat accidently implemented) is if you have (or implement) a tag library that doesn't depend on the EL, and then you write a taglib-el library that extends the original tag library. The process to do this (write an el version of a taglib) is very straightforward (just look at the struts-el implementation). In fact, it's feasible to consider writing code to generate the el version of a tag library. I've started to write this, but I may not find enough spare time to do this before JSP 2.0 is released, making this moot. If you use this strategy, you can concentrate your business logic in the non-el library, and then when JSP 2.0 is available, you can drop the el library. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: forEach problem
If you're using the non-RT version of the tag library, then you can't use expression scriptlets for attribute values. You'll have to change your initial c:set to this (untested): c:set var=sectionListKey %=Constants4Lists.SECTION_LIST % /c:set -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Hi All, I'm trying to swop a struts logic:iterate tag for a c:forEach and I have run into the problem that I get no output. I get no errors either. There is obviously something wrong with my forEach tag. Here is what I have: c:set var=sectionListKey value=%=Constants4Lists.SECTION_LIST % / c:forEach var=idata items=${requestScope[sectionListKey]} blacksail:row oddStyleClass=odd evenStyleClass=even td class=listTitle c:out value=${idata.map.title} default=error/ /td /blacksail:row /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: problems with install
You'll need to use a J2EE 1.3 compatible container to get this to work. -Original Message- From: e [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 11:10 AM To: [EMAIL PROTECTED] Subject: problems with install I've downloaded the standard taglibs from http://www.apache.org/dist/jakarta/taglibs/standard/ I am having issues with getting them to work. I am using the following in my jsps: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % If I don't declare the taglibs in my web.xml file, I get: Fatal error: http://java.sun.com/jstl/core: Failed to find taglib for an absolue URI 'http://java.sun.com/jstl/core'. Fatal error: /WEB-INF/tiles/content/menu.jsp (5): TagLib declaration prefix='c', uri='http://java.sun.com/jstl/core' failed, reason: Failed to find taglib for URI. If I do declare them as follows, I get errors... taglib taglib-urihttp://java.sun.com/jstl/core/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib Warning: http://java.sun.com/jstl/core: Unknown element 'tlib-version' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'jsp-version' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'short-name' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'display-name' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'description' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'validator' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'tag-class' encountered while parsing the TLD. Warning: http://java.sun.com/jstl/core: Unknown element 'body-content' encountered while parsing the TLD. Anybody have any ideas what I'm doing wrong? I have J2EE 1.2. Thanks. -e - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL or html:options issue
Do you have more than one getPo function? Do you have a setPo function? And a long shot, you might try changing po to something more than two letters (making sure you change all your accessors in the same way). -Original Message- From: Shah, Shrihas (OFT) [mailto:[EMAIL PROTECTED] Hi All: I am unable to use html:options tag or unable to use JSTL in following scenario. But I can use scriptlets. Here is the scenario. I have search.jsp and actionform is SearchForm.java (It's name in struts-config.xml is 'searchForm') In search.jsp the code is html:select property=po html:options property=po / /html:select --- if I have following code in search.jsp it does not work either c:forEach var=x items=${searchForm.po} / c:out value=${x} / /c:forEach In SearchForm.java the getPo function is as follows. public HashSet getPo() { po = new HashSet(); // And this does return results. If I return array list it does not work either ArrayList al = lu.getAttributes(nyappPODAdminOU); po.addAll((Collection)al); return po; } When I run the search.jsp it gives following error. Error 500: An error occurred while evaluating custom action attribute value with value ${searchForm.po}: Unable to find a value for po in object of class us.ny.state.oft.da.forms.SearchForm using operator . Any clue?? If I use scriptlet as below it works fine. (after I use jsp:useBean tag) % HashSet hs = searchForm.getPo(); for ( Iterator i=hs.Iterator(); i.hasNext();) {% html:option value=%(String)i.Next()%/ % } % - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Way to compare scoped value to a class constant variable?
The pre-JSP 2.0 version of the JSTL can reference properties of JavaBeans, and entries of collections and maps. That's it. If you have a bunch of constants that you might want to reference, you might consider processing a class with reflection, loading all the static final variables into a hashmap, keyed by the variable name. The resulting references in your JSP would look almost the same as you were intending. -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 7:47 AM To: Tag Libraries Users List Subject: Way to compare scoped value to a class constant variable? I'm wondering if there is a way I could compare a scoped variable to a static constant variable that is in a class? For example in Const class I have some levels like: public static final int JVP_LEVEL = 3; It would be nice if in my JSP I could do (after the import up top).. c:if test=${myScopedVar == Const.JVP_LEVEL} / I know I could just do .. c:if test=${myScopedVar == 3} / But it is clearer in the code to use the Constant name. Is it possible to do this somehow? Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Way to compare scoped value to a class constant variable?
-Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] On Tue, 2003-07-22 at 10:54, Karr, David wrote: If you have a bunch of constants that you might want to reference, you might consider processing a class with reflection, loading all the static final variables into a hashmap, keyed by the variable name. The resulting references in your JSP would look almost the same as you were intending. True, that would work but was wanting to avoid doing that (aka - lazy:) Thanks. So for every constant value that you want to use, in every JSP page, you're going to have a call to the bind tag from the unstandard library? This is as opposed to a single block of code in a servlet to load the constants into a bean at application startup. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Length of collection using EL?
This has been discussed numerous times on this list. The EL can reference javabean properties, and elements of collections and maps. That's it. The length of a collection is not a javabean property. It's straightforward to implement a simple class called CollectionBean (and MapBean) that is constructed with a collection (or map), which has two javabean properties, being collection and size. You would do this setup outside of your JSP page, in your prepare servlets or actions. -Original Message- From: Sgarlata Matt [mailto:[EMAIL PROTECTED] Does anyone know how to get the length of a collection using the EL? I am trying to do one of the tests below. Note that children is a List. c:if test=${component.parentDao.children.length 1} !-- stuff here -- /c:if or c:if test=${component.parentDao.children.size 1} !-- stuff here -- /c:if And get this error: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute test with value ${component.parentDao.children.length 1}: The . operator was supplied with an index value of type java.lang.String to be applied to a List or array, but that value cannot be converted to an integer. Thanks! Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to ask length of collection in JSTL tags
As you may know by now, the EL in this version only allows you to access javabean properties, and collection and map entries. You can't directly get the length of a map or collection. What I've done recently is implement a small class called CollectionBean which has two javabean properties of collection and size. You create a CollectionBean with a collection. Put the collectionBean in a scope accessible to your page and reference the properties in your EL references. You can do the same thing for MapBean. -Original Message- From: Dmitri Ilyin [mailto:[EMAIL PROTECTED] Hi, how can i get the length(size) of the collection?? I have a collection in page scope and i'd like to check the length of this collection. I use c:if test=${collection.length == 1} that's it /c:if collection.length returns always 0. the same with collection.size and collection.itemCount HELP!! thanks a lot regards Dmitri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Whitespace Galore!
First of all, you will always run some risk if you try to redirect from a JSP page. Nevertheless, if the redirect is near the top of the page and your buffer size is of a reasonable size, you should be ok. If you're failing, then you either have a miniscule buffer size, or your redirect element is not near the beginning of the page (or your redirect is in a deeply included page). I wouldn't start worrying about the white space emitted by your tags. If you have to be concerned about that, you have other problems. -Original Message- From: Rick Ross [mailto:[EMAIL PROTECTED] Hi all, I've been running into two little oddities that I thought might be worth some discussion. 1. I was not able to redirect a page based on a JSTL condition tag (c:if, c:choose, etc.) because the tags themselves would invariably pump some \r\n's into the page. This of course, caused a commit on the output stream which disallowed any redirect actions. So basically something like c:if test=${true} c:redirect url=otherplace.html / /c:if Will never redirect. Now, remember that the code above is actually the same as : c:if test=${true}[crlf][space][space][space]c:redirect url=otherplace.html /[crlf] /c:if[crlf] Even so, if leave you out the extra whitespace, like so: c:if test=${true}c:redirect url=otherplace.html //c:if It will still fail. taking a look at the _jsp.java file shows the culprit. Very early on, a \r\n combo gets written to the output stream. Naturally, I have buffering set and autoFlush off. Of course there are a dozen ways around this, so it's no big deal, but I doubt that it is intentional and extra whitespace is my second point. 2. There is a ton of whitespace all over my output. Many many newlines ... so many, that it is hard to examine the source of the output. I think that most of it is in the bodies of conditionals... anyone else having problems? Rick Ross Any sufficiently complex technology is indistinguishable from garbage - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL and isUserInRole
This is handled with the logic:present tag in Struts. You can't call arbitrary methods in the first version of the JSTL. -Original Message- From: Jim Kennedy [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 12:58 PM To: Tag Libraries Users List Subject: JSTL and isUserInRole Has anyone tried this using pure JSTL or Struts. No rt. I need to do something like this in JSP's c:if test=${pageContext.request.userInRole('foo') == true} ... /c:if The above does not work. How can I do this? isUserInRole(String) is the method I need to call. Or maybe there is another way around this. I want to be able to show content conditionally on the j2ee role. Jim Kennedy IT Consultant - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL and isUserInRole
Uh, no, that won't work. You can't call arbitrary methods in JSTL. -Original Message- From: Kumar, Kiran [mailto:[EMAIL PROTECTED] change it to c:if test=${pageContext.request.isUserInRole('foo')} Thanks KiranKumar (Raj) ext 7203 -Original Message- From: Jim Kennedy [mailto:[EMAIL PROTECTED] Has anyone tried this using pure JSTL or Struts. No rt. I need to do something like this in JSP's c:if test=${pageContext.request.userInRole('foo') == true} ... /c:if The above does not work. How can I do this? isUserInRole(String) is the method I need to call. Or maybe there is another way around this. I want to be able to show content conditionally on the j2ee role. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Users Roles in JSTL
You'll find that complex applications will end up using more than one tag library. It's not really practical to assume you'll do everything with a single tag library, whether it's Struts, JSTL, or the Display tag library. If you want to use both Struts and JSTL, you can use the Struts-EL library from the contrib section of the Struts distribution. -Original Message- From: Fulbright, Scott [mailto:[EMAIL PROTECTED] I am trying to optionally insert content if a user has a specific role. I am currently developing an application using JSTL Struts. I would really like a construction similar to: !-- This is Struts -- logic:present role=Admin !-- Optional content -- /logic:present But I would much prefer using a JSTL tag to do this. I have attempted several different ways of doing this, but have been unable to locate a JSTL construction that performs the same function. I am relatively new to these two technologies, and would appreciate any pointers that more experienced developers can give me. Ideally, I would like a JSTL statement analogous to the above code fragment. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Non EL enabled tags
The attribute specification in your TLD needs to have rtexprvalue set to true. Check the JSP specification or a JSP book about this. -Original Message- From: James Norman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 10:30 AM To: [EMAIL PROTECTED] Subject: Non EL enabled tags If I were to write a non EL-enabled tag of my own, would the following work: myTag:something value=%= request.getContextPath() % / b/c I am getting the string literal in the tag. -james - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Accessing scope attributes with dotted names using JSTL
I guess one thing that might help a tiny bit is if there was a map in some scope that is formed by merging (in order) the applicationScope, sessionScope, requestScope, and pageScope maps. That would give you a single map to search, instead of having to know which scope to look in. -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Thanks, but that's not what I'm trying to accomplish. It's very common to place beans into session or application scopes with names such as org.apache.struts.action.ACTION_MESSAGE. This is similar to the Java package naming convention and accomplishes the same purpose of avoiding name collisions. In order to access the bean, you need to be able to specify a dotted name, but you might not always know in which scope it will be found. Hence the need to be able to specify a dotted bean name in EL. The problem is that either EL interprets the string as a path to a nested property or, if you escape the string, as a literal string. Ultimately, I need to be able to access the PageContext.findAttribute(java.lang.String name) method using EL, but as this method does not meet bean property naming conventions I can't even do something like ${pageContext[dotted.name]}. I had a look through the JSTL 1.0 and JSP 2.0 specs last night and this case just does not seem to be addressed. As this is a very common requirement, I'm surprised that it's not covered. Steve -Original Message- From: Daniel Montero [mailto:[EMAIL PROTECTED] Sent: June 5, 2003 10:24 AM To: Tag Libraries Users List; [EMAIL PROTECTED] Subject: Re: Accessing scope attributes with dotted names using JSTL You could access a variable as ${mydomain.mybean} if you created a bean mydomain (Hashtable, for example), and set any attributes you want there. % Hashtable mydomainVar = new Hashtable(); String mybeanVariable=this is a test; mydomainVar.put(mybean, mybeanVariable); request.setAttribute(mydomain, mydomainVar); % c:out value=${mydomain.mybean}/ HTH, danim - Original Message - From: Steve Raeburn [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 11:12 AM Subject: RE: Accessing scope attributes with dotted names using JSTL Thanks, that works. You're a star! Now, a follow up ... :-) Is there any way to do it without specifying the scope? As in c:out value=${\mydomain.mybean\} (which doesn't work). Steve -Original Message- From: Bruce Perry [mailto:[EMAIL PROTECTED] Sent: June 4, 2003 2:42 AM To: Tag Libraries Users List Subject: Re: Accessing scope attributes with dotted names using JSTL Try this: c:out value=${requestScope[\mydomain.mybean\]} / requestScope is an EL implicit object. Bruce - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: lookup when a name contains a dot
It's unfortunate, but that would be another strategy that would make your life easier. -Original Message- From: Brian Buckley [mailto:[EMAIL PROTECTED] David, Thanks for your help. Perhaps my convention of naming objects using their fully-qualified package names ought to be changed to avoid having dots in the names. Brian I can only see one way to do this, and it's not simple. You'd have to write a custom tag that would create a page-scoped variable which is a single map variable that has been merged from the following maps, in order: application, session, request, and page. Then you could reference your dotted variable in quotes around array brackets, and it will essentially search the scopes in order. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Variable in a Struts tag
Ask Struts questions on the struts-user list. If you want to use the JSTL with Struts, you should probably use the Struts-EL library, which is a contributed library in the nightly build. -Original Message- From: Giovanni Formenti [mailto:[EMAIL PROTECTED] I have the JSTL/Struts code: c:import url=sample.xml varReader=xmlSource x:parse var=customer xml=${xmlSource} / /c:import html:form ... x:set var=custName select=$string(customer/name) / Customer Name: html:text value=${custName} ... / ... /html:form But when i write: Customer Name: html:text value=${custName} ... / the Struts taglib don't reads ${custName} as a variable but as a string so create a textbox with the string ${custName} inside! How can i do?! Thanx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Evaluating expression on my custom tags
The Jakarta JSTL implementation provides a public API that you can use in your own tag libraries. You can browse the javadoc for the ExpressionEvaluatorManager class. You could also browse the source code for the Struts-EL contributed library in the Struts distribution. If you inspect the EvalHelper class and any of the EL..Tag classes, you'll see numerous examples of this. -Original Message- From: Danilo Luiz Rheinheimer [mailto:[EMAIL PROTECTED] In JSTL we can use a expression language in parameters expressions, like : HTMLThanks for logging in, c:out value=${name}/./HTML The ${name} is evaluated and this value is send to the c:out tag. I want the user of my tags can use ${} expressions on the parameters of my taglib. It possible use this expression evaluator to be used in my custom tag list without a lot of work ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java constants as attribute values
The JSTL EL references JavaBeans properties, collections, and maps. That's it. If you want to reference a constant, you'll have to have your business or setup logic put the constant into a JavaBean property, collection, or map. -Original Message- From: René Zanner [mailto:[EMAIL PROTECTED] I have a question regarding usage of Java Constants as attribute values. In STRUTS I can do the following: bean:define id=myBean name=%= MyConstants.SESSION_OBJECT % scope=session/ In JSTL, I wanted to do something similar, like: core:set var=myBean value=${sessionScope.%= MyConstants.SESSION_OBJECT %}/ (I know that the syntax is not correct!) It seems that it's not really possible to do something like that with JSTL. Anyway - does anybody have a hint what's the correct syntax or have a work-around to use Java-Constants as attribute names in JSTL? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tag libraries that use ExpressionEvaluator depend on Jakarta implementation
-Original Message- From: Pierre Delisle [mailto:[EMAIL PROTECTED] David M. Karr wrote: This is probably obvious, but it is the case that any tag libraries that use the ExpressionEvaluator class in the Jakarta JSTL implementation are actually dependent on the Jakarta implementation, as opposed to the specification, correct? Yes this is correct, as mentioned also by Tim. Since only the JSP api is described in the specification, and not the Java api, Sorry, I don't quite get the distinction you're making here. I simply meant that the specification defines the API available to you in JSP pages, but not what API you could use in Java classes. Reiterating the fact that it doesn't define an ExpressionEvaluator interface of any kind. This is really just a restatement of the other points, which you got. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: need a scope/visibility example (newbie)
You likely will have more problems if you don't have time to read the specification. The JSTL expression language can only reference javabeans properties, collections entries, and map entries. It can't reference variables directly, and it can't call functions, except for javabeans property getters and setters. The fastest way to get this one line to work would be to add a scriptlet before this that takes the static variable and puts it into a page-scoped variable (not a scriptlet variable), and then reference the page-scoped variable in the expression. It would be better in the long run if your business logic put the constants you require into an application-scoped variable (at a single point in the application). -Original Message- From: Emmanuil Batsis (Manos) [mailto:[EMAIL PROTECTED] Can someone please tell me how to make the following expression evaluate correctly? c:if test=${foo == SomeClass.SOME_CONSTANT} I know I have to check with the documentation but I'm under pressure and can't figure it out right now... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Session
Use the JSTL. It would be as simple as this: c:out value=${SESSION_USER.firstName}/ Or if you wanted to make sure you got it from session scope: c:out value=${sessionScope.SESSION_USER.firstName}/ -Original Message- From: Sloan Seaman [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 9:16 AM To: [EMAIL PROTECTED] Subject: Session What is the best way to get an object out of the session? The session taglib only has the sess:attribute tag which will print it. I want to do more along the lines of: sess:attribute name=SESSION_USER id=user scope=session jsp:getProperty name=user property=firstName/ /sess:attribute I have written my own tag to do this but I ma curious if there are any apache tags to do this and if not, why? You can store more than strings in the session attributes... -- Sloan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: attributes required but not both.
Well, if you want to validate this at translation time, then I guess a TagExtraInfo class would do it. This will have a isValid() method, which takes a TagData object, which is basically a hashmap of attributes and values. You specify the presence of the TEI class in the TLD. -Original Message- From: Jeff Born [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 1:30 PM To: Tag Libraries Users List Subject: attributes required but not both. I have two attributes that one or the other is required, not both. Where do I define this? I know I read this is possible, but haven't been able to figure out where I saw that information. Thanks in advance for any insight into this, Jeff Born - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL problems on Tomcat 4.1.x
It might be useful if we could see your JSP code, and any relevant bean code if it's non-trivial. -Original Message- From: Schnitzer, Jeff [mailto:[EMAIL PROTECTED]] Sent: Wed 02/12/2003 3:17 PM To: [EMAIL PROTECTED] Cc: Subject: JSTL problems on Tomcat 4.1.x I get an occasional NullPointerException deep in JSTL when running under load on Tomcat 4.1.x. This doesn't occur under 4.0.x. Are the JSTL tags tested on Tomcat 4.1.x? When this problem happens, the page half-loads (up to the tag that fails). Refreshing the page almost always works fine. Under heavy load, maybe 1 in 100 page executions cause this problem. Here is the deepest stack trace I have managed to obtain (by modifying the Jakarta taglibs slightly to print a little extra debugging): 2003-02-12 23:11:48,190 ERROR [STDERR] An error occurred while getting property player from an instance of class com.maxis.tso.community.tool.ThreadTool: java.lang.NullPointerException 2003-02-12 23:11:48,192 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.Logger.logError(Logger.java:965) 2003-02-12 23:11:48,192 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.Logger.logError(Logger.java:1173) 2003-02-12 23:11:48,192 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.ArraySuffix.evaluate(ArraySuffix.j ava:321) 2003-02-12 23:11:48,192 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.ComplexValue.evaluate(ComplexValue .java:146) 2003-02-12 23:11:48,192 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(ELEvaluator.j ava:242) 2003-02-12 23:11:48,193 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(ELEvaluator.j ava:201) 2003-02-12 23:11:48,193 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java: 138) 2003-02-12 23:11:48,193 ERROR [STDERR] at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java: 167) 2003-02-12 23:11:48,193 ERROR [STDERR] at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.eval uate(ExpressionEvaluatorManager.java:112) 2003-02-12 23:11:48,193 ERROR [STDERR] at org.apache.taglibs.standard.tag.el.core.IfTag.condition(IfTag.java:95) 2003-02-12 23:11:48,193 ERROR [STDERR] at javax.servlet.jsp.jstl.core.ConditionalTagSupport.doStartTag(Conditional TagSupport.java:122) 2003-02-12 23:11:48,193 ERROR [STDERR] at org.apache.jsp.mb_posts_jsp._jspx_meth_c_if_4(mb_posts_jsp.java:3923) 2003-02-12 23:11:48,194 ERROR [STDERR] at org.apache.jsp.mb_posts_jsp._jspx_meth_c_if_3(mb_posts_jsp.java:3535) 2003-02-12 23:11:48,194 ERROR [STDERR] at org.apache.jsp.mb_posts_jsp._jspService(mb_posts_jsp.java:615) 2003-02-12 23:11:48,194 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) 2003-02-12 23:11:48,194 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 2003-02-12 23:11:48,194 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:204) 2003-02-12 23:11:48,194 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289) 2003-02-12 23:11:48,194 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) 2003-02-12 23:11:48,194 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) Does anyone have any idea what is happening? Thanks in advance, Jeff Schnitzer [EMAIL PROTECTED] The Sims Online - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Pb with c:out for bean stored under a doted key name
-Original Message- From: Marc Guillemot [mailto:[EMAIL PROTECTED]] Hi, using Strugs I've a java.util.Locale object stored in session under the key org.apache.struts.action.LOCALE. How can I output the language property of this bean using c:out? I've nothing outputted (what seems logical) with: c:out value=${org.apache.struts.action.LOCALE.language}/ Is there a trick? If you're certain what scope the object will be in, you can reference the scope map directly, and use your object name as an associative index. In other words, do this: '${sessionScope[org.apache.struts.action.LOCALE.language]}' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: accessing static fields/methods from a static class using jstl el
-Original Message- From: Donald Ball [mailto:[EMAIL PROTECTED]] hi, i'm trying to figure out how to access static fields or methods from a static class using the jstl el. say i've got a class, call it com.example.Foo, which has a method getBar(). how would i access that property using jstl el? this doesn't work: ${com.example.Foo.bar} for, i guess, relatively obvious reasons. any suggestions? this seems like a really stupid question, but i've been poking around for a while and can't figure out a solution without reverting to scriptlets. thanks. The JSTL EL can reference javabean properties, maps, and collections. That's it. The JSTL specification describes this, although I wish it had a concise statement to this effect. You sort of have to figure this out by deduction. One curious strategy for accessing static variables would be to create an object that gets associated with another class, which uses reflection to load all the static final members into a map. You could then reference the map entries in the JSTL EL. Obviously, you would have to put that created object into one of the available scopes. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Non Java Developers, programmers using JSTL and taglibs
Ideally, applications will be designed using the Web MVC paradigm, so view pages will contain only view logic. However, in a complex application, using even the most popular frameworks (Struts, for instance), it's still difficult to completely avoid using scriptlets or scriptlet expressions. If you use the JSTL, however, along with perhaps the Struts-EL library, then it's much easier to write complete pages that don't use a single scriptlet. You can even use the tag library validator that comes with the JSTL that enforces the goal of not having scriptlets on your page. In short, what's important to realize is that the syntax of scriptlets and scriptlet expressions is harder for non-programmers to understand, as compared to understanding conditional JSTL tags using the EL. -Original Message- From: Lyndon Durham [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 12:55 PM To: Tag Libraries Users List Subject: Non Java Developers, programmers using JSTL and taglibs Greetings, As a software developer I would like to delegate some of the more mundane and simpler development tasks to non developers, programmers etc. The JSTL specification document claims that the jstl was created to facilitate or ease development for web designers and non java programmers. It is my experience that jstl and other taglibs like jakarta standard taglibs are still rather convulted for the likes of wyswig web designers and other non java programmers. What is the point of developing applications that make succint use of jstl if as the developer I still have to spend myraid hours explaining how to use tags to the less initated or persons who are not programmers or developers. All comments are appreciated or anyone whose had a better experience delgating developing using taglibs. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Issues with implementing the EL in a non-JSP environment
How practical is it to consider deploying tools/frameworks using the EL which do not use JSP? I looked in the two jar files (standard and jstl), and it appears standard contains all the EL classes, but it also contains some classes which are obviously JSP-related. If there's no obvious dependencies from the EL into JSP, it might be worthwhile considering packaging the JSTL with a jar file that doesn't reference any JSP-related classes. I ask this because I had noticed a possible use of the JSTL EL in the Commons-Validator library, which is not JSP-specific. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do tag libraries handle final references to specific images used in custom tags?
I'm familiar with the HTML tags for specifying images, either as a static image or as a button. I'm also familiar with how tag libraries work. What are useful conventions for building custom tags in a tag library that come with canned images? For instance, if a tag library provides some sort of tags which allow the user to specify moving forward and backward in a list, and the tag library provides the default images to use for the arrows, what provisions are commonly made for referencing the images from the generated HTML (or any other references)? Is there any history of making the generated HTML reference a servlet (or Struts action) with an attribute specifying an image name, and having the servlet stream the image from the classpath? If this is a reasonable strategy, what are issues/tradeoffs with this approach? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cooperating tag
In JSP 1.2, you have to specifically use the API for the JSTL expression language engine if you want attributes to use the ${...} syntax. In JSP 2.0, this will happen automagically, but we're not there yet. If you want one example of how this is done, look at the Struts-EL contrib library, which is part of the Struts distribution. You'll find that the Tag classes pass the attribute values through the EL to generate the final value. -Original Message- From: Randy Belknap [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 5:29 PM To: '[EMAIL PROTECTED]' Subject: Cooperating tag Should I be able to create a variable using c:set and then use it to set the value of an attribute in my own custom tag? When I try and use ${myVar} to pass the value to my custom tag, what receive is the literal ${myVar}. In otherwords it doesn't evaluate the expression. I've tested under Tomcat 4.0.6, 4.1.17 and 4.1.18. I've created the smallest possible test case and am including all the files. Thanks, Randy === JSP PAGE === %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % %@ taglib uri=portaltags prefix=xe % htmlbody c:set var=myVar scope=page value=1/ pxe:MsgType messageType=${myVar}/ /body/html === The taglib.tld === ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE taglib PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd; taglib tlibversion1.0/tlibversion jspversion1.2/jspversion shortnamexe/shortname urihttp://www.test.com/portaltags.html/uri infoXePortal/info tag nameMsgType/name tagclasscom.test.XeTestTag/tagclass infoGets message types/info attribute namemessageType/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute /tag /taglib === The web.xml === ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app display-namePortal/display-name description Portal /description taglib taglib-uriportaltags/taglib-uri taglib-location/WEB-INF/taglib.tld/taglib-location /taglib /web-app === The Java file === package com.test; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.TagSupport; public class XeTestTag extends TagSupport { private String messageType = 0; /** * Constructor for XeTestTag. */ public XeTestTag() { super(); } /** * Sets the messageType. * @param messageType The messageType to set */ public void setMessageType(String messageType) { this.messageType = messageType; System.out.println(MessageType: + messageType); } /** * Output the requested function. * @return int */ public int doEndTag() throws JspTagException { try { pageContext.getOut().write(messageType); } catch (java.io.IOException e) { throw new JspTagException(IO Error: + e.getMessage()); } return EVAL_PAGE; } } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Cooperating tag
In the Struts source distribution, look at: contrib/struts-el/src/share/org/apache/strutsel/taglib/html/ELButtonTag.java Look at the evalAttr() and evaluateExpressions() methods, and the EvalHelper utility class. The latter is what calls the EL evaluator. Also note that you may have to write BeanInfo classes if one or more of your tag attributes are not of type String. Look at ELButtonTagBeanInfo.java for an example of that. -Original Message- From: Randy Belknap [mailto:[EMAIL PROTECTED]] Can you point me to a particular file that shows what you are talking about? I've looked through both the tags in the distribution and CVS, but haven't found an example. Thanks! -Original Message- From: Karr, David [mailto:[EMAIL PROTECTED]] In JSP 1.2, you have to specifically use the API for the JSTL expression language engine if you want attributes to use the ${...} syntax. In JSP 2.0, this will happen automagically, but we're not there yet. If you want one example of how this is done, look at the Struts-EL contrib library, which is part of the Struts distribution. You'll find that the Tag classes pass the attribute values through the EL to generate the final value. -Original Message- From: Randy Belknap [mailto:[EMAIL PROTECTED]] Should I be able to create a variable using c:set and then use it to set the value of an attribute in my own custom tag? When I try and use ${myVar} to pass the value to my custom tag, what receive is the literal ${myVar}. In otherwords it doesn't evaluate the expression. I've tested under Tomcat 4.0.6, 4.1.17 and 4.1.18. I've created the smallest possible test case and am including all the files. Thanks, Randy === JSP PAGE === %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % %@ taglib uri=portaltags prefix=xe % htmlbody c:set var=myVar scope=page value=1/ pxe:MsgType messageType=${myVar}/ /body/html === The taglib.tld === ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE taglib PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd; taglib tlibversion1.0/tlibversion jspversion1.2/jspversion shortnamexe/shortname urihttp://www.test.com/portaltags.html/uri infoXePortal/info tag nameMsgType/name tagclasscom.test.XeTestTag/tagclass infoGets message types/info attribute namemessageType/name requiredtrue/required rtexprvaluetrue/rtexprvalue /attribute /tag /taglib === The web.xml === ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app display-namePortal/display-name description Portal /description taglib taglib-uriportaltags/taglib-uri taglib-location/WEB-INF/taglib.tld/taglib-location /taglib /web-app === The Java file === package com.test; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.TagSupport; public class XeTestTag extends TagSupport { private String messageType = 0; /** * Constructor for XeTestTag. */ public XeTestTag() { super(); } /** * Sets the messageType. * @param messageType The messageType to set */ public void setMessageType(String messageType) { this.messageType = messageType; System.out.println(MessageType: + messageType); } /** * Output the requested function. * @return int */ public int doEndTag() throws JspTagException { try { pageContext.getOut().write(messageType); } catch (java.io.IOException e) { throw new JspTagException(IO Error: + e.getMessage()); } return EVAL_PAGE; } } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Taglibs and Commons Logging
-Original Message- From: Mark R. Diggory [mailto:[EMAIL PROTECTED]] I've been attempting this strategy, but it seems that in the web application, somehow the properties files in the classes directory don't seem to get recognized by commons logging and used. When I compile my tags, they get deployed into jars in the WEB-INF /lib directory. I'm concerned that the libs endup on the classpath before the properties files, I'm wondering if theres a chance that its not searching the whole classpath when seaching for the properties files. Am I missing something? Here's my layout: /WEB-INF/classes/commons-logging.properties org.apache.commons.logging.Log=org.apache.commons.logging.impl .SimpleLog /WEB-INF/classes/simplelog.properties org.apache.commons.logging.simplelog.defaultlog=trace org.apache.commons.logging.simplelog.showdatetime=true /WEB-INF/lib/commons-logging.jar /WEB-INF/lib/commons-logging-api.jar /WEB-INF/lib/mytags.jar And I don't see any log events in catalina.out for the log.debug(...) calls I'm making in my classes. Well, I would guess there's a good reason for that. The SimpleLog class just emits to stderr. Are you not able to see your server console? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Stuck in Mud... Need your help...
The return value from doStartTag() can have three (more?) different return values, being EVAL_BODY_INCLUDE, EVAL_BODY_BUFFERED, or SKIP_BODY. I don't see how the difference is silly. It was a good idea to separate them, so tags which don't need to manipulate their body can be more efficient. -Original Message- From: Mark R. Diggory [mailto:[EMAIL PROTECTED]] Thanks, yes that appeared to be it. I'm always running into this silly issue of TagSupport vs. BodyTagSupport and the difference in the constants. TagSupport -- EVAL_BODY_INCLUDE or SKIP_BODY BodyTagSupport -- EVAL_BODY_BUFFERED or SKIP_BODY Seems that the JSP Taglib spec has alot of this use of constant ints in situations where boolean return values would do just fine and save on the confusion. But thats a different issue for a different list... ;-) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Word Separator Character For Bean Key Names...
Make sure you nest quotes correctly. That EL expression string you supplied would be nested by single quotes. -Original Message- From: Hohlen, John [mailto:[EMAIL PROTECTED]] Follow-Up Question: If I want access a property from the bean, such as lastName, what's the syntax? I tried a few different things such as: ${sessionScope[com.abc.fleetsystems.employee].lastName} But it didn't work. Thanks, JOHN -Original Message- From: Shawn Bayern [mailto:[EMAIL PROTECTED]] On Thu, 12 Dec 2002, Hohlen, John wrote: But this won't work with the EL syntax, right? For example: ${sessionScope.com.abc.fleetsystems.employee} Won't JSTL the Expression Language (EL) evaluator get confused and look for nested objects? More specifically: getCom().getAbc().getFleetsystems().getEmployee() Hence, I wondering what the standard word separator, or in our case, package separator character is. I'm guessing that it's an underscore, but haven't seen any such recommendation. You must use the [] operator, as in ${sessionScope[com.abc.fleetsystems.employee]} -- Shawn Bayern JSTL in Action http://www.manning.com/bayern -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: invoking a JSP or servlet
A common pattern is to have your welcome file be a jsp that does nothing but forward to your first action. -Original Message- From: Anuj Agrawal [mailto:[EMAIL PROTECTED]] Is it accurate to say that we should never invoke a JSP file directly? It should always be forwarded to from some servlet? What if my first page (say, index.jsp) of my web app has some db query results being displayed, is the right way to make it so that my first page is a servlet and after doing all the db stuff, it forwards to the index.jsp? If that's true, then is there a way to configure the web app (guessing via web.xml) so that the welcome file is a particular servlet? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to add object to a List or Map with JSTL ?
If you're determined to put your business logic into your JSP pages, then just use a scriptlet to create the list object and put it into the session. You can expect the JSTL to well support applications which use the MVC pattern (by having view logic in your JSP pages and business logic in Servlets or Struts Actions), but I wouldn't hold my breath waiting for features in the JSTL which will make it easy to write your entire application with JSTL tags. The MVC pattern implies that JSP pages only extract information from beans to display. If you're ever thinking about writing code in a JSP page to initialize list objects, then you're getting away from the MVC pattern. In the Struts framework, you would always have a prepare action which executes before a JSP page is executed, where list objects and other complex objects are initialized and loaded from persistent stores. -Original Message- From: smallufo [mailto:[EMAIL PROTECTED]] For example , a shopping web site , there are many items , each item has its 'ID' : In the AddShoppingCart.jsp page , I can get the item Object by this URL: http:///AddShoppingCart.jspID=item001 In the jsp page , the code is as follows : jsp:useBean id=itemBean class=my.ItemBean jsp:setProperty name=itemBean property=iD value=%= request.getParameter(ID) %/ /jsp:useBean c:set var=item value=${itemBean}/ Here comes the problem , how do I 'initialize' a ShoppingCartList to store it into session , without servlets ? I know it is easy to accomplish by servlet's getSession() , but with JSTL , I cannot find a way to initialize a List (or Map)... I only read the 'JSTL in Action' book , and there seems no discussion about this...(It only discusses about how to extract List or Map ... not how to 'set' or 'add' Objects into List/Map with JSTL . ) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: rtexprvalue and EL
If these are constants in your application, you want to load this information ONCE, into your application context. You would do this in a servlet's init() method, which is set to load-on-startup, or you could add a ServletContextListener for the application to do the same thing. -Original Message- From: Affan Qureshi [mailto:[EMAIL PROTECTED]] Or I could have a jsp page that set pageContext variables with the constant values. I can include that page in all JSPs where i need constant values. And then I could use those pageContext variables in EL tags. - Original Message - From: David M. Karr [EMAIL PROTECTED] Affan == Affan Qureshi [EMAIL PROTECTED] writes: Affan I want to do a test like this: Affan c:if test=${parameter.type == %= ParameterBean.TEXT%} Affan nested:text property=value / Affan /c:if Affan I am comparing a value against a constant in a class but I can't execute a Affan RT expression in a c:if when using the EL tags. How do I accomplish this Affan in EL? Affan Of course I can initialize pageContext variables with all the constants and Affan do EL comparisons using them. But is there another way to do this? The EL only references javabean properties. That's what you have to work with. Write a function which takes a class and a hashmap, and uses reflection to populate all the constant symbols into the hashmap. You can then reference that hashmap in the EL. Either that, or use both the c and c-rt tags, and use c-rt:set to set a scoped attribute and then c:if (I think that would work). -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: JSTL Bug - requestScope[var] not working
If Shawn's response wasn't clear, I'm not sure what else we can say. The EL parser doesn't read scripting variables. It doesn't know anything about them. It can't use them. Your first example doesn't work because it's trying to reference a scripting variable. From the EL's point of view, there is no value scoped attribute, so the result is null. You should read the specification, if you haven't yet. -Original Message- From: Scott Goldstein [mailto:[EMAIL PROTECTED]] I'm not sure that I follow. How about these two snippets: % String value = foo; % c:out value=${requestScope[value]}/ and c:out value=${requestScope[foo]}/ The second one works, while the first doesn't. The only difference is that the second is using a string literal for the index and the first is using a scripting variable. Are you saying that scripting variables cannot be used as indexes? Basically, prior to this jsp being executed, I've done the following: request.setAttribute(foo, SomeTextToRetrieve); So, what I think should happen in the first snippet, is that the variable, value, is resolved to it's String literal, foo and then the expression is evaluated just like the second snippet. This does not appear to be happening. Scott = Original Message From Shawn Bayern [EMAIL PROTECTED] = On Thu, 21 Nov 2002, Scott Goldstein wrote: I think this may have already been posted, but I don't recall the answer. Aren't the following two snippets identical? % String value = foo; % c:out value=${requestScope[value]}/ and %= request.getAttribute(value) % Nope. Scripting variables are not automatically made into scoped attributes, and the EL can only refer to scoped attributes. If you added pageContext.setAttribute(foo, foo); to the upper scriptlet, then the code would be identical. The first is returning null and the second is returning the appropriate attribute value. I looked in the JSTL spec and it looks like the first should work. Is this a bug? No, the behavior is as expected. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: struts issues for multiple action and taglib
First of all, you're better off asking questions about Struts on the struts-user list. Your first issue: You've mostly answered your own question. The automatic handling of form beans, both in and out of pages, is a very powerful tool. Your second issue: There are several ways to handle this. You could have multiple forms on your page, with separate specific actions. You could have a single form, with a single action, but using the DispatchAction or LookupDispatchAction to dispatch the handling to a specific request of your action. Look in the struts-user archives for discussions about those Action classes. Other important resources are the Struts user guide, and Ted Husted's site, http://www.husted.com/struts/ http://www.husted.com/struts/, including the Struts Tips, which cover those two Action classes. -Original Message- From: Shalu Goel [mailto:shalu.goel;mind-infotech.com] Sent: Tuesday, November 12, 2002 11:05 PM To: taglib users Subject: struts issues for multiple action and taglib Hello all, I am a new struts user...and exploring ... can I construct my web appliction around struts framework instead of using traditional JSP (logic and presentation combined) way of development?? My first issue is : What is the advantage of using struts taglib to declare Form and other presentaion related tags over std. Html?? Is it somewhere related to the way Form Bean handles request parameter and does front-end validations??? My 2nd issue is : Can we have multiple actions for the same jsp page in struts depending upon what button the user has pressed?? Then how do we define path and type in action mpping in struts-config and the jsp page itself?? Please throw some light??? Thanks shalu
RE: page context
First of all, if you want to ask questions about Struts, ask them on the struts-user list. You'll get better answers. I don't know what you mean by user context, so I can't compare them. Note that when using Struts, a good practice is to have all links go to Actions, not directly to JSP pages. That is, your URLs in your pages would likely be to .do urls, which are handled by the Action class. You could probably figure out several ways to encode where they came from. You could store a last page in the session. You could put a hidden field on each page. The latter would allow you to use a request-scope bean, as opposed to a session-scoped bean. -Original Message- From: Manoj, Mathew [mailto:Manoj.Mathew;principal.com] Sent: Wednesday, November 13, 2002 3:55 PM To: Tag Libraries Users List Subject: page context Hi I am new to Struts.Can anyone please tell me what is page context.and what is the difference between page context and user context. My wesite has 8 pages and all the links are in the header.All jsps.and i am trying to implement it in struts.So when user click on any link,I need to know from which page he is coming?I am thinking of setting a variable in the session and update it with each page?Please give me a better idea.. Thanks Matt -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: Custom property in a Collection subclass
In (very) short, I believe it essentially checks the type in this order: 1. Collection 2. Bean If it finds it is a Collection type, it won't introspect the object for bean properties. The workaround is to make your class not extend ArrayList, and include the ArrayList as a bean property. -Original Message- From: James Cook [mailto:jimcook;visualxs.com] Sent: Monday, November 11, 2002 9:46 AM To: 'Tag Libraries Users List' Subject: Custom property in a Collection subclass I have a subclass of ArrayList that exposes its own property, userObject. class NamedList extends ArrayList { Object _userObject; public NamedList(Object userObject) { _userObject = userObject; } public Object getUserObject() { return _userObject; } public void setUserObject(Object userObject) { _userObject = userObject; } } When I attempt to access the userObject using JSTL (Apache impl), I receive the following error: JSTL c:out value=${date.userObject} / Error = An error occurred while evaluating custom action attribute value with value ${date.userObject}: The . operator was supplied with an index value of type java.lang.String to be applied to a List or array, but that value cannot be converted to an integer. It seems like the JSTL implementation is treating this call like I meant ${date[userObject}, but surely there is a means to access properties on a collection class? -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: Properly iterating results with c:forEach?
Even though you think you're using the JSTL RI, you're probably still using the Resin implementation. Is anyone aware of a specific feature that's different between the two implementations, so people can determine with certainty which version they are using? -Original Message- From: Timothy Kettering [mailto:timster;mac.com] Sent: Monday, November 11, 2002 12:15 PM I'm using Resin 2.1.5 here. I thought mabye I might be using a outdated version of the JSTL taglib, so I downloaded 1.0.2 and redeployed the webapp. No change in the results. Gonna give it a shot with Tomcat here and see. The plot thickens -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: EL in String Taglib 1.0
-Original Message- From: Henri Yandell [mailto:bayard;generationjava.com] Sent: Friday, November 01, 2002 11:21 AM On Fri, 1 Nov 2002, Karr, David wrote: If there's interest in EL-izing certain non-ELed tag libraries, without changing the library (so the original library can still work in Servlet 2.2 environments), and you don't want to wait for JSP 2.0, you might consider using the strategy I used in building the Struts-EL tag library. I was thinking of a strategy that basically did a: Is this class [ExpressionEvaluator or whatever it is] in the classpath. If so, then cache this result statically [in my StringTagSupport] and make sure that ELizing happens. Any reason this would fail? String taglib has a pretty simple design, there's only one actual taglib class, all the rest just do String transformations and not tag stuff, so it can be nice and easy to upgrade :) You're intending to store the class name as a string somewhere, determine whether you can load it, and then call the methods of the class through Reflection? I suppose that would work. You'll have to rip out that code when you move to JSP 2.0. If you used a subclass, you would just remove the subclass. -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: EL in String Taglib 1.0
My goal is to not change the existing library at all, either at the source level or the deployment level. If you put the new classes in the old jar, then people deploying the old taglib will get those extra classes. Those shouldn't cause any conflicts, but I don't like to introduce changes that very likely won't have any effect. -Original Message- From: Henri Yandell [mailto:bayard;generationjava.com] Sent: Friday, November 01, 2002 12:31 PM On Fri, 1 Nov 2002, Karr, David wrote: All the tag classes in the Struts-EL tag library are subclasses of the corresponding class in the Struts tag library, and all of them look almost identical. In each one, the doStartTag() method calls a method called evaluateExpressions(), which just has one block of almost identical code for each property of the tag, which just passes the current value of the property through the EL parser and into the setter method for the property. The only exception to this relatively Okay. I'm convinced :) Will work on getting a 1.1 release out which has an EL'd component. Any reason it has to be a different jar? Or just one jar with them all and a different tld? -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: EL in String Taglib 1.0
-Original Message- From: Glenn Nielsen [mailto:glenn;mail.more.net] Sent: Friday, November 01, 2002 1:02 PM I would recommend creating the EL enabled version as a 2.0 release. Enabling EL in an older non EL taglib can allow you to restructure how your tags work. Some tags or tag attributes may no longer be necessary when the EL is available. Plus doesn't the EL require JSP 1.2? And the current taglib is compatible with JSP 1.1? Adding the EL is enough of a change to warrant a 2.0 release IMHO. Perhaps not from the developer viewpoint, but definitely from the user viewpoint. Why exactly would enabling EL allow you to restructure how your tags work? When you say that some tags or attributes may no longer be necessary, do you mean because some JSTL tag might perform that functionality? In the case of the Struts-EL library, I simply chose not to port certain tags from Struts to Struts-EL if their functionality was entirely provided by a JSTL tag. It didn't allow me restructure how tags work. Yes, using the EL requires JSP 1.2. That's why it's good at this point to keep the -rt and -el versions of libraries somewhat separated. I consider the functionality of a tag library, and the mechanism it uses to evaluate tag attributes, to be independent. Adding an EL-ized version of a library doesn't imply any change to the base library. Users using the -rt library would never notice a difference. However, the people who want to quickly move forward on using and experimenting with the JSTL would have another tool they could more easily integrate with, without having to wait for a 2.0 release. Note that I haven't used the String tag library, nor am I familiar with its contents (although I believe you have some substring matching tags, which is good). I'm just looking to promote usage of the JSTL, which will be more likely if popular tag libraries that do things the JSTL doesn't do can use the same attribute syntax. -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: simple question regarding EL and collections
Wouldn't that just be ${!empty bean.myset.value}, or '${!empty bean.myset[value]}'? -Original Message- From: Donald Ball [mailto:dball;rhoworld.com] Sent: Wednesday, October 30, 2002 8:58 AM To: [EMAIL PROTECTED] Subject: simple question regarding EL and collections I have a bean exposed on my jsp page which has a property that is a Set. In the jsp page, I would like to test to see if a given value exists in that set. Is there a way to do that using EL? - donald -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: JSTL making Dreamweaver unhappy.
It might be because you're missing the attribute name and =. You're just inserting the value of ${bgColor} inside the tr tag, without it being a value of an attribute. -Original Message- From: Stefan [mailto:nickm;studioweb.com] Sent: Tuesday, October 29, 2002 12:55 PM To: Tag Libraries Users List Subject: JSTL making Dreamweaver unhappy. Hi, Just started to use JSTL and find that DreamWeaver MX has problem with the tags in the design view. For example this: tr c:out value='${bgColor}'/ align=center Will cause DW to display a broken tr tag: tr And dreamweaver's info panel says it's invalid markup. This is fine for me but I can see web designers crying about this. Any suggestions? Funny thing is that %= % are handled fine by DW. Stef -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: JSTL BUG? Url problem
So you're telling us that referencing ${item.a_nomefile} in a c:out tag, where item is an instance of DynaActionForm (or a subclass) actually prints out the value of that property? I recently started looking into this issue, and I frankly don't see how that can work. The properties of a DynaActionForm are not declared with standard JavaBeans accessors, they are stored in a HashMap. I'm investigating the possibility of an enhancement to DynaActionForm which just adds an accessor for the HashMap, which would then allow you to specify an EL expression to get DynaActionForm properties. -Original Message- From: flare [mailto:flare;flare.it] Sent: Monday, October 28, 2002 1:05 PM To: Tag Libraries Users List Subject: Re: JSTL BUG? Url problem On Sun, 27 Oct 2002, flare wrote: Irrespective of whether you're using DynaBeans or not, if it works in the latter case, it should work in the former one. That is, the two expressions you've shown are identical, and both tags evaluate their attributes as String objects. c:forEach var=item items=${requestScope.asteAllegati} varStatus=status c:url value=/showAllegati.do var=show c:param name=id value=${requestScope.id}/ c:param name=tipo value=${requestScope.tipo} / c:param name=key value=${item.a_nomefile} / /c:url ... I've tried but doesn't work.. if I try to render the url with a dynabean accessor (a_nomefile or others) I get an error, the out tag works fine instead. I'm using JSTL on Resin 2.1.5 + Linux 500 Servlet Exception javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute value with value ${item.a_nomefile}: Unable to find a value for a_nomefile in object of class org.apache.commons.beanutils.BasicDynaBean using operator . (null) at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evalu ator.java:146) at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evalu ator.java:166) at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorMa nager.evaluate(Expressio nEvaluatorManager.java:112) at org.apache.taglibs.standard.tag.el.core.ExpressionUtil.evalNot Null(ExpressionUtil.java:85) at org.apache.taglibs.standard.tag.el.core.ParamTag.evaluateExpre ssions(ParamTag.java:14 8) at org.apache.taglibs.standard.tag.el.core.ParamTag.doStartTag(Pa ramTag.java:100) (...) -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: (stupid) problem using the standard sql taglib
At end. -Original Message- From: Donald Ball [mailto:dball;rhoworld.com] Sent: Thursday, October 24, 2002 9:12 AM I'm getting the following exception: - Root Cause - javax.servlet.jsp.JspTagException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute test with value ${rows.isLimitedByMaxRows}: Unable to find a value for isLimitedByMaxRows in object of class org.apache.taglibs.standard.tag.common.sql.ResultImpl using operator . at when I try to evaluate this block: c:if test=${rows.isLimitedByMaxRows} c:url var=url value=${requestScope.requestURI} c:param name=startRow value=${view.startRow + view.maxRows}/ /c:url a href=c:out value='${url}'/Next/a /c:if I'm sure I'm doing something stupid, but I don't know what. I have double checked that the jstl-1.0.1 RI's ResultImpl does, in fact, declare a public boolean isLimitedByMaxRows() method. What gives? Try changing the reference to ${rows.limitedByMaxRows}. EL references don't specify the method name, they specify the JavaBeans property. -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: Special Chars in Param Name
I believe that would be ${pageScope[user.name]}. -Original Message- From: Chen, Gin [mailto:Gin_Chen;tvratings.com] Sent: Monday, October 21, 2002 7:06 AM To: 'Tag Libraries Users List' Subject: Special Chars in Param Name Hi all, How can I use jstl when accessing values with special chars in the name? In particular, the period. I have a param that is being passed in as user.name for example. It does not mean name in user object, it just comes from someone declaring fields as: input type=text name=user.name input type=text name=user.email etc.. how about when the special value name is in one of the scopes? I cant do pageScope.user.name i'm assuming. Thanks, -Tim -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: RE: RE: Why one way works, but not the other?
-Original Message- From: Vernon Wu [mailto:vernonw;gatewaytech.com] Sent: Monday, October 21, 2002 11:44 AM I FIND THE PROBLEM! It is not mine, but the tag. See the below The td fields are empty. I use the script instead as I did in the controller. The data is shown correctly. The code is the followings: % List list = mbox.getList(); for(int i = list.size(); --i = 0;){ MessageHeader header2 = (MessageHeader)list.get(i); % td%=header2.getFrom() %/td td!-- c:out value=${header.from}/ --/td td!-- c:out value=${header.subject}/ --/td tdnbsp;/td /tr !-- /c:forEach -- % } % At the point, I can say the tag doesn't function properly for this case. I think that's unlikely. This is very plain and common usage. Ok, then set breakpoints in your bean getter/setter methods. When you hit the breakpoints, make sure it's returning (and setting) the data you expect. If you don't hit the breakpoints, then that means something else. As I have said, I don't have any JSP debugger. You don't need a JSP debugger, just an ordinary Java debugger. You have a form class. It's not JSP. Set breakpoints in the getter and setter methods. If it hits the breakpoints, make sure it is getting and setting the values you expect. -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: RE: RE: Why one way works, but not the other?
-Original Message- From: Vernon Wu [mailto:vernonw;gatewaytech.com] Sent: Monday, October 21, 2002 11:44 AM I FIND THE PROBLEM! It is not mine, but the tag. See the below The td fields are empty. I use the script instead as I did in the controller. The data is shown correctly. The code is the followings: % List list = mbox.getList(); for(int i = list.size(); --i = 0;){ MessageHeader header2 = (MessageHeader)list.get(i); % td%=header2.getFrom() %/td td!-- c:out value=${header.from}/ --/td td!-- c:out value=${header.subject}/ --/td tdnbsp;/td /tr !-- /c:forEach -- % } % At the point, I can say the tag doesn't function properly for this case. I think that's unlikely. This is very plain and common usage. Ok, then set breakpoints in your bean getter/setter methods. When you hit the breakpoints, make sure it's returning (and setting) the data you expect. If you don't hit the breakpoints, then that means something else. As I have said, I don't have any JSP debugger. You don't need a JSP debugger, just an ordinary Java debugger. You have a form class. It's not JSP. Set breakpoints in the getter and setter methods. If it hits the breakpoints, make sure it is getting and setting the values you expect. -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: request.getContextPath()
This seems confusing, but I think the specification is reasonably clear on this. I believe you need ${pageContext.request.contextPath} instead. -Original Message- From: Chen, Gin [mailto:Gin_Chen;tvratings.com] Sent: Friday, October 18, 2002 2:48 PM To: 'Tag Libraries Users List' Subject: request.getContextPath() Why is this not returning the same thing as the scriplet version? c:out value=${request.contextPath}/ %= request.getContextPath() % Thanks, -Tim -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: JSTL for Maps?
Section A.3.4 of the specification talks about using the [] operator to access maps. From this, you can see that your EL expression would be ${preferredNames[staffMember]}. If you're using Struts-EL, you can just use that as your value value on your html-el:text element. -Original Message- From: Wendy Smoak [mailto:Wendy.Smoak;asu.edu] Sent: Friday, October 18, 2002 3:46 PM I've poked around the Standard Taglib documentation, and asked Google, but so far I can't find what I need. I have a Hashtable in session scope. I have a String in page scope that is the key to something in the Hashtable. What tag can get the value out of the Hashtable for me? I don't think it matters, but I'm using Struts. (Not for this tag-- I don't care about the value, I just need to display it in a white box.) Currently I'm doing this, which just puts the 'key' into the readonly text box. input type=text name=junk readonly=readonly size=50 value=bean:write name=staffMember// The Map in session scope is called preferredNames, so somehow I need to call preferredNames.get(${staffMember}); Any takers? Thanks! -- Wendy Smoak http://sourceforge.net/projects/unidbtags -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: JSTL for Maps?
-Original Message- From: Wendy Smoak [mailto:Wendy.Smoak;asu.edu] Sent: Friday, October 18, 2002 4:56 PM Section A.3.4 of the specification talks about using the [] operator to access maps. From this, you can see that your EL expression would be ${preferredNames[staffMember]}. If you're using Struts-EL, you can just use that as your value value on your html-el:text element. I can't use the html-el tag for this, because then Struts wants to pre-populate the text box and will complain that there are no getJunk/getJunk methods in my ActionForm. If I could figure Huh? I don't understand. Don't you want to prepopulate the text field with the value of your value attribute? If the value attribute is set, it doesn't read a bean value from the property attribute. How does html-el:text not work for you? -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org
RE: Help with EL
-Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 11:03 AM To: 'Tag Libraries Users List' Subject: Help with EL I'm completely confused about whether or not I need JSTL with Struts. All I'm trying to do is iterate through a collection and present radio buttons, the value of which comes from a property of the things in the collection: logic:iterate id=resView name=foundPersons html:radio name=resView property=key value=${resView.key} / bean:write name=resView property=key filter=true/ /logic:iterate I think you may have already figured this out, but you can't directly reference JSTL EL expressions in attribute values unless the code for the tag library expects that. The Struts tag library is not built to understand those. However, if you use Struts along with the Struts-EL contributed library (which is in the Struts nightly build, not yet in a release), then you could instead do this (along with proper taglib directives): logic:iterate id=resView name=foundPersons html-el:radio name=resView property=key value=${resView.key} / bean:write name=resView property=key filter=true/ /logic:iterate -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Euro character in c:out
-Original Message- From: zze-JEANJEAN S ext FTRD/DMI/SOP [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 03, 2002 7:46 AM To: Tag Libraries Users List Subject: RE: Euro character in c:out I try to put : %@ page contentType=text/html; charset=ISO-8859-1 % But nothing changes. There is a ? in place of euro character :(( This is a real stab in the dark, but try ISO-8859-15 instead. The ISO-8859-1 encoding doesn't have the euro character, but ISO-8859-15 does. I have no idea whether both your server and client side will support this, however. I'd like to know if this makes a difference. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]