Simple Javabean question
I have a Javabean I've created that has setters and getters to an array: public String getPair(int idx) { return (pair[idx] == null ? : pair[idx]); } public void setPair(String[] var) { this.pair = var; } My problem is that I don't know how to access the index of the array w/JSTL. I can do a regular set and get with just one variable, but how do I access this an array index? I've looked all over! I tried this: jsp:useBean id=outlet class=com.OutletData scope=session/ c:set var=${sessionScope.outlet.pair[0]} value=Test/ to no avail. Thanks, - Nic. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple Javabean question
Great, thanks for the pointers. I read the area on EL and that helped, but I am still confused on the 'set' portion. How does the index *and* the value get passed to the setter? Using a list, I would need: list.set(i,var). Thanks again for the help, I know this is simple but I'm still trying to piece together how these work. - Nic. Helios Alonso wrote: 1) If you bean implements List then you could use myBean[0] in EL. public class MyBean implements List { public Object get(int i) { return getPair(i); } ... } 2) Or maybe have a property that implements List myBean.list[0]. public class MyBean { public List getList() { return new List() { public Object get(int i) { return getPair(i); } } ... } ... } At 11:43 15/10/2004 -0700, you wrote: I have a Javabean I've created that has setters and getters to an array: public String getPair(int idx) { return (pair[idx] == null ? : pair[idx]); } public void setPair(String[] var) { this.pair = var; } My problem is that I don't know how to access the index of the array w/JSTL. I can do a regular set and get with just one variable, but how do I access this an array index? I've looked all over! I tried this: jsp:useBean id=outlet class=com.OutletData scope=session/ c:set var=${sessionScope.outlet.pair[0]} value=Test/ to no avail. Thanks, - Nic. - 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]
Custom Tags
I'm writing a custom tag, and using 'JavaServer Pages' as a good guide. Its helpful, but I'm confused about the difference between Simple Tag Handlers and Classic ones. The book states that a Simple handler 'cannot contain Java code (scripting elements)', but I'm seeing Java in these examples. What is the difference between scripting elements and just the straight Java? Thanks, - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple select question
Why use the otherwise clause? I just use an 'if' tag inline. select name=Select Name Here size=1 c:forEach var=varNameHere items=${varsVector} varStatus=current option c:if test=${your_test_here} selected /c:if value=your_value_here Your Display Text Here /option /c:forEach /select I agree, a mod would make this cleaner, but I don't feel it really obfuscates the HTML too much. - Nic. Justin F. Knotzke wrote: quote who=Don Albertson date=[041005 09:32]/ I need to do that kind of thing a lot. Here's my boilerplate: select name=Select Name Here size=1 c:forEach var=varNameHere items=${varsVector} varStatus=current c:choose c:when test=${your_test_here} option selected value=your_value_here Your Display Text Here /option /c:when c:otherwise option value=your_value_here Your Display Text Here /option /c:otherwise /c:choose /c:forEach /select So you do it by hand. I was hoping that the input taglib would handle this for me. The Struts taglib does. It knows to compare the values and if the values equal, it marks it as 'selected'. Anyhow, I wrote my own mod for the taglib that seems to work.. Thanks for the reply. It's greatly appreciated. J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI Taglib binding
Hi, Has anyone been able to use the JDNI taglib with an LDAP source, and actually bind with a DN and password? The 'official' LDAP url does not specify a password param, and the JNDI examples demonstrate LDAP, but no binding. The other alternative I can see is to create the factory in my server.xml, bind there and use the factory in my code. Not sure if this is actually possible though. Thanks, - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looping with paramValues
Thanks everyone for the help. I ended up taking your examples, and just 'on the side' iterating through the paramValues until I found the matching one, and then setting a temp flag. Its unfortunate that I couldn't just use an index to access the nth param and its nth value. - Nic. Helios Alonso wrote: Oops. Exactly. At 11:56 13/09/2004 -0400, you wrote: Helios, Small correction (I think), did you mean ... c:forEach var='entry' items='${params}' c:if test=${entry.key == 'test1' c:out value=${entry.value}/ /c:if /c:forEach Note: I switched var and items values. - 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]
Redirect Issues
Greetings again, I've noticed a problem with redirect if I have a good chunk of code, where it won't redirect and I get this log error: - Root Cause - java.lang.IllegalStateException at org.apache.coyote.tomcat4.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:338) at org.apache.taglibs.standard.tag.common.core.RedirectSupport.doEndTag(RedirectSupport.java:151) at org.apache.jsp.editoutlethandler_jsp._jspService(editoutlethandler_jsp.java:602) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) .googling this I see its a problem with too much whitespace? I was able to correct this once by jamming all my tags together, making it fairly unreadable, but this time around I'm trying to find a better pattern to this. Do certain tags cause this problem? - Nic. Nic Werner Sonoma State University - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Looping with paramValues
I had to depend on the order in my instance. I had 15 params that were repeated three times (each for a different variant), so I wanted to loop through each param, and also know if I was on the first,second or third set of data. So basically, I wanted param.currentparam[current_set].value. I couldn't merely name each param with a signifier in front, ie X-param,Y-param,Z-param because (as asked previously), there is no way to dynamically create a variable name and then access its data - Nic. Helios Alonso wrote: In this case, ignoring the order the order is not defensive programming (avoiding not expectable bad cases) but avoiding coupling with the implementation of the server (Tomcat) and avoiding extra requiriments for the calling entity (call me with this params *and in this order*). [9] works if the implementation of params implements List (or is an array). At 16:20 14/09/2004 -0400, you wrote: Defensive programming might suggest that one presume the worst not the spec. At any rate, presuming you intend and design the nth element is *always* the one you use from the request, does the following work? c:out value=${params[9].value} / I don't use el enough to remember all the nuances. Doug -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 4:02 PM To: Kris Schneider Cc: Tag Libraries Users List Subject: Re: Looping with paramValues On Tue, 14 Sep 2004 15:18:24 -0400, Kris Schneider [EMAIL PROTECTED] wrote: I was thinking more along the lines of the HTTP spec not guaranteeing the order. So that if you made the same request with parameters foo and bar, in some cases foo might be first and in other cases it might be bar. Clearly the HTTP spec can't say anything about the order; that wouldn't be meaningful. However, the HTML spec does state that the order of parameters is preserved. Taken together with the Servlet spec requirements, that does state that the order of parameters as received by the servlet is the same as the order of fields in the submitted form. -- Martin Cooper Quoting Martin Cooper [EMAIL PROTECTED]: On Tue, 14 Sep 2004 13:31:22 -0400, Kris Schneider [EMAIL PROTECTED] wrote: Well, even if you could do it cleanly, there's no guarantee on the ordering of request parameters. Although the Servlet spec doesn't state it explicitly, it does actually specify that the order of values for a given parameter, as returned by getParameterValues(), is the same as the order in which they are submitted. -- Martin Cooper Are you really just checking to see if a particular parameter has been passed? If so, you should be able to do that with just: c:if test=${param.nameOfTheParameter} ... /c:if Quoting Nic Werner [EMAIL PROTECTED]: Thanks everyone for the help. I ended up taking your examples, and just 'on the side' iterating through the paramValues until I found the matching one, and then setting a temp flag. Its unfortunate that I couldn't just use an index to access the nth param and its nth value. - Nic. Helios Alonso wrote: Oops. Exactly. At 11:56 13/09/2004 -0400, you wrote: Helios, Small correction (I think), did you mean ... c:forEach var='entry' items='${params}' c:if test=${entry.key == 'test1' c:out value=${entry.value}/ /c:if /c:forEach Note: I switched var and items values. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - 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]
Looping with paramValues
Hi, Is there a '.key' accessor for paramValues? Basically I only want to access the variables that match a certain index and do comparison work with them I'm familiar with accessing data using paramValues.var_name[index], and I'm familiar with looping through params with only one value: c:forEach items=${param} var=params varStatus=status c:out value=${params.key} -- ${params.value}/BR /c:forEach The problem with paramValues is that I have to specify a variable name, while params lets me use '.key'. Thanks for your help, - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic variable names
Greetings, I have incoming params from another page that I want to cycle through, with one attribute of them that changes. I want to cycle through all the attributes of type color, basically checking if the 'old' matches the 'new' for that attribute. The params look like this old/new-color-attribute name eg: old-B-blade How would I just drop in the current loop color, a la: ${param.old-current-loop-color-attribute}/ ? Thanks, - Nic. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested expressions
Wow, thanks Martin and Chris, I fully overlooked the basic logic of this. I was staying away from the 'and' because it was cycling through each param individually, and so I thought it should be checking for one or the other. The 'or' would totally make this not work, and its now fixed! Thanks. Martin Cooper wrote: Uh, your condition is what's wrong. The parameter key is *always* going to be either not 'view' or not 'perPage' - it can't be both at the same time. I think you mean AND instead of OR... -- Martin Cooper On Fri, 20 Aug 2004 09:33:32 -0700, Nic Werner [EMAIL PROTECTED] wrote: You'd think it would, but JSTL is still allowing them to pass through. Anyone want to point out where I'm just missing this? This code is generating the url string to be used later, but stripping out two of the params. If I don't use the OR, one will always strip out, but put it in and it ignores it. c:forEach items=${param} var=params varStatus=status c:if test=${params.key != 'view' || params.key != 'perPage'} c:set var=urlc:out value=${url}${params.key}=${params.value} escapeXml=false//c:set c:out value=${params.key}=${params.value} escapeXml=false/ %-- Output to test --% /c:if /c:forEach Any suggestions guys? You've never failed me before! Thanks, - Nic. Derek wrote: You were on the right path. This should do it... c:if test=${params.key != 'view' || params.key != 'perPage'} Derek On Aug 19, 2004, at 7:47 PM, Nic Werner wrote: I'm sure I'm just looking at this the wrong way, and I can't find it in Shawns book, but I want to evaluate two variables with an OR condition: c:if test=${params.key != ('view' || 'perPage')} Basically, if params.key doesn't equal the words 'view' or 'perPage', go ahead... What am I doing wrong here?! Thanks, - Nic - 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]
Nested expressions
I'm sure I'm just looking at this the wrong way, and I can't find it in Shawns book, but I want to evaluate two variables with an OR condition: c:if test=${params.key != ('view' || 'perPage')} Basically, if params.key doesn't equal the words 'view' or 'perPage', go ahead... What am I doing wrong here?! Thanks, - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding user input
Hi, I have two pages, one with a form to input/update data and then the second which 'handles' the data w/logic. Now, I want to add an intermediary page that looks at the inputted data, does some DB stuff etc, and then asks the user if they want to continue or go back. - I could just pass the params from 1st to 2nd to third page, but it seems clunky. Any suggestions? Has anybody done any tag work to make this cleaner? - Nic -- Nic Werner Sonoma State University - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Iterating through form parametera
Hi, I want to iterate through form parameters that have been passed to the page, but using: c:forEach items=${param} var=params varStatus=status c:out value=${params}/BR /c:forEach Outputs the full value ie: var1=hi I want to split var1 and 'hi' into two different variables, is there a way to access that in JSTL, such as '.value' or '.name'? I can't find any documentation detailing the params Thanks, - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Rotating tables? (slightly OT)
David Schwartz wrote: is this possible/smart in JSTL May be possible but not smart. Should be returned by the database just displayed by JSTL. You need a crosstab query. Which database are you using? I'm using Oracle. I've got a crosstab query going now, but what happens is that I'm getting getting duplicate rows with one row having a null in a certain field and the other with data in the field: select distinct x.outlet_no, building.name, x.rm, decode(b.color,NULL,' ',b.color), decode(b.switchip,NULL,' ',b.switchip) BSWITCHIP, decode(b.blade,NULL,' ',b.blade) BBLADE, decode(b.port,NULL,' ',b.port) BPORT, decode(b.vlan,NULL,' ',b.vlan) BVLAN, decode(o.color,NULL,' ',o.color) , decode(o.switchip,NULL,' ',o.switchip) OSWITCHIP, decode(o.blade,NULL,' ',o.blade) OBLADE, decode(o.port,NULL,' ',o.port) OPORT, decode(o.vlan,NULL,' ',o.vlan) OVLAN, decode(g.color,NULL,' ',g.color) , decode(g.switchip,NULL,' ',g.switchip) GSWITCHIP, decode(g.blade,NULL,' ',g.blade) GBLADE, decode(g.port,NULL,' ',g.port) GPORT, decode(g.vlan,NULL,' ',g.vlan) GVLAN, d.dn from building, data b, data o, data g, cablepair d, new_outlet x where x.outlet_no = b.outlet_no(+) and x.outlet_no = o.outlet_no(+) and x.outlet_no = g.outlet_no(+) and x.id=d.cabl_pr(+) and b.color(+) = 'B' and o.color(+) = 'O' and g.color(+) = 'G' and x.buildid=building.id(+) This will give me outlets of three colors, but the phone (dn) from 'cablepair' will cause duplicate rows. I guess the best way to eliminate this is to union this query against itself for each color, which will be clunky. Thanks for all your input! - Nic. Quoting Helios Alonso [EMAIL PROTECTED]: I think he wants a table like this: + John (in red) + Mark (in blue) + Nic (in green) + Helios (in red) + David (in blue) If you have an array of 3 colors named colors (I dont know but, maybe the set tag can build a mapping that works like an array...) Try this: !-- initialization -- c:set var=colorIndex value=0/ !-- loop -- tr td bgcolor=${colors[colorIndex++%3]} In the expression you're coding the round robin (increment and modulus 3) and the selection of the color based on the index. But, I didn't try it. I hope the modulus is a valid construction in EL. At 11:05 04/08/2004 +0200, you wrote: I'm not exactly sure what you mean with rotate?! Do you just have a collection that you want to iterate - with each each entry corresponding to a row in the table? Or shall every row display a different column of your table? It's hard to understand from your examples.. For displaying tabular data, you should check out the displaytag-library: http://displaytag.sourceforge.net/ - it has nothing to with jstl, but gives you everything you will likely ever need for displaying tables... cheers stf Nic Werner wrote: Greetings, I have a table of data that I'd basically like to rotate, is this possible/smart in JSTL? Basically, I have an attribute with three colors, each one is a different row in a table. 001 Blue data 001 Green data 002 Purple data I want to have one row:001 | Blue Data | Green Data | Purple Data. Any suggestions? Please help by pointing me elsewhere if you can - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Stefan Frank iBioS - Intelligent BioInformatics Systems http://www.dkfz-heidelberg.de/ibios DKFZ - German Cancer Research Center Im Neuenheimer Feld 580 69120 Heidelberg Tel.: +49 (0) 6221 42-3612 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] David Schwartz Array Software Inc. http://www.arrayone.com - 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: Rotating tables?
Actually, I have the table like that currently, which has a common attribute: To use our running example it looks like: MALE | JOHN | RED MALE | MARK | BLUE MALE | NIC | GREEN MALE | DAVID | BLUE FEMALE | SARA | ORANGE I want to display like:MALE: John (red) | Mark (blue) | Nic (Green) | David (Blue) FEMALE: Sara (orange) The color isn't an issue, its basically just grouping by a common attribute and displaying it horizontally instead of vertically. - Nic Helios Alonso wrote: I think he wants a table like this: + John (in red) + Mark (in blue) + Nic (in green) + Helios (in red) + David (in blue) If you have an array of 3 colors named colors (I dont know but, maybe the set tag can build a mapping that works like an array...) Try this: !-- initialization -- c:set var=colorIndex value=0/ !-- loop -- tr td bgcolor=${colors[colorIndex++%3]} In the expression you're coding the round robin (increment and modulus 3) and the selection of the color based on the index. But, I didn't try it. I hope the modulus is a valid construction in EL. At 11:05 04/08/2004 +0200, you wrote: I'm not exactly sure what you mean with rotate?! Do you just have a collection that you want to iterate - with each each entry corresponding to a row in the table? Or shall every row display a different column of your table? It's hard to understand from your examples.. For displaying tabular data, you should check out the displaytag-library: http://displaytag.sourceforge.net/ - it has nothing to with jstl, but gives you everything you will likely ever need for displaying tables... cheers stf Nic Werner wrote: Greetings, I have a table of data that I'd basically like to rotate, is this possible/smart in JSTL? Basically, I have an attribute with three colors, each one is a different row in a table. 001 Blue data 001 Green data 002 Purple data I want to have one row:001 | Blue Data | Green Data | Purple Data. Any suggestions? Please help by pointing me elsewhere if you can - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Stefan Frank iBioS - Intelligent BioInformatics Systems http://www.dkfz-heidelberg.de/ibios DKFZ - German Cancer Research Center Im Neuenheimer Feld 580 69120 Heidelberg Tel.: +49 (0) 6221 42-3612 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]
Rotating tables?
Greetings, I have a table of data that I'd basically like to rotate, is this possible/smart in JSTL? Basically, I have an attribute with three colors, each one is a different row in a table. 001 Blue data 001 Green data 002 Purple data I want to have one row:001 | Blue Data | Green Data | Purple Data. Any suggestions? Please help by pointing me elsewhere if you can - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Search Engine Queries
I know this might not be a pure JSTL thing, but if anyone could offer some pointers, I'd appreciate it: I've got a search page thing going on in JSP (JSTL), and I want to be able to search on any of the fields that are entered, basically an AND filter. So as to not create dynamic SQL queries, I use the below SQL code: query part here... and nvl(d.cable,' ') like nvl(?,'%') and nvl( d.pair , ' ') like nvl(?,'%') and nvl( to_char(d.prefix) , ' ') like nvl(?,'%') and nvl( upper(d.lname) , ' ') like upper(nvl(?,'%')) and nvl( upper(d.fname) , ' ') like upper(nvl(?,'%')) and nvl( to_char(d.DN) , ' ') like nvl(?,'%') and nvl( to_char(d.TN) , ' ') like nvl(?,'%')and nvl( upper(d.DEPT_CD) , ' ') like nvl(?,'%') JSTL PARAMS sql:param value=${param.cable}/ sql:param value=%${param.pair}%/ sql:param value=${param.prefix}/ sql:param value=%${param.lname}%/ sql:param value=%${param.fname}%/ sql:param value=%${param.dn}%/ sql:param value=%${param.tn1}%${param.tn2}%${param.tn3}%${param.tn4}%/ sql:param value=${param.dept_cd}/ This works well, except all the 'like' statements really bog down the Oracle system. Can anyone suggest a way to dynamically create the above query portion, only putting in the statements that actually have data? I don't know much Java, but this seems like an applicable language to create the text, but PL/SQL seems viable also. JSTL might be inappropriate for this. Any thoughts? Am I reinventing the wheel? Thanks, - Nic. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Url Decoding
I've setup two pages where I can basically type a query in, and the second page does the sql work. However, I'm trying to use the URLDecoder statement to format my query, and it throws an error whenever I have a query with the '%' sign: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: ') Is there a workaround or JSTL equivalent for this? Here is the formatting code, I'm not too strong in this area, so any help would be appreciated. - Nic. -- %-- The query comes in here, and we format it appropriately --% c:set var=query%= URLDecoder.decode(request.getParameter(query)) %/c:set %-- Then we drop it into a sql query command, once again formatting --% c:set var=newqueryc:out value='${query}' escapeXml=false//c:set c:catch var=error sql:query var=searchc:out value=${newquery} escapeXml=false//sql:query /c:catch c:out value=${query}/ c:out value=${error}/ --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HTTP Headers
Is there a way to send HTTP headers w/JSTL? I want to send a header to the browser to invalidate (close) a session and I couldn't really find anything w/google. Thanks, - Nic Werner - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:out Default Value Escaping
I had fun with: c:choosec:when test=${empty main.outlet_no }nbsp;/c:whenc:otherwisec:out value=${main.outlet_no}//c:otherwise/c:choose - Nic Werner Request for a new feature, I think: I'd like to be able to turn off escaping for the default value in the c:out tag, but not the regular value if it exists. Here's what I'm trying to do: When displaying HTML tables that contain CSS borders, I need to put a blank value(nbsp;) in those cells that contain null values, otherwise the borders won't appear correctly. This is a common requirement. With JSTL 1.0, there's a problem if I try to use this pattern: tdc:out value=${someVariable} default=nbsp; escapeXml=false//td The problem is that I want escaping turned on for the regular variable value, if it exists. Perhaps there should be two new attributes for the c:out tag: valueEscapeXml and defaultEscapeXml. - Jim __ James Watkin ACIS Software Development The Anderson School at UCLA [EMAIL PROTECTED] Voice: 1-310-825-5030 Fax: 1-310-825-4835 __ - 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]
Capturing URL
Is there any way to capture the current URL? I want to be able to take the parameters passed to the page, add some extras and then resubmit without creating an individual hidden field for each specific param. Thanks, - Nic Link11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Accessing outside of current index with forEach or forTokens
Hey, I've got a drop box that has two values, the one being printed, and the value being passed. I wanted to do something like this: items=Pre-Clinical,0,Clinical,1,Admissions,2,Graduated,3 and have in the option tag the value be the numeric and then use the text to display. Is there any way to access an 'i+1' type of thing, where if I was currently at index [0], I could access the next one without actually iterating? I'm sure this is just my lack of EL knowledge, if someone could help me out I'd really appreciate it. Nic Werner Link11 Systems - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Simple iteration
This is a simple question, but is there any way to count *backwards* in JSTL? Using the forEach tag, if begin=10 and end=0, I get an: 'end' 0 error I've also tried using step=-1 to no avail. Basically, I want to create a year pulldown box which starts at the currentyear and then displays the previous twenty years. c:forEach begin=${currentYear} end=${currentYear-20} step=-1 var=year option c:out value=${year}//option /c:forEach - Nic - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: My favorite tag is ......displaytag.sf.net
This tag looks great, but I haven't been able to find any documentation on using this with JSTL! Can someone help me out with this or point me somewhere? There appears to be a lot of work and suggestions, but little on implementation - Nic Link11 I have use many tags, such as JSTL, etc. I just want to say, this is my favoirete tag!!! http://displaytag.sourceforge.net .V - 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: Handling null dates
Well, what I'm trying to nail down also is how empty values are passed across a submit form. I have a drop down, and one of the options is: option value= /option Which, if the name of the input is 'datemonth', then the GET says handler.jsp?datemonth= Now, when I have my handler jsp pick this up, will it take that as null or empty? This is what trips up fmtDate and if someone knew what JSTL did with this, I would appreciate it. If it was null, as someone mentioned earlier, the spec would be able to handle it. - Nic Werner Link11 - Original Message - From: Narayan, Anand [EMAIL PROTECTED] To: 'Tag Libraries Users List' [EMAIL PROTECTED] Sent: Thursday, July 31, 2003 12:23 PM Subject: RE: Handling null dates The problem I am encountering seems to be with the JDBC driver. Acc. to the release note for JSTL 1.0 on the jakarta site one should be able to use the EL ${null} for the value parameter of sql:param or sql:dateParam but some drivers do not support the underlying implementation by jakarta. Heres the exact text: Use of null with sql:param and sql:dateParam The Standard 1.0 taglib utilizes the PreparedStatement.setObject(parameterIndex, null) when specifying the sql:dateParam value=${null} type='date'/ or sql:param value=${null} / actions. Not all JDBC drivers currently support the passing of null to the PreparedStatement.setObject() method. If you encounter a failure with your JDBC driver, please execute a SQL DML statement which does not require sql:param or sql:dateParam to specify a null value for a given column. -Original Message- From: Siggelkow, Bill [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 3:12 PM To: 'Tag Libraries Users List' Subject: RE: Handling null dates Are you parsing the dates using fmt:parseDate? If so, then according to the spec, the if the input value is null or the variable specifed by var will be removed. You could then use the empty operator to check for a null value. Hope this helps. -Original Message- From: Narayan, Anand [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:27 AM To: 'Tag Libraries Users List' Subject: RE: Handling null dates Same issue here with null dates. I need to set the value of a date field to null. How can I create an object that equates to null? The JSTL spec for dateParam says that if the value equates to null the column will be set to null but i have not figured out how to create a null object in JSP. Any ideas?? Thanks Anand Narayan -Original Message- From: Nic Werner [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 1:27 PM To: Tag Libraries Users List Subject: Handling null dates Greetings, I have a form that has a lot of date fields, they represent dates someone attempted to take a test. There are multiple sets of these for each attempt they have taken, but I run into trouble if there is only one test attempt, meaning there are blank dates for the other attempts. Is there any way I can have the form send over the blank values and JSTL will just update the database with these blank values? I've tried to detect if the date is empty and just set the variable to be updated to be blank with c:set value= var=datetaken/ but I get invalid column type. Thanks, Nic Werner Link11 - 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]
Count number of weeks between two dates
Does anyone have any idea of how to implement this in JSTL? I looked through the taglibs but didn't really see a function for counting. I suppose I could add up the number of days based on what month it is, but I'd rather keep it simple! Thanks, - Nic Werner Link11
Re: Why no exception with missing accessor?
I definitely agree with you on this point. While I like how JSTL doesn't dump error messages in the page, I've spent many bleary-eyed hours trying to troubleshoot code only to find I was missing something simple like the example below. Tracing through code is a bummer and being able to have a little more feedback is invaluable. Can someone shed some light on why an accessor function would be a bad thing? - Nic Werner Link11 - Original Message - From: Eric W Hauser [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 10:46 AM Subject: Why no exception with missing accessor? While discussing JSTL with some others developers today, a question came up about the lack of helpful errors when using JSTL incorrectly. If I use the following line of code: c:out value=${sessionScope.mybean.value}/ and there is no accessor method of value, then JSTL just returns nothing. Others said they though it would make more sense if a JspException was thrown because you were attemping to access an accessor that did not exist. We have a number of custom tag libraries in which I would like to add the ability to exception EL expressions, but I'm getting some resistance because of this issue. Any thoughts? --- Eric Hauser [EMAIL PROTECTED] (317) 679-4766 - 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]