Struts bean:define to JSTL EL
Hi all. I'm new at JSTL, I hope someone can help me here. I have struts bean:define which looks like this: bean:define name=UIManager property=collection(tab) / UIManager bean has getCollection(String) property. What is the equivalent syntax for JSTL? Thanx.
Re: Tag List
Yes I want to enter into the database using a form Scott - Original Message - From: Eddie Barna [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 6:46 PM Subject: Re: Tag List Are you trying to do an entry form that stores the data in the db? Please clarify. As for Struts: I am not familiar with those. I am actually not that familiar with JSP itself. That is why i decided to start with JSTL (it makes things easier). Sorry. Eddie B. - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 10:23 AM Subject: Re: Tag List Thanks...how about an entry form? Also, if I want to do JSP's easier are Struts better? I will get the book though Thanks Scott - Original Message - From: Eddie Barna [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 6:01 PM Subject: Re: Tag List You can pass the value from your search form to the page which you have listed in your email. For example: You have a search form with a text box titled search Here's what the page that queries the db would look like now sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD WHERE CDTITLE = ? sql:param value=${param.search}/ /sql:query You can also expand on this by using the OR statement in your query. For example: sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD WHERE CDTITLE = ? OR ARTIST = ? sql:param value=${param.search}/ sql:param value=${param.search}/ /sql:query For every condition in your query you must add a sql;param/ tag. Hope this helps. I really do recomend that you get Shawn Bayern's book titled JSTL in Action. It explains all this in great detail, plus everything else. - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 14, 2003 9:31 AM Subject: Tag List I am trying to find a list of tags to help me modify the CD Shop Cart web application from Sun One. For example, how do I insert tags that provide a search form (and entry form) rather than simply list everything. Here is what the code looks like so far: %@page contentType=text/html% html headtitleCD Catalog List/title/head %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=sql uri=http://java.sun.com/jstl/sql; % body h1 CD Catalog List /h1 sql:setDataSource var=productDS url=jdbc:postgresql://localhost:5432/recruitment driver=org.postgresql.Driver user=scott password= / sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD /sql:query TABLE border=1 TR THID/TH THCD Title/TH THArtist/TH THCountry/TH THPrice/TH /TR c:forEach var=row items=${productQuery.rows} TR TDc:out value=${row.ID}//TD TDc:out value=${row.CDTITLE}//TD TDc:out value=${row.ARTIST}//TD TDc:out value=${row.COUNTRY}//TD TDc:out value=${row.PRICE}//TD TD form method=get action=ShopCart.jsp input type=hidden name=cdId value=c:out value=${row.ID}/ input type=hidden name=cdTitle value=c:out value=${row.CDTITLE}/ input type=hidden name=cdPrice value=c:out value=${row.PRICE}/ input type=submit name=operation value=Add /form /TD /TR /c:forEach /TABLE /body /html Regards Scott - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tag List
Thanks I will look at Maverick. Why is Maverick and Struts considerd MVC, when the idea of JSP is part of MVC? Scott - Original Message - From: Schnitzer, Jeff [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 8:19 PM Subject: RE: Tag List Yes, if you're using JSTL then you will be a whole lot better off with an MVC framework like Struts or Maverick. I recommend Maverick - it's considerably simpler than Struts, yet offers more features. Also, unlike most other similar frameworks (Struts, WebWork, etc), Maverick never started out with a now-crufty set of specialized set of JSP tags - JSTL works great. The core distribution includes a sample application that uses JSTL. http://mav.sourceforge.net Jeff Schnitzer [EMAIL PROTECTED] (yes, I'm the lead developer of Maverick) - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 10:23 AM Subject: Re: Tag List Thanks...how about an entry form? Also, if I want to do JSP's easier are Struts better? I will get the book though Thanks Scott - Original Message - From: Eddie Barna [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 6:01 PM Subject: Re: Tag List You can pass the value from your search form to the page which you have listed in your email. For example: You have a search form with a text box titled search Here's what the page that queries the db would look like now sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD WHERE CDTITLE = ? sql:param value=${param.search}/ /sql:query You can also expand on this by using the OR statement in your query. For example: sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD WHERE CDTITLE = ? OR ARTIST = ? sql:param value=${param.search}/ sql:param value=${param.search}/ /sql:query For every condition in your query you must add a sql;param/ tag. Hope this helps. I really do recomend that you get Shawn Bayern's book titled JSTL in Action. It explains all this in great detail, plus everything else. - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 14, 2003 9:31 AM Subject: Tag List I am trying to find a list of tags to help me modify the CD Shop Cart web application from Sun One. For example, how do I insert tags that provide a search form (and entry form) rather than simply list everything. Here is what the code looks like so far: %@page contentType=text/html% html headtitleCD Catalog List/title/head %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=sql uri=http://java.sun.com/jstl/sql; % body h1 CD Catalog List /h1 sql:setDataSource var=productDS url=jdbc:postgresql://localhost:5432/recruitment driver=org.postgresql.Driver user=scott password= / sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD /sql:query TABLE border=1 TR THID/TH THCD Title/TH THArtist/TH THCountry/TH THPrice/TH /TR c:forEach var=row items=${productQuery.rows} TR TDc:out value=${row.ID}//TD TDc:out value=${row.CDTITLE}//TD TDc:out value=${row.ARTIST}//TD TDc:out value=${row.COUNTRY}//TD TDc:out value=${row.PRICE}//TD TD form method=get action=ShopCart.jsp input type=hidden name=cdId value=c:out value=${row.ID}/ input type=hidden name=cdTitle value=c:out value=${row.CDTITLE}/ input type=hidden name=cdPrice value=c:out value=${row.PRICE}/ input type=submit name=operation value=Add /form /TD /TR /c:forEach /TABLE /body /html Regards Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: taglibs-user- [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
Re: Tag List
Scott, Is this kinda what you mean? Are you trying to add the search/edit/remove/add functionality to the jsp page? This could easily be captured with forms which submit back to the jsp plus a choose block to designate which operation is being performed. I bet this'll really irk those Struts/Maveric MVC folks out there with its use of the JSP page as both the Controller and View. But it is relatively easy to accomplish using JSTL without such heavy MVC frameworks. Here is the example: %@page contentType=text/html% %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=sql uri=http://java.sun.com/jstl/sql; % sql:setDataSource var=productDS url=jdbc:postgresql://localhost:5432/recruitment driver=org.postgresql.Driver user=scott password= / %-- conditional logic and sql manipulation --% c:choose c:when test=${request.operation == 'Add'} sql:update... sql tags to support the add request /c:when c:when test=${request.operation == 'Remove'} sql:update... sql tags to support the remove request /c:when c:when test=${request.operation == 'Edit'} sql:update... sql tags to support the edit request /c:when /c:choose %-- query to load the html page contents --% c:choose c:when test=${request.operation == 'Search'} %-- EXPAND YOUR QUERY WITH SEARCH TERMS HERE --% %-- use some conditional logic on the request parameters to deside how the query should be augmented --% sql:query var=productQuery dataSource=${productDS} /sql:query /c:when c:otherwise sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD /sql:query /c:otherwise /c:choose %-- page with forms to add/edit/remove the contents --% html headtitleCD Catalog List/title/head body h1 CD Catalog List /h1 form method=get TDinput type=text name=cdId value=/TD TDinput type=text name=cdTitle value=/TD TDinput type=text name=cdArtist value=/TD TDinput type=text name=cdCountry value=/TD TDinput type=text name=cdPrice value=/TD TDinput type=submit name=operation value=Search/TD /form TABLE border=1 TR THID/TH THCD Title/TH THArtist/TH THCountry/TH THPrice/TH TH colspan=2Command/TH /TR c:forEach var=row items=${productQuery.rows} TR form method=get TDinput type=text name=cdId value=c:out value='${row.ID}'//TD TDinput type=text name=cdTitle value=c:out value='${row.CDTITLE}'//TD TDinput type=text name=cdArtist value=c:out value='${row.ARTIST}'//TD TDinput type=text name=cdCountry value=c:out value='${row.COUNTRY}'//TD TDinput type=text name=cdPrice value=c:out value='${row.PRICE}'//TD TDinput type=submit name=operation value=Edit/TD /form TD form method=get input type=hidden name=cdId value=c:out value='${row.ID}'/ input type=submit name=operation value=Remove /form /TD /TR /c:forEach TRTDAdd new entry/TD/TR TR form method=get TDinput type=text name=cdId value=.../TD TDinput type=text name=cdTitle value=.../TD TDinput type=text name=cdArtist value=.../TD TDinput type=text name=cdCountry value=.../TD TDinput type=text name=cdPrice value=.../TD TD colspan=2input type=submit name=operation value=Add/TD /form /TR /TABLE /body /html If you want to encapsulate the functions for adding/removing/editing the content and not have them in this View/Controller, you could include them from separate JSP's or Servlets. or likewise submit the forms directly to those JSP's or Servlets and then redirect back to this jsp once the work was done. It stays pretty independent and light without too much dependency on any particular framework other than the JSP/JSTL tags. Which results in less research and development effort to accomplish the same task. All you need to know is JSP/JSTL. -Mark Eddie Barna wrote: You can pass the value from your search form to the page which you have listed in your email. For example: You have a search form with a text box titled search Here's what the page that queries the db would look like now sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD WHERE CDTITLE = ? sql:param value=${param.search}/ /sql:query You can also expand on this by using the OR statement in your query. For example: sql:query var=productQuery dataSource=${productDS} SELECT * FROM CD WHERE CDTITLE = ? OR ARTIST = ? sql:param value=${param.search}/ sql:param value=${param.search}/ /sql:query For every condition in your query you must add a sql;param/ tag. Hope this helps. I really do recomend that you get Shawn Bayern's book titled JSTL in Action. It explains all this in great detail, plus everything else. - Original Message - From: Scott Taylor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 14, 2003 9:31 AM Subject: Tag List I
EL Functions
I notice in the source of Taglibs that there are what appear to be EL functions, but these do not appear in the JSTL reference material. Is there a definition of these functions? Or can we assume that all the functions in JavaScript (EcmaScript) exist in EL? David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: EL Functions
From what little I know, JSP 2.0 introduces the concept of functions to EL. I doubt these equate to ECMAScript, but is rather the ability to define your own functions. I'v eno clue if there will be standard-ised functions, though I'd expect JSTL might be the one to determine those. [Sorry, I'm quite clueless but there might be some nuggets there to help you move on, like reading the JSP 2.0 spec] Hen On Sun, 16 Feb 2003, David Goodenough wrote: I notice in the source of Taglibs that there are what appear to be EL functions, but these do not appear in the JSTL reference material. Is there a definition of these functions? Or can we assume that all the functions in JavaScript (EcmaScript) exist in EL? David - 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: EL Functions
JSP 2.0 provides tag-library developers with the ability to expose static methods as functions in their TLDs. These functions will be accessible to authors of any pages that import the containing tag library. This facility also allows JSTL to expose a set of standard functions. The precise set of functions that JSTL 1.1 will expose is still being debated, but it will likely include a limited set of string-manipulation functions and a handful of targeted solutions (such as a 'size' function). Future versions of JSTL can expose more functions as necessary. -- Shawn Bayern JSTL in Action http://www.manning.com/bayern On Sun, 16 Feb 2003, Henri Yandell wrote: From what little I know, JSP 2.0 introduces the concept of functions to EL. I doubt these equate to ECMAScript, but is rather the ability to define your own functions. I'v eno clue if there will be standard-ised functions, though I'd expect JSTL might be the one to determine those. [Sorry, I'm quite clueless but there might be some nuggets there to help you move on, like reading the JSP 2.0 spec] Hen On Sun, 16 Feb 2003, David Goodenough wrote: I notice in the source of Taglibs that there are what appear to be EL functions, but these do not appear in the JSTL reference material. Is there a definition of these functions? Or can we assume that all the functions in JavaScript (EcmaScript) exist in EL? David - 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]