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]
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]
Taglib / context-param question
I have the following code in a custom taglib. If I put the hex values of the colors in the context-param area of the web.xml file, how do you call them? public int doEndTag() throws JspException { Boolean alternate = (Boolean) ExpressionEvaluatorManager.evaluate(alternate, alternateEL, Boolean.class, this, pageContext); if (alternate.booleanValue()) { color = #FF; } else { color = #FF; } try { JspWriter out = pageContext.getOut(); out.write(color); } catch (IOException e) { e.printStackTrace(); } return EVAL_PAGE; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Taglib / context-param question
Rahul: Worked great... Thanks! Jack Rahul P Akolkar wrote: If I put the hex values of the colors in the context-param area of the web.xml file, how do you call them? pageContext. getServletContext().getInitParameter(insert-context-param-name-here); -Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DataSource web.xml question
If I have a datasource in the context-param area of the web.xml file, how can it be called? context-param param-namejdbcDataSource/param-name param-valuejava:comp/env/jdbc/RestaurantDS/param-value /context-param pageContext. getServletContext().getInitParameter(insert-context-param-name-here); Doesn't work here... private void initialize() { try { Context ctx = null; DataSource ds = null; Connection conn = null; Result result = null; try { ctx = new InitialContext(); ds = (DataSource) ctx.lookup(java:comp/env/jdbc/RestaurantDS); } catch (Exception e) { System.out.println(DataSource context lookup failed: + e); } try { conn = ds.getConnection(); } catch (Exception e) { System.out.println(DataSource getConnection failed: + e); e.printStackTrace(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DataSource web.xml question
Schalk: I need to use JDNI... this is a JBoss DataSource. Any idea on how this might be done? Thanks, Jack Schalk Neethling wrote: Jack This is obviously if you are not using JNDI to lookup a datasource. Schalk Neethling wrote: Jack Within a servlet I use the following: public class activateArticle extends HttpServlet { public String DRIVER, URL, USER, PASS, message; public void init() throws ServletException { ServletContext context = getServletContext(); DRIVER = context.getInitParameter(DRIVER); URL = context.getInitParameter(URL); USER = context.getInitParameter(USER); PASS = context.getInitParameter(PASS); } HTH Jack Lauman wrote: If I have a datasource in the context-param area of the web.xml file, how can it be called? context-param param-namejdbcDataSource/param-name param-valuejava:comp/env/jdbc/RestaurantDS/param-value /context-param pageContext. getServletContext().getInitParameter(insert-context-param-name-here); Doesn't work here... private void initialize() { try { Context ctx = null; DataSource ds = null; Connection conn = null; Result result = null; try { ctx = new InitialContext(); ds = (DataSource) ctx.lookup(java:comp/env/jdbc/RestaurantDS); } catch (Exception e) { System.out.println(DataSource context lookup failed: + e); } try { conn = ds.getConnection(); } catch (Exception e) { System.out.println(DataSource getConnection failed: + e); e.printStackTrace(); } - 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: DataSource web.xml question
Thanks Kris Jack Kris Schneider wrote: Try an env-entry instead of a context-param: env-entry env-entry-namedataSource/env-entry-name env-entry-valuejdbc/RestaurantDS/env-entry-value env-entry-typejava.lang.String/env-entry-type /env-entry String envBase = java:comp/env/; Context ctx = new InitialContext(); String dataSourceName = (String)ctx.lookup(envBase + dataSource); DataSource ds = (DataSource)ctx.lookup(envBase + dataSourceName); That way you don't need access to a ServletContext instance. Jack Lauman wrote: Schalk: I need to use JDNI... this is a JBoss DataSource. Any idea on how this might be done? Thanks, Jack Schalk Neethling wrote: Jack This is obviously if you are not using JNDI to lookup a datasource. Schalk Neethling wrote: Jack Within a servlet I use the following: public class activateArticle extends HttpServlet { public String DRIVER, URL, USER, PASS, message; public void init() throws ServletException { ServletContext context = getServletContext(); DRIVER = context.getInitParameter(DRIVER); URL = context.getInitParameter(URL); USER = context.getInitParameter(USER); PASS = context.getInitParameter(PASS); } HTH Jack Lauman wrote: If I have a datasource in the context-param area of the web.xml file, how can it be called? context-param param-namejdbcDataSource/param-name param-valuejava:comp/env/jdbc/RestaurantDS/param-value /context-param pageContext. getServletContext().getInitParameter(insert-context-param-name-here); Doesn't work here... private void initialize() { try { Context ctx = null; DataSource ds = null; Connection conn = null; Result result = null; try { ctx = new InitialContext(); ds = (DataSource) ctx.lookup(java:comp/env/jdbc/RestaurantDS); } catch (Exception e) { System.out.println(DataSource context lookup failed: + e); } try { conn = ds.getConnection(); } catch (Exception e) { System.out.println(DataSource getConnection failed: + e); e.printStackTrace(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSTL - c:if test Question
I am using the following line of code to test strings for equailty. In most cases I'm just trying to compare a city name in an array to user input for the name of a city i.e. Seattle. c:if test=${restaurant.filterValue eq param.value} If the user enters seattle instead of Seattle I don't get a response. Is there a way to alter this statement to make it case insensitive? Is there a way to alter it to respond like a SQL %LIKE% query? Thanks, Jack - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL - c:if test Question
David: Thanks for your prompt reply. Your sugestion was a good idea, but I found that the following actually worked the way I wanted it to: c:if test=${fn:containsIgnoreCase(restaurant.filterValue, param.value)} Thanks, Jack David Schwartz wrote: Try... Add this to your jsp... %@ taglib prefix = fn uri = http://java.sun.com/jsp/jstl/functions; % Then... c:if test = '${fn:toUpperCase(restaurant.filterValue) eq fn:toUpperCase(param.value) }' Quoting Jack Lauman [EMAIL PROTECTED]: I am using the following line of code to test strings for equailty. In most cases I'm just trying to compare a city name in an array to user input for the name of a city i.e. Seattle. c:if test=${restaurant.filterValue eq param.value} If the user enters seattle instead of Seattle I don't get a response. Is there a way to alter this statement to make it case insensitive? Is there a way to alter it to respond like a SQL %LIKE% query? Thanks, Jack - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] David Schwartz - 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 Taglib /JSTL 1.1.2/JBoss4.0.1 Problem - Unparseable date
This code worked just fine under JSTL 1.0.x and JBoss3.0.x/3.2.x. When I moved it to and about a dozen other tags to JSTL 1.1x I just chaned the DD to allow RT. The error seem to be from: org.jboss.util.propertyeditor.DateEditor.getValue(DateEditor.java:42) For some reason the JBoss DateEditor is overriding java.util.Date and java.text.SimpleDateFormat. The properties-service.xml is supposed to be able to set a default DateParser but none of the combinations I've tried ahas worked. Is there a specific DateParser in the JSTL package that you know of? I haven't been able to find one. Apparently something like this is supposed to be used. Anyone have any ideas on what to do here? Thanks, Jack | mbean code=org.jboss.varia.property.PropertyEditorManagerService | name=jboss:type=Service,name=PropertyEditorManager | | !-- | Register and editor for each of the type_name=editor_type_name listed | in properties file style convetion. | -- | attribute name=Editors | java.util.Date=my.project.editors.DateEditor | /attribute | | /mbean ::SammyRulez:: wrote: the problem is not with JSTL but with your ExpressionEvaluatorManager.evaluate method. It seems to me that you have a rawly refatored method that cause the exception... verify the values of the parameters in the metod evaluate before use them On Wed, 29 Dec 2004 16:10:42 -0800, Jack Lauman [EMAIL PROTECTED] wrote: This is show stopper for us. Does anyone know how to fix this problem? It apparently only affects JBoss v4.0.x. It seems to affect any call to java.util.Date in a jsp page. The exception is coming from a custom tag library that I use for scheduling when date/time sensitive persistant content should be displayed. This code works fine in v3.0.7, v3.2.7 but not in v4.0.1. I tried several different combinations in the 'properties-service.xml' file, all of which generated mbean errors. I don't have a clue as to what should be used here. Is the a way to disable the default date parser? Any help would be appreciated. Thanks, Jack --- ERROR --- org.jboss.util.NestedRuntimeException: Unparseable date: Mon Dec 27 16:49:16 PST 2004; - nested throwable: (java.text.ParseException: Unparseable date: Mon Dec 27 16:49:16 PST 2004) org.jboss.util.propertyeditor.DateEditor.getValue(DateEditor.java:42) org.apache.taglibs.standard.lang.jstl.Coercions.coerceToObject(Unknown Source) org.apache.taglibs.standard.lang.jstl.Coercions.coerce(Unknown Source) org.apache.taglibs.standard.lang.jstl.ELEvaluator.convertStaticValueToExpectedType(Unknown Source) org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(Unknown Source) org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(Unknown Source) org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown Source) org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown Source) org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(Unknown Source) com.nwc.tags.DateSelectTag.doEndTag(DateSelectTag.java:120) --- END ERROR --- --- CODE SNIP --- public int doEndTag() throws JspException { /* * Evaluate the EL expression, if any */ Integer days = (Integer) ExpressionEvaluatorManager.evaluate(days, daysEL, Integer.class, this, pageContext); THIS IS THE LINE THAT THROWS THE EXCEPTION java.util.Date attribSelect = (java.util.Date) ExpressionEvaluatorManager.evaluate(select, selectEL, java.util.Date.class, this, pageContext); String name = (String) ExpressionEvaluatorManager.evaluate(name, nameEL, String.class, this, pageContext); String expires = (String) ExpressionEvaluatorManager.evaluate(expires, expiresEL, String.class, this, pageContext); Calendar now = Calendar.getInstance(); now.set(Calendar.HOUR_OF_DAY, 0); now.set(Calendar.MINUTE, 0); now.set(Calendar.SECOND, 0); now.set(Calendar.MILLISECOND, 0); SimpleDateFormat displayFormat = new SimpleDateFormat(MMM dd (EE)); SimpleDateFormat valueFormat = new SimpleDateFormat(MMMdd); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); try { JspWriter out = pageContext.getOut(); out.write(SELECT NAME=\ + name + \); java.util.Date today = valueFormat.parse(valueFormat.format(now.getTime())); java.util.Date select = null; if (attribSelect == null) { Calendar invalid = Calendar.getInstance(); invalid.set(Calendar.HOUR_OF_DAY, 0); invalid.set(Calendar.MINUTE, 0); invalid.set(Calendar.SECOND, 0); invalid.set(Calendar.MILLISECOND, 0); invalid.set(Calendar.DAY_OF_YEAR, invalid.get(Calendar.DAY_OF_YEAR) + days.intValue() + 1); select = valueFormat.parse(valueFormat.format(invalid.getTime())); } else { select = valueFormat.parse(valueFormat.format(attribSelect)); } if (select.before(today)) { if (expires.equals(yes
JSTL/JSP/regexp Question
I'm using the following code to return results from drop down menues and user input text. It works fine as long as the text is an exact case sensitive match to the data record. What I want to do is evaluate the output the results of a user input search based on 'param.field' in figure 3. i.e. If 'param.field' = 'name' use a regex or some other method to return all records that are a partial, case insensitive match to the input 'value' that was submitted in the search request. Is this possible to accomplish in JSTL? If so I'd like to know how. Thanks, Jack Example1: JavaScript Funciton: function MM_jumpMenu(targ,selObj,restore, field){ //v3.0 eval(targ+.location='http://mydomain.com/filter.jsp?field=+field+value=+selObj. options[selObj.selectedIndex].value+'); if (restore) selObj.selectedIndex=0; } //-- /script Example 2: Form to submit the input and the field 'name' to be found in the bean created array: form name=selectName method=get action=http:mydomain.com/filter.jsp input type=hidden name=field value=name input type=text name=value size=16 maxlength=40 value= input type=image border=0 alt=Go! src=images/go.gif align=absmiddle width=22 height=23 onChange=MM_jumpMenu('parent',this,0,'name') nwc:filterOptions which=name/ /form Example 3: Display the results. JSTL gets the results form a Map/Array of the entire record set that the bean created. (restaurant.id is the PK) c:forEach items=${restaurantInfo.restaurants} var=restaurant c:set target=${restaurant} property=filterField value=${param.field}/ c:if test=${restaurant.filterValue eq param.value} tr td width=155 align=center div align=lefta href=http://mydomain.com/viewRestaurant.jsp?id=c:out value=${restaurant.id}/c:out value=${restaurant.name}//a/div /td td width=130 div align=leftc:out value=${restaurant.address1}//div /td td width=79 div align=leftc:out value=${restaurant.city}//div /td td width=107 div align=rightc:out value=${restaurant.reservationPhone}//div /td /tr /c:if /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSTL Question
I'm using the following code to return results from drop down menues and user input text. It works fine as long as the text is an exact case sensitive match to the data record. What I want to do is evaluate the output the results of a user input search based on 'param.field' in figure 3. i.e. If 'param.field' = 'name' use a regex to return all records that are a partial, case insensitive match to the input 'value' that was submitted in the search request. Is this possible to accomplish in JSTL? If so I'd like to know how. Thanks, Jack Example1: JavaScript Funciton: function MM_jumpMenu(targ,selObj,restore, field){ //v3.0 eval(targ+.location='http://mydomain.com/filter.jsp?field=+field+value=+selObj. options[selObj.selectedIndex].value+'); if (restore) selObj.selectedIndex=0; } //-- /script Example 2: Form to submit the input and the field 'name' to be found in the bean created array: form name=selectName method=get action=http:mydomain.com/filter.jsp input type=hidden name=field value=name input type=text name=value size=16 maxlength=40 value= input type=image border=0 alt=Go! src=images/go.gif align=absmiddle width=22 height=23 onChange=MM_jumpMenu('parent',this,0,'name') nwc:filterOptions which=name/ /form Example 3: Display the results: c:forEach items=${restaurantInfo.restaurants} var=restaurant c:set target=${restaurant} property=filterField value=${param.field}/ c:if test=${restaurant.filterValue eq param.value} tr td width=155 align=center div align=lefta href=http://mydomain.com/viewRestaurant.jsp?id=c:out value=${restaurant.id}/c:out value=${restaurant.name}//a/div /td td width=130 div align=leftc:out value=${restaurant.address1}//div /td td width=79 div align=leftc:out value=${restaurant.city}//div /td td width=107 div align=rightc:out value=${restaurant.reservationPhone}//div /td /tr /c:if /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: taglib question
The app is likely to be deployed up to 100 times under different domain names. The context 'util' in the example is what determines which app the users sees. All of the static content of the site(s) is served by apache 2.0.52. All of the dynamic content is provided by JBoss 3.2.6/Tomcat 5.0.28. Do you think 'request.getContextPath()' would work in a situation like this? Thanks, Jack ::SammyRulez:: wrote: request.getContextPath().. so you don't need any param to update when you deploy/move an application SammyRulez On Sat, 06 Nov 2004 09:21:55 -0800, Jack Lauman [EMAIL PROTECTED] wrote: I have a custom taglib with a hard coded URL. I've added a 'context-param' entry to move it the web.xml file. Is 'getServletConfig().getInitParameter' the corect thing to use here or is there a better alternative? Original line: // out.println(A HREF='http://www.domainname.com/util/viewDate.jsp?id=; + id + date= + year + fmtMonth + fmtDate + ' + i + /A); Modified line: out.println(A HREF= + getServletConfig().getInitParameter(baseJbossUrl) + /viewDate.jsp?id= + id + date= + year + fmtMonth + fmtDate + ' + i + /A); Thanks, Jack - 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]
JSTL 1.0.5 Update Question
I'm using the following code to insert data from a form. The first to fields in the data base don't come from form fields but from entries in the web.xml file. How do you insert the web.xml value of: %application.getInitParameter(descriptiveName)% when updating a record? --- snip -- %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; % %@ taglib prefix=sql uri=http://java.sun.com/jstl/sql; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % %@ taglib prefix=nwc uri=http://nwcascades.com; % htmlhead base href=http://%=application.getInitParameter(baseUrl)%/ /head jsp:useBean id=now class=java.util.Date/ fmt:formatDate value=${now} var=submit_date pattern=-MM-dd/ fmt:formatDate value=${now} var=submit_time pattern=HH:mm:ss/ jsp:useBean id=signmeupInfo scope=request class=com.nwc.biteof.forms.SignmeupInfoBean jsp:setProperty name=signmeupInfo property=*/ /jsp:useBean c:choose c:when test=${signmeupInfo.valid} sql:setDataSource var=restaurants dataSource=jdbc/RestaurantDS/ sql:update dataSource=${restaurants} INSERT INTO SignMeUp (website, code, name, cuisine, owner, address1, address2, city, state, zip, country, email, phone, fax, message, submit_date, submit_time) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) sql:param value=%application.getInitParameter(descriptiveName)%/ sql:param value=%application.getInitParameter(websiteName)%/ sql:param value=${signmeupInfo.name}/ sql:param value=${signmeupInfo.cuisine}/ sql:param value=${signmeupInfo.owner}/ sql:param value=${signmeupInfo.address1}/ sql:param value=${signmeupInfo.address2}/ sql:param value=${signmeupInfo.city}/ sql:param value=${signmeupInfo.state}/ sql:param value=${signmeupInfo.zip}/ sql:param value=${signmeupInfo.country}/ sql:param value=${signmeupInfo.email}/ sql:param value=${signmeupInfo.phone}/ sql:param value=${signmeupInfo.fax}/ sql:param value=${signmeupInfo.comments}/ sql:param value=${submit_date}/ sql:param value=${submit_time}/ /sql:update - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL 1.0.5 Update Question
Worked great! Thanks. Jack Martin Cooper wrote: On Sun, 13 Jun 2004, Jack Lauman wrote: I'm using the following code to insert data from a form. The first to fields in the data base don't come from form fields but from entries in the web.xml file. How do you insert the web.xml value of: %application.getInitParameter(descriptiveName)% when updating a record? sql:param c:out value='${initParam[descriptiveName]}'/ /sql:param -- Martin Cooper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Form question
Is there a way to clear all the form fields after a JSTL form is successfully submitted so that if the user hits the back button and redisplays the form its fields will be empty? Jack - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
c:choose question
I am trying to format a table so that it displays the date in the first column on the first row and not display it again until the date changes to the next day. I have tried the following code to get this to work. Any suggestion on how to solve this problem would be appreciated. I've tried the display taglib but it's overkill for this. table tr align=center thDate/th thTime/th tham/pm/th thHeight/th thCondition/th /tr c:forEach var=row items=${result.rows} fmt:parseDate value=${row.date} var=parsedDate pattern=-MM-dd/ tr c:choose c:when test=${parsedDate == parsedDate} td align=left//td c:otherwise td align=leftfmt:formatDate value=${parsedDate} pattern=E'., 'MMM d//td /c:otherwise c:when /c:choose td align=rightc:out value=${row.Time}//td td align=centerc:out value=${row.Am_Pm}//td td align=rightc:out value=${row.Height}//td td align=centerc:out value=${row.Cond}//td tr /c:forEach /table - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date arithmetic in JSTL/Java
Justyna: Thank you, it does exactly what I wanted. Jack Justyna Horwat wrote: This is one simple way: jsp:useBean id=now class=java.util.GregorianCalendar/ % now.add(java.util.GregorianCalendar.DAY_OF_MONTH, 2); % fmt:formatDate value=${now.time} / Justyna Jack Lauman wrote: Is there a simple way to use the following line in a jsp page to get the current date and add 2 days to the value of ${now}? jsp:useBean id=now class=java.util.Date/ Thanks, Jack - 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]
Date arithmetic in JSTL/Java
Is there a simple way to use the following line in a jsp page to get the current date and add 2 days to the value of ${now}? jsp:useBean id=now class=java.util.Date/ Thanks, Jack - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSTL Formatting Question
I'm using the following jsp page to display tide tables. How can I separate the days using the retrieved date field so the date only appears on the first line of the result set and only appears again when the date changes. There are usually 6-7 lines of data for each day. I'd like to achieve something that looks like this: 2004-05-08 2:57AM 7.27 feet Low Tide 5:38AM Sunrise 6:44AM 8.45 feet High Tide 2:43PM -2.81 feet Low Tide 8:37PM Sunset 10:55 PM 9.98 feet High Tide 2004-05-09 4:13AM 7.28 feet Low Tide 5:36AM Sunrise The page can be seen here: http://hood.nwcascades.com/tides/tidetest.jsp --- code snip --- fmt:setLocale value='en-US'/ %-- Connect to MySQL using JBoss DataSource JNDI name --% sql:setDataSource var=bbvtides dataSource=jdbc/BirchBayVillageDS/ sql:query dataSource=${bbvtides} var=result SELECT date, time, am_pm, height, cond FROM cherry_point_tides WHERE date BETWEEN CURDATE() and CURDATE() + INTERVAL 2 DAY /sql:query %-- Display the tide table --% fmt:formatDate value='${now}' pattern='Tide Table for '', ' d', '/br Cherry Point, Birch Bay, Washington Statebr 48.8633#176; N, 122.7583#176; W - All times fmt:formatDate value='${now}' pattern=' ('zz')'/ ptable border=1 tr thDate/th thTime/th tham/pm/th thHeight/th thCondition/th /tr c:forEach var=row items=${result.rows} tr tdc:out value=${row.Date}//td tdc:out value=${row.Time}//td tdc:out value=${row.Am_Pm}//td tdc:out value=${row.Height}//td tdc:out value=${row.Cond}//td tr /c:forEach /table --- end code snip --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL Formatting Question
Nice.. but it produces html that won't work in older browsers. Thanks, Jack Steve Raeburn wrote: Take a look at DisplayTag (http://www.displaytag.org/example-grouping.jsp). It does grouping and lots of other very cool things with tables. Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL Formatting Question
I'll check it out. Thanks, Jack Steve Raeburn wrote: You might also be able to use the forCategories tag from the taglibs sandbox. http://jakarta.apache.org/taglibs/sandbox/doc/iterators-doc/intro.html Steve -Original Message- From: Jack Lauman [mailto:[EMAIL PROTECTED] Sent: May 8, 2004 3:59 PM To: Tag Libraries Users List Subject: Re: JSTL Formatting Question Nice.. but it produces html that won't work in older browsers. Thanks, Jack Steve Raeburn wrote: Take a look at DisplayTag (http://www.displaytag.org/example-grouping.jsp). It does grouping and lots of other very cool things with tables. Steve - 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]
TDL problem
I have a simple shopping cart the worked just fine under Tomcat 4.1.29 with JSTL 1.0.5. I want to move it to Tomact 5.0.19 with JSTL 1.1. I have changed the tld to the jsp 2.0 xml-schema, tried adding el-ignore with true and false attribs. but have yet to get rid of the following error. The attrib 'amount' comes from a session variable holds the total purchase amout. I'm not sure what else to try. Any suggestions would be appreciated. Thanks, Jack org.apache.jasper.JasperException: /checkout.jsp(81,3) According to TLD or attribute directive in tag file, attribute amount does not accept any expressions org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:984) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:739) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2230) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2236) org.apache.jasper.compiler.Node$Root.accept(Node.java:485) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180) org.apache.jasper.compiler.Validator.validate(Validator.java:1518) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:247) org.apache.jasper.compiler.Compiler.compile(Compiler.java:456) org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TDL problem
I tried all theses, just forget to put that in my origianl message. The problem seems to be that what the error says: According to TLD or attribute directive in tag file, attribute amount does not accept any expressions If if use a hard coded value for 'amount' i.e. 75.00 it works. If I use the existing value of ${grandTotal} it causes the error. I don't know what changed between the versions that would cause this to happen. Any suggestions? Jack Kris Schneider wrote: Assuming you've actually got the JSTL 1.1 JAR files in WEB-INF/lib, the next thing to verify is your taglib URIs. They've changed from 1.0 to 1.1: 1.0 %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % 1.1 %@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; % Just to add something new to this FAQ, I've gotten in the habit of creating a file called taglib.jspf that contains: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; % %@ taglib prefix=sql uri=http://java.sun.com/jstl/sql; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % %-- plus other taglib directives --% And my JSPs contain: %@ include file=taglib.jspf % So, if I need to change something, like, oh, the URI to move from JSTL 1.0 to 1.1, I only have to change one file. YMMV... Quoting Jack Lauman [EMAIL PROTECTED]: I have a simple shopping cart the worked just fine under Tomcat 4.1.29 with JSTL 1.0.5. I want to move it to Tomact 5.0.19 with JSTL 1.1. I have changed the tld to the jsp 2.0 xml-schema, tried adding el-ignore with true and false attribs. but have yet to get rid of the following error. The attrib 'amount' comes from a session variable holds the total purchase amout. I'm not sure what else to try. Any suggestions would be appreciated. Thanks, Jack org.apache.jasper.JasperException: /checkout.jsp(81,3) According to TLD or attribute directive in tag file, attribute amount does not accept any expressions org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:984) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:739) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2230) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2236) org.apache.jasper.compiler.Node$Root.accept(Node.java:485) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180) org.apache.jasper.compiler.Validator.validate(Validator.java:1518) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:247) org.apache.jasper.compiler.Compiler.compile(Compiler.java:456) org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) -- 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]
SQL / Date query
I'm trying to create a JSP page the will display rows of a table beginning on the current date and ending at a total of 7 days. The following query works in MySQL but returns the following error when attempting to run the jsp: org.apache.jasper.JasperException: SELECT date, time, am_pm, height, cond FROM cherry_point_tides WHERE date BETWEEN CURDATE and CURDATE() + INTERVAL 6 DAY : Column not found, message from server: Unknown column 'CURDATE' in 'where clause' at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Formatting question
Is it possible to create a jsp template with two or maybe three tables containing three fields each and populate them from a SQL query with am maximum depth of 30 lines in successive order? i.e. populate the first table with 30 lines then populate the second table with the next 30 lines starting with the 31st result, etc. I've seen this done but I'm not sure how to go about it. Thanks, Jack -- To unsubscribe, e-mail: mailto:taglibs-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:taglibs-user-help;jakarta.apache.org