Re: html:img, onclick and bean:message
alright, I flubbed you up yesterday. That's what I get for trying to give advice even though I haven't used the framework much recently. But this one I'll get right... You can't define an xml element as an attribute of another element. This is an xml rule - nothing specific to struts or whatever other taglibs you are using. Now this is where the el can come in handy: c:set var=deletebean:message key=delete//c:set html-el:img src=normal.gif border=0 alt= onclick=confirm('${delete}');/ hth, Ben On Thu, 11 Nov 2004 10:31:22 -0800, Cook, Lori A [EMAIL PROTECTED] wrote: Can anyone help with this? I'm using Struts and am having difficulties getting the result of a bean:message into an 'onclick' of an html:img tag. Here's the markup in the jsp for img: img src=normal.gif border=0 alt= onclick=confirm('bean:message key=delete/');/ The (correct) result is: img src=normal.gif border=0 alt= onclick=confirm('Delete?');/ When I change to using html:img instead of img the result is: html:img src=normal.gif border=0 alt= onclick=confirm('Delete?');/ As you can see, while the bean:message was retrieved and the 'onclick' value correctly created. But the html:img was not transformed to an img tag. Why not? What am I doing wrong? At some point I'm going to want to retrieve a pointer to a localized graphic and alternate title for the html:img so the use of bean:message is not specific to 'onclick'. Any help is greatly appreciated. Lori Cook - 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]
x:out error
Hi, I'm battling what seems to be a pretty elementary problem: x:parse var=xrpcResponse person firstname nickname=falseBen/firstname lastnameAnderson/lastname /person /x:parse x:out select=$xrpcResponse//firstname/ This should work, correct? I've been trying so many variations of this and nothing seems to work. I'm on Resin 2.19, but am using jakarta's standard taglibs. Any ideas? Thanks, Ben - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: x:out error
Thanks for the sanity check. I got it fixed. It was a dependency issue. For someone reason I had placed jaxen in one of the classloaders. Not too sure why I did that - but deleting it fixed my problem. -Ben Hassan Schroeder wrote: Ben Anderson wrote: I'm battling what seems to be a pretty elementary problem: x:parse var=xrpcResponse person firstname nickname=falseBen/firstname lastnameAnderson/lastname /person /x:parse x:out select=$xrpcResponse//firstname/ This should work, correct? Confirmed that it works on Tomcat 5.0.28 using 2.4 spec/JSTL 1.1 :-) HTH, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
last element in collection
Hi, Is there a way for me to tell when I'm in the last iteration of a forEach? %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % jsp:useBean id=myList class=java.util.ArrayList/ % myList.add(1); myList.add(2); myList.add(3); % c:forEach var=entry items=${myList} !-- This is the last time through c:if test= do something special /c:if -- c:out value=${entry}/ br / /c:forEach I know it'd be better if my logic didn't need to know this, but I'm just wondering if there's a way to do it. I thought maybe I could get the size and stick it in a var like c:set var=size value=myList.xxx/ c:forEach var=entry items=${myList} end=${size} but the size() method on java.util.Collection is just that, not getSize(). Any ideas? Thanks, Ben - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: EL not being evaluated?
el has been incorporated into JSP 2.0 which is what Tomcat 5 implements. So, you no longer need the c:out tag. Just do: p1 + 2 + 3 = ${1+2+3}/p Check out Tomcat's default pages to see more cool things you can do with Tomcat 5 (JSP 2.0/Servlet2.4). -Ben From: David Wall [EMAIL PROTECTED] Reply-To: David Wall [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: EL not being evaluated? Date: Thu, 5 Feb 2004 09:44:28 -0800 I've installed JDK 1.4.2_03, Tomcat 5.0.18 and Apache's JSTL 1.1 on RH Linux 9. My XHTML JSP contains a simple construct: p1 + 2 + 3 = c:out value=${1+2+3}//p But the expression is not being evaluated, yet the c:out tag is being processed fine. The output just looks like: 1 + 2 + 3 = ${1+2+3} Is there a trick to getting the expressions configured to work with Tomcat 5? Thanks, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Learn how to choose, serve, and enjoy wine at Wine @ MSN. http://wine.msn.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to use methods with parameters
Here's a little tester jsp that demonstrates one way to do it: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % jsp:useBean id=endDate class=java.util.Date jsp:useBean id=startDate class=java.util.Date/ %-- this sets the startDate to one year ago --% c:set target=${startDate} property=year value=103/ /jsp:useBean startDate: c:out value=${startDate}/br/ endDate: c:out value=${endDate}/br/ %-- of course it would probably be better to actually perform this multiplication and insert it into the code --% calcDate:c:out value=${(startDate.time - endDate.time) / (24 * 60 * 60 * 1000)}/ -Ben From: Just Fun 4 You [EMAIL PROTECTED] Reply-To: Tag Libraries Users List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: how to use methods with parameters Date: Thu, 5 Feb 2004 17:38:14 +0100 Hi, is it possible to use JSTL for an expression like %=calculateDays(startDate, endDate) % ??? probably not, but I am too new to JSTL to figure it out by myself. Could someone advise me? thanks. Dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ What are the 5 hot job markets for 2004? Click here to find out. http://msn.careerbuilder.com/Custom/MSN/CareerAdvice/WPI_WhereWillWeFindJobsIn2004.htm?siteid=CBMSN3006sc_extcmp=JS_wi08_dec03_hotmail1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:forEach, c:import and variable scope?
How bout this: c:forEach var=foo items=${bars} c:import url=some/page.jsp c:param name=foop value=${foo}/ /c:import /c:forEach some/page.jsp c:out value=${param.foop}/ -Ben [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}/] From: Rick Ross [EMAIL PROTECTED] Reply-To: Tag Libraries Users List [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Subject: Re: c:forEach, c:import and variable scope? Date: Tue, 9 Dec 2003 11:27:54 -0800 I don't have my code in front of me, but I am pretty sure that is exactly what I do for my client. I don't even recall having to set request scope, but I'm not positive there. Tomcat 5.x/JSTL 1.1 R - Original Message - From: Karr, David [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 11:21 AM Subject: 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Shop online for kidsÂ’ toys by age group, price range, and toy category at MSN Shopping. No waiting for a clerk to help you! http://shopping.msn.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
well-known URI's
Hello, I'm not clear on how well-known URI's are defined. The specifications don't seem to have much info on this. I'm wondering if it is possible for my own custom tag library to be used without specifying the taglib in the web.xml. Thanks, Ben _ Need a shot of Hank Williams or Patsy Cline? The classic country stars are always singing on MSN Radio Plus. Try one month free! http://join.msn.com/?page=offers/premiumradio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]