Re: Problem in displaying ValueObject contents using logic tag
yoyu have to specify the class name of the value object in the type attribute of the iterate tag. this will solve the problem - Original Message - From: Sudhakar G [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 02, 2004 12:13 PM Subject: Problem in displaying ValueObject contents using logic tag Hi All, My ArrayList holds a set of ValueObjects.When I try to display the ArrayList contents using logic tag it is throwing an exception saying can't find the clientview bean. In Action class the code is like. request.setAttribute(ClientList,clientListVO); return mapping.findForward(success); In Jsp logic:iterate name=ClientList id=clientview bean:write name=clientview property=clientID/ /logic:iterate Value Object has ClientID as attribute with get and set methods. Can any one help in this problem that will be thankful.. Thanks in advance.. cheers Sudhakar DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services on any subject matter. Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message that do not relate to the official business of Tata Consultancy Services shall be understood as neither given nor endorsed by Tata Consultancy Services or any affiliate of Tata Consultancy Services. If you have received this message in error, you should destroy this message and may please notify the sender by e-mail. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem in displaying ValueObject contents using logic tag
Hi All, My ArrayList holds a set of ValueObjects.When I try to display the ArrayList contents using logic tag it is throwing an exception saying can't find the clientview bean. In Action class the code is like. request.setAttribute(ClientList,clientListVO); return mapping.findForward(success); In Jsp logic:iterate name=ClientList id=clientview bean:write name=clientview property=clientID/ /logic:iterate Value Object has ClientID as attribute with get and set methods. Can any one help in this problem that will be thankful.. Thanks in advance.. cheers Sudhakar DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic tag using locale
Thanks Ted, Doesn't this mean creating another bean/object though? For instance, right now I have two fields in the object that have this sort of requirement (ie. there are about 12 fields that don't have a language requirement). I was thinking it would be more efficient to just let the tile/jsp do the presentation work. You could be right though... maybe a simple presentation bean that just handles internationalised fields. cheers, Fred -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: 10 December 2003 20:04 To: Struts Users Mailing List Subject: Re: logic tag using locale I'd suggest resolving this type of language choice in the Action. For example, there could be one product bean that is populated with whatever language is preferred by the client. The page could then just write whatever has been placed into the bean. HTH, Ted. _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: logic tag using locale
I agree entirely. A pointer bean to the right data in the request. I'm so there. Thanks Ted. YTH -Joe -Original Message- From: Tsang, F (Fred) [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 5:06 AM To: Struts Users Mailing List Subject: RE: logic tag using locale Thanks Ted, Doesn't this mean creating another bean/object though? For instance, right now I have two fields in the object that have this sort of requirement (ie. there are about 12 fields that don't have a language requirement). I was thinking it would be more efficient to just let the tile/jsp do the presentation work. You could be right though... maybe a simple presentation bean that just handles internationalised fields. cheers, Fred -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: 10 December 2003 20:04 To: Struts Users Mailing List Subject: Re: logic tag using locale I'd suggest resolving this type of language choice in the Action. For example, there could be one product bean that is populated with whatever language is preferred by the client. The page could then just write whatever has been placed into the bean. HTH, Ted. _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _ - 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]
logic tag using locale
All, I'm trying to do a bean:write based on the user's current language. Before you ask, this isn't just internationalization using the properties files. I'm displaying item attributes stored in a database, where there are german and english descriptions. I know I can set a bean in my action and access the tag like so: request.setAttribute(currentLanguage, getLocale(request).getLanguage()); logic:equal name=currentLanguage value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal logic:equal name=currentLanguage value=de bean:write name=product property=specialFeaturesDE ignore=true / /logic:equal is there a bean for locale by default which removes the need to set the currentLanguage bean I have above? something like: logic:equal name=userlocale value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal Are there any special beans which have default names? Any help is appreciated. cheers, Fred _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic tag using locale
All, I'm trying to do a bean:write based on the user's current language. Before you ask, this isn't just internationalization using the properties files. I'm displaying item attributes stored in a database, where there are german and english descriptions. I know I can set a bean in my action and access the tag like so: request.setAttribute(currentLanguage, getLocale(request).getLanguage()); logic:equal name=currentLanguage value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal logic:equal name=currentLanguage value=de bean:write name=product property=specialFeaturesDE ignore=true / /logic:equal is there a bean for locale by default which removes the need to set the currentLanguage bean I have above? something like: logic:equal name=userlocale value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal Are there any special beans which have default names? Any help is appreciated. cheers, Fred _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _
RE: logic tag using locale
I've got a similar problem. You could write a scriptlet function that appended the correct languageCode onto your default property name and use the result of that string in the bean:write tag. Please let me know if you find a more elegant way around this. -Original Message- From: Tsang, F (Fred) [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 10:01 AM To: [EMAIL PROTECTED] Subject: logic tag using locale All, I'm trying to do a bean:write based on the user's current language. Before you ask, this isn't just internationalization using the properties files. I'm displaying item attributes stored in a database, where there are german and english descriptions. I know I can set a bean in my action and access the tag like so: request.setAttribute(currentLanguage, getLocale(request).getLanguage()); logic:equal name=currentLanguage value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal logic:equal name=currentLanguage value=de bean:write name=product property=specialFeaturesDE ignore=true / /logic:equal is there a bean for locale by default which removes the need to set the currentLanguage bean I have above? something like: logic:equal name=userlocale value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal Are there any special beans which have default names? Any help is appreciated. cheers, Fred _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic tag using locale
All, I'm trying to do a bean:write based on the user's current language. Before you ask, this isn't just internationalization using the properties files. I'm displaying item attributes stored in a database, where there are german and english descriptions. I know I can set a bean in my action and access the tag like so: request.setAttribute(currentLanguage, getLocale(request).getLanguage()); logic:equal name=currentLanguage value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal logic:equal name=currentLanguage value=de bean:write name=product property=specialFeaturesDE ignore=true / /logic:equal is there a bean for locale by default which removes the need to set the currentLanguage bean I have above? something like: logic:equal name=userlocale value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal Are there any special beans which have default names? Any help is appreciated. cheers, Fred _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic tag using locale
I'd suggest resolving this type of language choice in the Action. For example, there could be one product bean that is populated with whatever language is preferred by the client. The page could then just write whatever has been placed into the bean. HTH, Ted. Tsang, F (Fred) wrote: All, I'm trying to do a bean:write based on the user's current language. Before you ask, this isn't just internationalization using the properties files. I'm displaying item attributes stored in a database, where there are german and english descriptions. I know I can set a bean in my action and access the tag like so: request.setAttribute(currentLanguage, getLocale(request).getLanguage()); logic:equal name=currentLanguage value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal logic:equal name=currentLanguage value=de bean:write name=product property=specialFeaturesDE ignore=true / /logic:equal is there a bean for locale by default which removes the need to set the currentLanguage bean I have above? something like: logic:equal name=userlocale value=en bean:write name=product property=specialFeatures ignore=true / /logic:equal Are there any special beans which have default names? Any help is appreciated. cheers, Fred _ This email (including any attachments to it) is confidential, legally privileged, subject to copyright and is sent for the personal attention of the intended recipient only. If you have received this email in error, please advise us immediately and delete it. You are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Although we have taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the viruses in this email or attachments. We exclude any liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided in this email or its attachments, unless that information is subsequently confirmed in writing. If this email contains an offer, that should be considered as an invitation to treat. _ - 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]
My logic Tag Does Not Seem To Work
Please point out my mistakes. Does the 'name' attribute of the logic tag accept an object only? For example, I created a session this way: HttpSession session = request.getSession(); String username = request.getRemoteUser(); session.setAttribute( user, username ); In the LogoffAction, I invalidate the session and want to forward the visitor to the welcome page. This is what I did: HttpSession session = request.getSession(false); String username = (String)session.getAttribute( user ); if (username != null) { session.removeAttribute( user ); session.invalidate(); return (mapping.findForward( success )); } I used the logic tag in my welcome.jsp. It does seem to work because the LOGOFF button is still displayed. logic:notPresent name=user html:link forward=logonLOGON/html:link /logic:notPresent logic:present name=user| html:link forward=exitLOGOUT/html:link /logic:present -Caroline __ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Logic Tag - Type
We wish to develop a TILE that could render a typical table listing in our application. This TILE shall access a particular arraylist to display the table. This arraylist shall be of different DTO's for different screens. I want to pass the type of DTO to this TILE while I do tile:get inside my TILE I am trying to do the following: bean:define id=fName name=FormName / bean:define id=pName name=PropertyName / bean:define id=cType name=DTOType / logic:iterate id=DataClass name=%= fName % property=%= pName % type=%= cType % XXX /logic:iterate Above code does not work, but If I remove type=%= cType %. What shall I do to make it work ?
Logic Tag - Type
We wish to develop a TILE that could render a typical table listing in our application. This TILE shall access a particular arraylist to display the table. This arraylist shall be of different DTO's for different screens. I want to pass the type of DTO to this TILE while I do tile:get inside my TILE I am trying to do the following: bean:define id=fName name=FormName / bean:define id=pName name=PropertyName / bean:define id=cType name=DTOType / logic:iterate id=DataClass name=%= fName % property=%= pName % type=%= cType % XXX /logic:iterate Above code does not work, but If I remove type=%= cType %, it works fine What shall I do to make it work ?
Re: [Logic Tag] Can This work
Alright, Following is what exactly am I trying to achieve: In our application we have to develop number of screens (more than 200) which have a table listing with 10 rows shown at a time and facility for next and previous page being given in the form of buttons. I wish to write a generic TILE which could be passed with an arraylist of some DTO, to render the table, thus reducing the coding effort. We as have written a generic Value List Handler component to suit our need. While developing the subject TILE we need to specify the DTO's type at run-time (in JSP), and we are not able to achieve this. As you can see in the code given, we try to give the type attribute with the help of bean:write. Hope this clears up the problem. Regards, Puneet Agarwal Ext: 1031 Struts ... Action ... Struts in Action ... Action in Struts ... Action with Struts ... James Mitchell To: Struts Users Mailing List [EMAIL PROTECTED] [EMAIL PROTECTED]cc: ache.orgSubject: Re: [Logic Tag] Can This work 03/29/03 07:44 PM Please respond to Struts Users Mailing List On Sat, 2003-03-29 at 02:46, Puneet Agarwal wrote: Unfortunately, this did not work, mostly because this will substitute the value at a later stage than required. I can't really help, if you don't specify your requirements. We need some other solution to this Any more clues !!! James Mitchell Suggested: Did you try this? bean:define id=myType bean:write name=txtInput /bean:define logic:iterate id=idDataClass property=vData type=%=myType% Original Problem Can this work logic:iterate id=idDataClass property=vData type=bean:write name=txtInput I want to give the type at run time to make a re-usable TILE for our application. Complete code is shown below. %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/struts-tiles prefix=tiles % html:html locale=true head html:base/ /head BODY class=BodyClass html:form name=FormTableRO action=/pages/TableRO.do type=com.tiger.inf.forms.FormTableRO logic:iterate id=idDataClass property=vData type=bean:write name=txtInput bean:write name=idDataClass property=time/ bean:write name=idDataClass property=day/ /logic:iterate /html:form /body /html:html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Mitchell Software Developer/Struts Evangelist http://www.open-tools.org - 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: [Logic Tag] Can This work
On Sat, 2003-03-29 at 02:46, Puneet Agarwal wrote: Unfortunately, this did not work, mostly because this will substitute the value at a later stage than required. I can't really help, if you don't specify your requirements. We need some other solution to this Any more clues !!! James Mitchell Suggested: Did you try this? bean:define id=myType bean:write name=txtInput /bean:define logic:iterate id=idDataClass property=vData type=%=myType% Original Problem Can this work logic:iterate id=idDataClass property=vData type=bean:write name=txtInput I want to give the type at run time to make a re-usable TILE for our application. Complete code is shown below. %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/struts-tiles prefix=tiles % html:html locale=true head html:base/ /head BODY class=BodyClass html:form name=FormTableRO action=/pages/TableRO.do type=com.tiger.inf.forms.FormTableRO logic:iterate id=idDataClass property=vData type=bean:write name=txtInput bean:write name=idDataClass property=time/ bean:write name=idDataClass property=day/ /logic:iterate /html:form /body /html:html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Mitchell Software Developer/Struts Evangelist http://www.open-tools.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Logic Tag] Can This work
Unfortunately, this did not work, mostly because this will substitute the value at a later stage than required. We need some other solution to this Any more clues !!! James Mitchell Suggested: Did you try this? bean:define id=myType bean:write name=txtInput /bean:define logic:iterate id=idDataClass property=vData type=%=myType% Original Problem Can this work logic:iterate id=idDataClass property=vData type=bean:write name=txtInput I want to give the type at run time to make a re-usable TILE for our application. Complete code is shown below. %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/struts-tiles prefix=tiles % html:html locale=true head html:base/ /head BODY class=BodyClass html:form name=FormTableRO action=/pages/TableRO.do type=com.tiger.inf.forms.FormTableRO logic:iterate id=idDataClass property=vData type=bean:write name=txtInput bean:write name=idDataClass property=time/ bean:write name=idDataClass property=day/ /logic:iterate /html:form /body /html:html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
logic tag addition proposal
While coding my new application in struts, I came across what I deam to be a missing feature in the struts taglibs. As I present the problem and the solution I came up with, hopefully it will become clear that this tag is a good idea. On a particular page, call it a profile page, I was putting together member information, which included a headshot, contact information and a description. My delimmea came when I created the html:img tag to the headshot. Since not every member had a headshot, the image would appear broken in the browser if it was missing (the headshot was just the member id + .jpg in the headshot directory. The problem was, there was no way for me to know (unless i kept an entry in the database and even that could get out of sync) whether or not the image existed before displaying it. If the image was missing, I would want to do something else, like either put a placeholder image in there or just display nothing. So I came up with an idea for a logic tag. It would look like the following logic:exists page=/assets/graphics/headshots/${member.id}/.jpg html:img page=/assets/graphics/headshots/${member.id}/.jpg/ /logic:exists * I am also thinking it might be nice if the tag also did a set call using the id and toScope like the bean define. Right now I have it in a taglib called file and hence I use file:exists but really, the view really shouldn't be moving around files, so there is not real need for a whole set of file taglibs. Below I have included the sourcecode, which I actually based off of the struts-el library since that is what I use in my application. Please provide any feedback and perhaps souce code changes to make this better. I really believe this should be part of the view and if I am the only one that thinks that, so be it, I will use my taglibs in silence. Dan p.s. I still need to do logic:notExists for this, but that is a small step. However, if someone feels it would be better to use core:choose and make this a test expression, that could be good too. I only started with java and struts 2 weeks ago, so I am still playing catchup understanding how the taglibs are made. package net.creativerge.taglib.file; import java.io.File; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.ConditionalTagBase; import org.apache.taglibs.standard.tag.common.core.NullAttributeException; import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; public class ELExistsTag extends ConditionalTagBase { /** * The module-relative path, starting with a slash character, of the * file to be checked by this tag. */ protected String page = null; /** * Getter method for page tag attribute */ public String getPage() { return this.page; } /** * Setter method for page tag attribute */ public void setPage(String page) { this.page = page; } /** * Instance variable mapped to page tag attribute */ private String pageExpr; /** * Getter method for page tag attribute */ public String getPageExpr() { return pageExpr; } /** * Setter method for page tag attribute */ public void setPageExpr(String pageExpr) { this.pageExpr = pageExpr; } /** * Resets attribute values for reuse */ public void release() { super.release(); setPageExpr(null); } /** * Process the start tag. * * @execption JspException if a jsp exception has occured */ public int doStartTag() throws JspException { evaluateExpressions(); return super.doStartTag(); } /** * Evaluates and returns a single attribute value, given the attribute * name, attribute value, and attribute type. It uses * codeExpressionUtil.evalNotNull/code to do the actual evaluation, and * it passes to this the name of the current tag, the codethis/code * pointer, and the current pageContext. * * @param attrName attribute name being evaluated * @param attrValue String value of attribute to be evaluated using EL * @param attrType Required resulting type of attribute value * @exception NullAttributeException if either the codeattrValue/code * was null, or the resulting evaluated value was null. * @return Resulting attribute value */ private Object evalAttr( String attrName, String attrValue, Class attrType ) throws JspException, NullAttributeException { return ExpressionUtil.evalNotNull(exists, attrName, attrValue, attrType, this, pageContext); } /** * Processes all attribute values which use the JSTL
Re: logic tag addition proposal
This kind of logic is better done in an Action, not in the view layer. David From: Dan Allen [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts-User List [EMAIL PROTECTED] Subject: logic tag addition proposal Date: Thu, 20 Mar 2003 08:23:26 -0600 While coding my new application in struts, I came across what I deam to be a missing feature in the struts taglibs. As I present the problem and the solution I came up with, hopefully it will become clear that this tag is a good idea. On a particular page, call it a profile page, I was putting together member information, which included a headshot, contact information and a description. My delimmea came when I created the html:img tag to the headshot. Since not every member had a headshot, the image would appear broken in the browser if it was missing (the headshot was just the member id + .jpg in the headshot directory. The problem was, there was no way for me to know (unless i kept an entry in the database and even that could get out of sync) whether or not the image existed before displaying it. If the image was missing, I would want to do something else, like either put a placeholder image in there or just display nothing. So I came up with an idea for a logic tag. It would look like the following logic:exists page=/assets/graphics/headshots/${member.id}/.jpg html:img page=/assets/graphics/headshots/${member.id}/.jpg/ /logic:exists * I am also thinking it might be nice if the tag also did a set call using the id and toScope like the bean define. Right now I have it in a taglib called file and hence I use file:exists but really, the view really shouldn't be moving around files, so there is not real need for a whole set of file taglibs. Below I have included the sourcecode, which I actually based off of the struts-el library since that is what I use in my application. Please provide any feedback and perhaps souce code changes to make this better. I really believe this should be part of the view and if I am the only one that thinks that, so be it, I will use my taglibs in silence. Dan p.s. I still need to do logic:notExists for this, but that is a small step. However, if someone feels it would be better to use core:choose and make this a test expression, that could be good too. I only started with java and struts 2 weeks ago, so I am still playing catchup understanding how the taglibs are made. package net.creativerge.taglib.file; import java.io.File; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.ConditionalTagBase; import org.apache.taglibs.standard.tag.common.core.NullAttributeException; import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; public class ELExistsTag extends ConditionalTagBase { /** * The module-relative path, starting with a slash character, of the * file to be checked by this tag. */ protected String page = null; /** * Getter method for page tag attribute */ public String getPage() { return this.page; } /** * Setter method for page tag attribute */ public void setPage(String page) { this.page = page; } /** * Instance variable mapped to page tag attribute */ private String pageExpr; /** * Getter method for page tag attribute */ public String getPageExpr() { return pageExpr; } /** * Setter method for page tag attribute */ public void setPageExpr(String pageExpr) { this.pageExpr = pageExpr; } /** * Resets attribute values for reuse */ public void release() { super.release(); setPageExpr(null); } /** * Process the start tag. * * @execption JspException if a jsp exception has occured */ public int doStartTag() throws JspException { evaluateExpressions(); return super.doStartTag(); } /** * Evaluates and returns a single attribute value, given the attribute * name, attribute value, and attribute type. It uses * codeExpressionUtil.evalNotNull/code to do the actual evaluation, and * it passes to this the name of the current tag, the codethis/code * pointer, and the current pageContext. * * @param attrName attribute name being evaluated * @param attrValue String value of attribute to be evaluated using EL * @param attrType Required resulting type of attribute value * @exception NullAttributeException if either the codeattrValue/code * was null, or the resulting evaluated value was null. * @return Resulting attribute value */ private Object evalAttr( String attrName, String attrValue, Class attrType ) throws JspException, NullAttributeException { return ExpressionUtil.evalNotNull(exists, attrName, attrValue, attrType, this, pageContext
Re: logic tag addition proposal
David Graham ([EMAIL PROTECTED]) wrote: This kind of logic is better done in an Action, not in the view layer. David I disagree in this case. Assets should only be the concern of the view and sometimes, the view has to make sure that a certain state exists before it can display the asset. For instance, if the view expects a background graphic to be setup in the action, it might need to verify it exists to ensure that it does not break what it is displaying. To me this makes perfect sense as a precaution against a bad view component. The direct path shouldn't be checked in the action because the action wouldn't necessarily know the base location for the asset. Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, [EMAIL PROTECTED] http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Real programmers just hate to get up in the morning, and contrary to Ordinary People, they're in better shape as it gets closer to nighttime. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic tag addition proposal
Actions are where most of this logic should be. Instead of a taglib for this you could more easily have the Action check for the image's existence and store a boolean in the request. Your jsp would look like: c:if test=imageExists == true display image /c:if David From: Dan Allen [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: logic tag addition proposal Date: Thu, 20 Mar 2003 09:48:26 -0600 David Graham ([EMAIL PROTECTED]) wrote: This kind of logic is better done in an Action, not in the view layer. David I disagree in this case. Assets should only be the concern of the view and sometimes, the view has to make sure that a certain state exists before it can display the asset. For instance, if the view expects a background graphic to be setup in the action, it might need to verify it exists to ensure that it does not break what it is displaying. To me this makes perfect sense as a precaution against a bad view component. The direct path shouldn't be checked in the action because the action wouldn't necessarily know the base location for the asset. Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, [EMAIL PROTECTED] http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Real programmers just hate to get up in the morning, and contrary to Ordinary People, they're in better shape as it gets closer to nighttime. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic tag addition proposal
David Graham ([EMAIL PROTECTED]) wrote: This kind of logic is better done in an Action, not in the view layer. David I disagree in this case. Assets should only be the concern of the view and sometimes, the view has to make sure that a certain state exists before it can display the asset. For instance, if the view expects a background graphic to be setup in the action, it might need to verify it exists to ensure that it does not break what it is displaying. To me this makes perfect sense as a precaution against a bad view component. The direct path shouldn't be checked in the action because the action wouldn't necessarily know the base location for the asset. An action would have to take the upload of the file, and copy it just so it's ${menbername}.jpg, and then put it in the right directoy. An action knows how to do this, why wouldn't the application then know how to find it?... If the image is able to be changed by the client, the Action would have to know where it is to find it and replace it. Actions have to know where the image is. Arron. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help in Logic Tag
i want to be able to show a message like No records found is there was no records found or logic/iterate did not do any iteration. Can anybody provide us a solution to this kind of problem? thanks a lot!. i have this in my JSP: logic:iterate id=referralsInfo name=referralsinfos tr td width=0%nbsp;/td td width=15% class=tablecontentdata nbsp;bean:write name=referralsInfo property=lastname/ /td td width=16% class=tablecontentdata nbsp;bean:write name=referralsInfo property=name/ /td td width=11% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mi/ /td td width=14% class=tablecontentdata nbsp;bean:write name=referralsInfo property=phone/ /td td width=19% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mobile/ /td td width=25%nbsp;/td /tr /logic:iterate
Re: Help in Logic Tag
I do something like this: app:MemberSelect id=memberVectorORDER BY LASTNAME, FIRSTNAME/app:MemberSelect logic:present name=memberVector logic:iterate id=member type=classname here name=memberVector do stuff here /logic:iterate /logic:present logic:notpresent Whine here /logic:notpresent The trick is that the MemberSelectTag returns null, not an empty Vector, if it doesn't find any matching records. - Original Message - From: Richard Raquepo [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, February 20, 2003 10:04 PM Subject: Help in Logic Tag i want to be able to show a message like No records found is there was no records found or logic/iterate did not do any iteration. Can anybody provide us a solution to this kind of problem? thanks a lot!. i have this in my JSP: logic:iterate id=referralsInfo name=referralsinfos tr td width=0%nbsp;/td td width=15% class=tablecontentdata nbsp;bean:write name=referralsInfo property=lastname/ /td td width=16% class=tablecontentdata nbsp;bean:write name=referralsInfo property=name/ /td td width=11% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mi/ /td td width=14% class=tablecontentdata nbsp;bean:write name=referralsInfo property=phone/ /td td width=19% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mobile/ /td td width=25%nbsp;/td /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help in Logic Tag
With Struts tags: bean:size name=list id=collectionSize / logic:greaterThan name=collectionSize value=0 logic:iterate ... ... /logic:iterate /logic:greaterThan logic:equal name=collectionSize value=0 ... /logic:equal -Original Message- From: Richard Raquepo [mailto:[EMAIL PROTECTED]] Sent: Friday, 21 February 2003 2:05 PM To: Struts Users Mailing List Subject: Help in Logic Tag i want to be able to show a message like No records found is there was no records found or logic/iterate did not do any iteration. Can anybody provide us a solution to this kind of problem? thanks a lot!. i have this in my JSP: logic:iterate id=referralsInfo name=referralsinfos tr td width=0%nbsp;/td td width=15% class=tablecontentdata nbsp;bean:write name=referralsInfo property=lastname/ /td td width=16% class=tablecontentdata nbsp;bean:write name=referralsInfo property=name/ /td td width=11% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mi/ /td td width=14% class=tablecontentdata nbsp;bean:write name=referralsInfo property=phone/ /td td width=19% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mobile/ /td td width=25%nbsp;/td /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help in Logic Tag
i have this code but i have an error Cannot find bean referralsinfo in any scope my referralsinfo is in my request session and i know its working cause i can use it in my logic:iterate tag. what seems to be the problem? Here's some of my jsp code . logic:iterate id=referralsInfo name=referralsinfos .. /logic:iterate bean:size id=size name=referralsinfo/ logic:equal name=size value=0 tr td colspan=7 class=tablecontentdata No record(s) found! /td /tr /logic:equal Am i doing things right? Thanks -Richard - Original Message - From: Todd Pierce [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 21, 2003 11:07 AM Subject: RE: Help in Logic Tag With Struts tags: bean:size name=list id=collectionSize / logic:greaterThan name=collectionSize value=0 logic:iterate ... ... /logic:iterate /logic:greaterThan logic:equal name=collectionSize value=0 ... /logic:equal -Original Message- From: Richard Raquepo [mailto:[EMAIL PROTECTED]] Sent: Friday, 21 February 2003 2:05 PM To: Struts Users Mailing List Subject: Help in Logic Tag i want to be able to show a message like No records found is there was no records found or logic/iterate did not do any iteration. Can anybody provide us a solution to this kind of problem? thanks a lot!. i have this in my JSP: logic:iterate id=referralsInfo name=referralsinfos tr td width=0%nbsp;/td td width=15% class=tablecontentdata nbsp;bean:write name=referralsInfo property=lastname/ /td td width=16% class=tablecontentdata nbsp;bean:write name=referralsInfo property=name/ /td td width=11% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mi/ /td td width=14% class=tablecontentdata nbsp;bean:write name=referralsInfo property=phone/ /td td width=19% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mobile/ /td td width=25%nbsp;/td /tr /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help in Logic Tag
Got it! Thanks everyone! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help in Logic Tag
get rid of this line bean:size id=size name=referralsinfo/ try this logic:equal name=referralsinfo property=size value=0 tr td colspan=7 class=tablecontentdata No record(s) found! /td /tr /logic:equal chaks. -Original Message- From: Richard Raquepo [mailto:[EMAIL PROTECTED]] Sent: Friday, 21 February 2003 2:57 PM To: Struts Users Mailing List Subject: Re: Help in Logic Tag i have this code but i have an error Cannot find bean referralsinfo in any scope my referralsinfo is in my request session and i know its working cause i can use it in my logic:iterate tag. what seems to be the problem? Here's some of my jsp code . logic:iterate id=referralsInfo name=referralsinfos .. /logic:iterate bean:size id=size name=referralsinfo/ logic:equal name=size value=0 tr td colspan=7 class=tablecontentdata No record(s) found! /td /tr /logic:equal Am i doing things right? Thanks -Richard - Original Message - From: Todd Pierce [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, February 21, 2003 11:07 AM Subject: RE: Help in Logic Tag With Struts tags: bean:size name=list id=collectionSize / logic:greaterThan name=collectionSize value=0 logic:iterate ... ... /logic:iterate /logic:greaterThan logic:equal name=collectionSize value=0 ... /logic:equal -Original Message- From: Richard Raquepo [mailto:[EMAIL PROTECTED]] Sent: Friday, 21 February 2003 2:05 PM To: Struts Users Mailing List Subject: Help in Logic Tag i want to be able to show a message like No records found is there was no records found or logic/iterate did not do any iteration. Can anybody provide us a solution to this kind of problem? thanks a lot!. i have this in my JSP: logic:iterate id=referralsInfo name=referralsinfos tr td width=0%nbsp;/td td width=15% class=tablecontentdata nbsp;bean:write name=referralsInfo property=lastname/ /td td width=16% class=tablecontentdata nbsp;bean:write name=referralsInfo property=name/ /td td width=11% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mi/ /td td width=14% class=tablecontentdata nbsp;bean:write name=referralsInfo property=phone/ /td td width=19% class=tablecontentdata nbsp;bean:write name=referralsInfo property=mobile/ /td td width=25%nbsp;/td /tr /logic:iterate - 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]
logic tag and %= % HELP!
Regardless of the value of logic:present tag, the expression %=details.getValue()% gets evaluated. Does %= % take precedence over logic:present or any custom tag ?? example: logic:present name=details scope=request %=details.getValue() % /logic:present the scriplet between the tag get executed regardless of outcome of the logic tag. So, if details is NOT in request, form, I get an error: details does not exist... etc... Any help would be appreciated! Khalid
RE: logic tag and %= % HELP!
wouldn't using bean:write instead of using the %= % part solve your problem or am i trying to make this too simple??? -Original Message- From: Khalid K. [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 4:21 PM To: [EMAIL PROTECTED] Subject: logic tag and %= % HELP! Regardless of the value of logic:present tag, the expression %=details.getValue()% gets evaluated. Does %= % take precedence over logic:present or any custom tag ?? example: logic:present name=details scope=request %=details.getValue() % /logic:present the scriplet between the tag get executed regardless of outcome of the logic tag. So, if details is NOT in request, form, I get an error: details does not exist... etc... Any help would be appreciated! Khalid -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: logic tag and %= % HELP!
This might work better for you: logic:present name=details scope=request bean:write name=details property=value/ /logic:present -Original Message- From: Khalid K. [mailto:[EMAIL PROTECTED]] Sent: Friday, January 24, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: logic tag and %= % HELP! Regardless of the value of logic:present tag, the expression %=details.getValue()% gets evaluated. Does %= % take precedence over logic:present or any custom tag ?? example: logic:present name=details scope=request %=details.getValue() % /logic:present the scriplet between the tag get executed regardless of outcome of the logic tag. So, if details is NOT in request, form, I get an error: details does not exist... etc... Any help would be appreciated! Khalid -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Checking boolean values with a logic tag
Hi, How do I check a boolean value of a method/bean using the logic tags. Can Struts-El do this? Essentially I have a method called getXYZ() that returns a boolean value. I can't change the name of the method to isXYZ so I have to leave it as is. thanks Jordan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Checking boolean values with a logic tag
2003. január 22. 12:03 dátummal Jordan Thomas ezt írtad: Hi, How do I check a boolean value of a method/bean using the logic tags. Can Struts-El do this? Essentially I have a method called getXYZ() that returns a boolean value. I can't change the name of the method to isXYZ so I have to leave it as is. logic:equal name=someBean property=XYZ value=true Tib -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
how to use ApplicationResources from the logic tag
hi, i'm trying to use a value set in my ApplicationResources.properties file to use in a logic:equal tag in my jsp. basically, i'm trying to store some configuration parameters in the ApplicationResources.properties file, but i can't figure out how to get them outside of bean:message. is there a direct method for using a property in the logic tag? thanks, /gp -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Need to make Logic Tag
Can someone please help me out I need. I need to make my first logic tag like the one below logic:checkuser myrole=client You are a client /logic:checkuser Any tips or samples would be great. I have to get this done fast -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need to make Logic Tag
use logic:present role=client blah, blah /logic:present Kurt Madel Programmer, CSMi (703) 823-4300 ext. 170 -Original Message- From: Smith, Johnathan M. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 8:18 AM To: '[EMAIL PROTECTED]' Subject: Need to make Logic Tag Can someone please help me out I need. I need to make my first logic tag like the one below logic:checkuser myrole=client You are a client /logic:checkuser Any tips or samples would be great. I have to get this done fast -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need to make Logic Tag
Have a look at the one in the struts example application. That should get you started. -Original Message- From: Smith, Johnathan M. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 20:18 To: '[EMAIL PROTECTED]' Subject: Need to make Logic Tag Can someone please help me out I need. I need to make my first logic tag like the one below logic:checkuser myrole=client You are a client /logic:checkuser Any tips or samples would be great. I have to get this done fast -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need to make Logic Tag
Hi, i'm not sure if this is what you need. But here is an example for free use and uses the container managed security model (in our app we use the SecurityFilter impl from SourceForge.com): This is an excerpt of the tag class: package com.company.taglib; ... public class UserInRolesTag extends BodyTagSupport { String roles; public int doStartTag() throws JspException { StringTokenizer st = new StringTokenizer(roles, ,); HttpServletRequest r = (HttpServletRequest) pageContext.getRequest(); String role; while(st.hasMoreElements()){ role = (String) st.nextElement(); if(r.isUserInRole(role)) return BodyTag.EVAL_BODY_INCLUDE; } return BodyTag.SKIP_BODY; } public void setRoles(String roles) { this.roles = roles; } } And here is the taglib entry: tag nameuserInRoles/name tagclasscom.company.taglib.UserInRolesTag/tagclass bodycontentJSP/bodycontent attribute nameroles/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute /tag For example this tag in a jsp will evaluate the body only if the current user is in one of the given roles: app:userInRoles roles=admin,app-user bla bla /app:userInRoles Hope it helps. Sincerely Çetin Ergen -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Need to make Logic Tag
If you are using container managed security, then all you need to use is the logic:present role=role1, role2 tag. It is already part of Struts 1.1 Kurt Madel Programmer, CSMi (703) 823-4300 ext. 170 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 9:25 AM To: [EMAIL PROTECTED] Subject: RE: Need to make Logic Tag Hi, i'm not sure if this is what you need. But here is an example for free use and uses the container managed security model (in our app we use the SecurityFilter impl from SourceForge.com): This is an excerpt of the tag class: package com.company.taglib; ... public class UserInRolesTag extends BodyTagSupport { String roles; public int doStartTag() throws JspException { StringTokenizer st = new StringTokenizer(roles, ,); HttpServletRequest r = (HttpServletRequest) pageContext.getRequest(); String role; while(st.hasMoreElements()){ role = (String) st.nextElement(); if(r.isUserInRole(role)) return BodyTag.EVAL_BODY_INCLUDE; } return BodyTag.SKIP_BODY; } public void setRoles(String roles) { this.roles = roles; } } And here is the taglib entry: tag nameuserInRoles/name tagclasscom.company.taglib.UserInRolesTag/tagclass bodycontentJSP/bodycontent attribute nameroles/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute /tag For example this tag in a jsp will evaluate the body only if the current user is in one of the given roles: app:userInRoles roles=admin,app-user bla bla /app:userInRoles Hope it helps. Sincerely Çetin Ergen -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Antwort: RE: Need to make Logic Tag
Hi, you are right. I've tried the present tag at the beginning of our dev. But had no success with applying multiple roles. After your posting today i tried again. No success again, until i recognized that the tag is not trimming the role strings. So if you use for example logic:present role =role1, role2 and youre user is only in role2 the body isn't evaluated. You must omit the space(s) (right syntax for our example: logic:present role=role1,role2). Thats why i've written my own tag. Thx Çetin Ergen -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
Thanks for pointing out, you are right Chris I did not include logic tag lib, I should have thought of this before. Now, I tried other ways as suggested by other members of the forum (at least now I get Exception :)) (a) logic:notPresent property='mytaglib:getvalue name=cost /' FREE /logic:notPresent javax.servlet.ServletException: No selector attribute (cookie/header/name/parameter) was specified at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:471) (b) logic:notPresent property=mytaglib:getvalue name=cost / FREE /logic:notPresent org.apache.jasper.compiler.ParseException: /test.jsp(66,62) Attribute name has no value So Chris, looks like you are right here as well, nested tags do not work.. It would seem to me that the only option that I have now is to use a scripting variable in my tag lib, and use that scripting variable in the JSP to print FREE based on the value of that scripting variable. Are there any other elegant ways of doing this ?? Many Thanks, Tejas -Original Message- From: Bartley, Chris P [PCS] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 6:59 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag This sort of approach... logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent ...will not work because you can't nest XML tags like that (a tag within an attribute). Most JSP compilers blow up when they see stuff like that. Since yours apparently didn't AND since you said that FREE is always getting printed, i'm willing to bet that you forgot to import the logic and/or mytaglib tag libraries. Tip: whenever i see weird behavior like this, the first thing i do is check the source of the resulting HTML. If there are JSP tags in there then i know for sure that i forgot a taglib import (a good IDE should highlight errors like that...plugmy IDE of choice is IntelliJ IDEA/plug). chris -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:31 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Hi again, Thanks for the pointer. I tried the following two variations of codes, however, the results were same as per the earlier email. logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent logic:notPresent property=mytaglib:getvalue name=cost / FREE /logic:notPresent The getValue tag returns a String object. Is something wrong with this code ? Also, one more doubt is if the property attribute that I have used in the above code for isPresent tag, is it the correct use ? As the value I want to check comes from my own tag library. If I cannot achieve this using the logic taglib, is there another elegant way to do this ? Many Thanks, Tejas -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 5:49 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Use logic:isPresent instead. Mark -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 11:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Logic tag
Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
Use logic:isPresent instead. Mark -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 11:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
Hi again, Thanks for the pointer. I tried the following two variations of codes, however, the results were same as per the earlier email. logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent logic:notPresent property=mytaglib:getvalue name=cost / FREE /logic:notPresent The getValue tag returns a String object. Is something wrong with this code ? Also, one more doubt is if the property attribute that I have used in the above code for isPresent tag, is it the correct use ? As the value I want to check comes from my own tag library. If I cannot achieve this using the logic taglib, is there another elegant way to do this ? Many Thanks, Tejas -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 5:49 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Use logic:isPresent instead. Mark -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 11:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
This sort of approach... logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent ...will not work because you can't nest XML tags like that (a tag within an attribute). Most JSP compilers blow up when they see stuff like that. Since yours apparently didn't AND since you said that FREE is always getting printed, i'm willing to bet that you forgot to import the logic and/or mytaglib tag libraries. Tip: whenever i see weird behavior like this, the first thing i do is check the source of the resulting HTML. If there are JSP tags in there then i know for sure that i forgot a taglib import (a good IDE should highlight errors like that...plugmy IDE of choice is IntelliJ IDEA/plug). chris -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 12:31 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Hi again, Thanks for the pointer. I tried the following two variations of codes, however, the results were same as per the earlier email. logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent logic:notPresent property=mytaglib:getvalue name=cost / FREE /logic:notPresent The getValue tag returns a String object. Is something wrong with this code ? Also, one more doubt is if the property attribute that I have used in the above code for isPresent tag, is it the correct use ? As the value I want to check comes from my own tag library. If I cannot achieve this using the logic taglib, is there another elegant way to do this ? Many Thanks, Tejas -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 5:49 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Use logic:isPresent instead. Mark -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 11:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
Try it with the property= value in single quotes. -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 1:31 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Hi again, Thanks for the pointer. I tried the following two variations of codes, however, the results were same as per the earlier email. logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent logic:notPresent property=mytaglib:getvalue name=cost / FREE /logic:notPresent The getValue tag returns a String object. Is something wrong with this code ? Also, one more doubt is if the property attribute that I have used in the above code for isPresent tag, is it the correct use ? As the value I want to check comes from my own tag library. If I cannot achieve this using the logic taglib, is there another elegant way to do this ? Many Thanks, Tejas -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 5:49 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Use logic:isPresent instead. Mark -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 11:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
Hi, AFAIK, nesting jsp tags inside attributes of other jsp tags does not work. peace, Joe -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 10:31 AM To: 'Struts Users Mailing List' Subject: RE: Logic tag Hi again, Thanks for the pointer. I tried the following two variations of codes, however, the results were same as per the earlier email. logic:isPresent property=mytaglib:getvalue name=cost / FREE /logic:isPresent logic:notPresent property=mytaglib:getvalue name=cost / FREE /logic:notPresent The getValue tag returns a String object. Is something wrong with this code ? Also, one more doubt is if the property attribute that I have used in the above code for isPresent tag, is it the correct use ? As the value I want to check comes from my own tag library. If I cannot achieve this using the logic taglib, is there another elegant way to do this ? Many Thanks, Tejas -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 5:49 PM To: 'Struts Users Mailing List' Subject: RE: Logic tag Use logic:isPresent instead. Mark -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 11:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
You'll need to do this: bean:define id=costmytaglib:getvalue name=cost //bean:define logic:empty name=cost FREE /logic:empty logic:notEmpty name=cost bean:write name=cost/ /logic:notEmpty To test if a value is empty, you need to have something to test against. Since your tag is just writing out the value, you need to capture that value first, by defining a bean for it. Since the value of your output will never be null, you cannot use logic:present to check it; you need to use logic:empty instead. -- Martin Cooper -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 8:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Logic tag
Pardon me for jumping into this thread... Once you use bean:define, is it possible to change the value? I wanted to use bean:define like this: bean:define id=resultsEmpty value=true/ logic:iterate id=code name=myForm property=codeList type=Foo bean:define id=resultsEmpty value=false/ bean:write name=code property=desc/ /logic:iterate logic:equal property=resultsEmpty value=true No records found. /logic:equal This didn't work. It barfed on the second bean:define, but I have a feeling the logic:equal won't work either. Bryan - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, September 20, 2002 12:52 PM Subject: RE: Logic tag You'll need to do this: bean:define id=costmytaglib:getvalue name=cost //bean:define logic:empty name=cost FREE /logic:empty logic:notEmpty name=cost bean:write name=cost/ /logic:notEmpty To test if a value is empty, you need to have something to test against. Since your tag is just writing out the value, you need to capture that value first, by defining a bean for it. Since the value of your output will never be null, you cannot use logic:present to check it; you need to use logic:empty instead. -- Martin Cooper -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 8:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Logic tag
-Original Message- From: Bryan Hilterbrand [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 2:14 PM To: Struts Users Mailing List Subject: Re: Logic tag Pardon me for jumping into this thread... Once you use bean:define, is it possible to change the value? I wanted to use bean:define like this: bean:define id=resultsEmpty value=true/ logic:iterate id=code name=myForm property=codeList type=Foo bean:define id=resultsEmpty value=false/ bean:write name=code property=desc/ /logic:iterate logic:equal property=resultsEmpty value=true No records found. /logic:equal This didn't work. It barfed on the second bean:define, but I have a feeling the logic:equal won't work either. You can't redefine a bean of the same name on the same page. But you can do what you want more easily than that, as long as the collection you are iterating over implements java.util.Collection (or extends something that does): logic:empty name=myForm property=codelist No records found. /logic:empty -- Martin Cooper Bryan - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, September 20, 2002 12:52 PM Subject: RE: Logic tag You'll need to do this: bean:define id=costmytaglib:getvalue name=cost //bean:define logic:empty name=cost FREE /logic:empty logic:notEmpty name=cost bean:write name=cost/ /logic:notEmpty To test if a value is empty, you need to have something to test against. Since your tag is just writing out the value, you need to capture that value first, by defining a bean for it. Since the value of your output will never be null, you cannot use logic:present to check it; you need to use logic:empty instead. -- Martin Cooper -Original Message- From: Tejas Bavishi [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 8:55 AM To: '[EMAIL PROTECTED]' Subject: Logic tag Hi, I have a question on using logic tags. In the following example, mytaglib is the tag library developed by me. I am printing the value returned by the following tag on the JSP page. TD mytaglib:getvalue name=cost / /TD Now, I want to check that if the value returned by mytag is , then I want to print FREE. I tried the following code. logic:equal property=mytaglib:getvalue name=cost / value= FREE /logic:equal But the text FREE is printed regardless of the value returned by mytag. Obviously, I am doing something wrong or my approach is not correct. Can someone please guide me on this. Many Thanks, Tejas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Logic tag
Thanks for the answer -- I should have seen that one. Bryan - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, September 20, 2002 4:04 PM Subject: RE: Logic tag You can't redefine a bean of the same name on the same page. But you can do what you want more easily than that, as long as the collection you are iterating over implements java.util.Collection (or extends something that does): logic:empty name=myForm property=codelist No records found. /logic:empty -- Martin Cooper -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: logic tag to check value of bean
thanks Keith, you are write, now it works!! (wrong bean name, I was using the objekt name instead of the stored variable name within the session context!) Rainer I don't see why that wouldn't work. I use the same syntax, the only difference is that I don't put scope=session. I suppose you could try it without specifying the scope, but I don't think it would make much of a difference. What is the error message? Do you import the logic taglib at the top of your jsp? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: rainer juenger [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:20 AM To: Struts Users Mailing List Subject: logic tag to check value of bean Hi, can I compare an attribute value of a bean with the logic TagLib? eg.: my beans name is myobject and it has session scope Wirthin that bean there is an attribute: boolean myattribute = true; There is of course a setter and a getter for that attribute. How would the logic tag look like?? My suggestion that doesn't work: logic:equal name=myobject property=myattribute scope=session value=true my output /logic:equal thanks!! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
logic tag to check value of bean
Hi, can I compare an attribute value of a bean with the logic TagLib? eg.: my beans name is myobject and it has session scope Wirthin that bean there is an attribute: boolean myattribute = true; There is of course a setter and a getter for that attribute. How would the logic tag look like?? My suggestion that doesn't work: logic:equal name=myobject property=myattribute scope=session value=true my output /logic:equal thanks!!
RE: logic tag to check value of bean
I don't see why that wouldn't work. I use the same syntax, the only difference is that I don't put scope=session. I suppose you could try it without specifying the scope, but I don't think it would make much of a difference. What is the error message? Do you import the logic taglib at the top of your jsp? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: rainer juenger [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:20 AM To: Struts Users Mailing List Subject: logic tag to check value of bean Hi, can I compare an attribute value of a bean with the logic TagLib? eg.: my beans name is myobject and it has session scope Wirthin that bean there is an attribute: boolean myattribute = true; There is of course a setter and a getter for that attribute. How would the logic tag look like?? My suggestion that doesn't work: logic:equal name=myobject property=myattribute scope=session value=true my output /logic:equal thanks!! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
logic tag to check value of bean
Hi, can I compare an attribute value of a bean with the logic TagLib? eg.: my beans name is myobject and it has session scope Wirthin that bean there is an attribute: boolean myattribute = true; There is of course a setter and a getter for that attribute. How would the logic tag look like?? My suggestion that doesn't work: logic:equal name=myobject property=myattribute scope=session value=true my output /logic:equal thanks!! Rainer
Re: multiple values to check in logic tag?
This probably isn't what you want to hear, but this sounds like a great time to extend the logic tags in your own application and create your own Custom tag. There are a couple of examples in the example application. Adrian --- Rick Reumann [EMAIL PROTECTED] wrote: Is there a way to check multiple values on one line using such logic tags like notEqual or present ? I'm trying to convert a JSP over using struts tags and it's not going so well because I end up having all these logic tags all nested within each other. For example say I don't want to display a row of state information if the database query comes back missing a city, state, or zip code. In my page I have: if ( city != null state != null zip != null) { out.println( city + , +state + +zip+BR); } How do I accomplish the above in a clean fashion using the logic tags? It gets even worse when I have to accomplish: if ( manLastName != null !manLastName.equals(DUMMY) manFirstName != null !manFirstName.equals(DUMMY) ) { out.println( MP: +manFirstName + + manLastName+BR); } Ideally it would be nice if you could pass multiple parameters into a logic property attribute like... logic:notEqual name=store property=state,city,areaCode value= Which in the above would check all of those properties for not being an empty string? Is what I'm asking for possible with in struts? Thanks for any help. -- Rick mailto:[EMAIL PROTECTED] The memories of my family outings are still a source of strength to me. I remember we'd all pile into the car - I forget what kind it was - and drive and drive. I'm not sure where we'd go, but I think there were some trees there. The smell of something was strong in the air as we played whatever sport we played. I remember a bigger, older guy we called Dad.' We'd eat some stuff, or not, and then I think we went home. I guess some things never leave you. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] http://messenger.yahoo.com.au - Yahoo! Messenger - A great way to communicate long-distance for FREE! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: logic tag: checking presense of key or value in a map?
Torgeir Veimo wrote: Is there a simple way of checking wether a map contains a given key or value? I tried something like logic:equal name=child property=properties.key value=keyname /logic:equal I guess I have to do this myself. I need a logic:containsKey value= and logic:containsValue value=. -- -Torgeir -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
logic tag: checking presense of key or value in a map?
Is there a simple way of checking wether a map contains a given key or value? I tried something like logic:equal name=child property=properties.key value=keyname /logic:equal but I'm not shure if what I'm trying to do is supported. (The child bean has a method Map getProperties().) -- -Torgeir -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
logic tag
Hi how can I compare two variables which are stored in my session attribute by using the logic tag. As what I know is the logic:equal / or any other comparison tag compares the value with a constant. any suggestions. Thanks Amit -Original Message- From: Boyalla, Raveendra [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 11:58 AM To: '[EMAIL PROTECTED]' Subject: How do I use onblur for text tag Hi How do I use onBlur for text tag Thank you Raveendra -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: logic tag
no response from any one so far -Original Message- From: Dua, Amit Sent: Friday, February 22, 2002 12:03 PM To: 'Struts Users Mailing List' Subject: logic tag Hi how can I compare two variables which are stored in my session attribute by using the logic tag. As what I know is the logic:equal / or any other comparison tag compares the value with a constant. any suggestions. Thanks Amit -Original Message- From: Boyalla, Raveendra [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 11:58 AM To: '[EMAIL PROTECTED]' Subject: How do I use onblur for text tag Hi How do I use onBlur for text tag Thank you Raveendra -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Struts logic tag lib question
Hi, To check if an object is null or not in MVC2 model I followed below code, Object obj1= new Object(); if(obj1==null){ //do some }else{ //do some } How do i exactly use logic tag lib in above case.I tried with empty/notEmpty and present/notPresent tags but I got exception empty/nonEmpty tag descriptions are not found Can any one help me out in this? TAI RAYAKU -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Struts logic tag lib question
Hi, I am here again, Is there any way to compare an object is null?? if( myObject==null){ ] using struts logic tag. TAI RAYAKU -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to use an expression in a logic tag?
Hello, I am using logic tags to implement paging through a recordset (like in a search engine). In order to determine whether or not to display the next page button (i.e. when the user is nearing the end of the recordset) it seems I need an expression in my logic:greaterEqual tag. I have a bean that contains these properties: maxRecords: Number of records to display per page rowPosition:index number of the first row on this page I also have the value totalRecords, which is passed into the request object in my action class. It is not a property of the form bean. I need to do something like: logic:greaterEqual name=MyFormBean property=SEE BELOW value=%= totalRecords % input type=submit name=next value=Next Page /logic:greaterEqual Where the property would actually need to be an expression like rowPosition + maxRecords Does anyone know how I could do this? Thanks! Tom -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to use an expression in a logic tag?
Add a property on your bean that returns the value of maxRecords + rowPosition then refer to that property in the tag. -Original Message- From: T. Wheeler [mailto:[EMAIL PROTECTED]] Sent: Friday, December 21, 2001 3:19 PM To: [EMAIL PROTECTED] Subject: How to use an expression in a logic tag? Hello, I am using logic tags to implement paging through a recordset (like in a search engine). In order to determine whether or not to display the next page button (i.e. when the user is nearing the end of the recordset) it seems I need an expression in my logic:greaterEqual tag. I have a bean that contains these properties: maxRecords: Number of records to display per page rowPosition:index number of the first row on this page I also have the value totalRecords, which is passed into the request object in my action class. It is not a property of the form bean. I need to do something like: logic:greaterEqual name=MyFormBean property=SEE BELOW value=%= totalRecords % input type=submit name=next value=Next Page /logic:greaterEqual Where the property would actually need to be an expression like rowPosition + maxRecords Does anyone know how I could do this? Thanks! Tom -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Logic Tag question
Hi, Any ideas on what tag, or how to compare to attributes from my form bean? Typically I would do logic:greaterThan property=number value=7 A little lower... /logic:greaterThan But, I need to see to compare two properties. Thanks, Beth. This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by reply e-mail, and delete or destroy the message. Thank you. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: HowTo: How can I acces the index of a iterator-tag within a logic-tag ?
Use indexId, logic:iterate id=bean name=formBean property=list indexId=myIndex logic:greaterThan name=myIndex value=0 At 12:46 pm 26-10-2001 +0200, you wrote: Hi, How can I acces the index of a iterator-tag within a logic-tag ? logic:iterate id=bean name=formBean property=list logic:greaterThan ? Index over 0 /logic:greaterThan /logic:iterate THANKS ! -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610 Scioworks Camino - Rapid WebApp Assembly for Struts
HowTo: How can I acces the index of a iterator-tag within a logic-tag ?
Hi, How can I acces the index of a iterator-tag within a logic-tag ? logic:iterate id=bean name=formBean property=list logic:greaterThan ? Index over 0 /logic:greaterThan /logic:iterate THANKS !
logic tag and empty string value () problem
Hi, the following declaration does not compile on iPlanet 6.0 SP2: logic:equal name=something value= ... /logic:equal here's a snippet of the generated java file: ((org.apache.struts.taglib.logic.EqualTag)_JSP__0).setName(sqc_submenu_ currentitem); ((org.apache.struts.taglib.logic.EqualTag)_JSP__0).setValue( td width=); It's like the JSP parser does not like empty string in tag attributes... anybody had this problem before with iPlanet? any workaround? Thanks Andre Paradis
Re: logic tag and empty string value () problem
The workaround is to use a scriplet: logic:equal name=something value=%=% kinda silly - but it works! --- Paradis,_André [EMAIL PROTECTED] wrote: Hi, the following declaration does not compile on iPlanet 6.0 SP2: logic:equal name=something value= ... /logic:equal here's a snippet of the generated java file: ((org.apache.struts.taglib.logic.EqualTag)_JSP__0).setName(sqc_submenu_ currentitem); ((org.apache.struts.taglib.logic.EqualTag)_JSP__0).setValue( td width=); It's like the JSP parser does not like empty string in tag attributes... anybody had this problem before with iPlanet? any workaround? Thanks Andre Paradis __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
RE: logic tag and empty string value () problem
Thanks matt, Is it fixed in SP3 ? -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED]] Sent: September 4, 2001 10:53 AM To: [EMAIL PROTECTED] Subject: Re: logic tag and empty string value () problem The workaround is to use a scriplet: logic:equal name=something value=%=% kinda silly - but it works! --- Paradis,_André [EMAIL PROTECTED] wrote: Hi, the following declaration does not compile on iPlanet 6.0 SP2: logic:equal name=something value= ... /logic:equal here's a snippet of the generated java file: ((org.apache.struts.taglib.logic.EqualTag)_JSP__0).setName(sqc_submenu_ currentitem); ((org.apache.struts.taglib.logic.EqualTag)_JSP__0).setValue( td width=); It's like the JSP parser does not like empty string in tag attributes... anybody had this problem before with iPlanet? any workaround? Thanks Andre Paradis __ Do You Yahoo!? Get email alerts NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com
Use of error in logic tag.
Hello, I can see the errors if I say html:erros/ But I want to use 'errors' bean in logic tag. I want to perform some operation on presence of error. How can I achieve this?? e.g. logic:present name=errors do something. /logic:present The above lines of code does not work. Is there any other way of doing this?? thanks so much, Vaibhav
Re: Use of error in logic tag.
u have to tweak the code a little bit , Here is how logic:present name=org.apache.struts.action.ERROR scope=request do Something ... /logic:present Thnx Suhas - Original Message - From: Vaibhav Patil [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 06, 2001 11:52 AM Subject: Use of error in logic tag. Hello, I can see the errors if I say html:erros/ But I want to use 'errors' bean in logic tag. I want to perform some operation on presence of error. How can I achieve this?? e.g. logic:present name=errors do something. /logic:present The above lines of code does not work. Is there any other way of doing this?? thanks so much, Vaibhav
RE: Logic Tag Library and (Iterator) List Navigation
Hi Oleg, Could you please send me the class and JSP too. Thanks. -Nimmi -Original Message- From: Oleg V Alexeev [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 3:07 PM To: Matt Raible Subject: Re: Logic Tag Library and (Iterator) List Navigation Hello Matt, I can send you Pager class, used to generate ArrayList of links to the pages in this result set, and a piece of jsp code to display it. I think it can used for any container wich implements Collection interface. Thursday, June 07, 2001, 5:57:12 PM, you wrote: MR Has anyone used logic:iterator to display a list of records, and MR corresponding list navigation links at the bottom? MR For instance, I have an Iteration of DataObjects that I can list through MR with the following code: MR while (iteratorName.hasNext()) { MR dataObject = (DataObject)iteratorName.next(); MR out.println(dataObject.getName()); MR } MR I'm assuming I can do this with the Iterator tag, however, I would also like MR to display the following at the bottom of the list: MR First | 1-10 | 11-20 | 20-30 | Last MR Where there are 30 records returned. MR Any ideas? MR Thanks, MR Matt MR _ MR Do You Yahoo!? MR Get your free @yahoo.com address at http://mail.yahoo.com -- Best regards, Olegmailto:[EMAIL PROTECTED]
Logic Tag Library and (Iterator) List Navigation
Has anyone used logic:iterator to display a list of records, and corresponding list navigation links at the bottom? For instance, I have an Iteration of DataObjects that I can list through with the following code: while (iteratorName.hasNext()) { dataObject = (DataObject)iteratorName.next(); out.println(dataObject.getName()); } I'm assuming I can do this with the Iterator tag, however, I would also like to display the following at the bottom of the list: First | 1-10 | 11-20 | 20-30 | Last Where there are 30 records returned. Any ideas? Thanks, Matt _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: Logic Tag Library and (Iterator) List Navigation
Hello Matt, I can send you Pager class, used to generate ArrayList of links to the pages in this result set, and a piece of jsp code to display it. I think it can used for any container wich implements Collection interface. Thursday, June 07, 2001, 5:57:12 PM, you wrote: MR Has anyone used logic:iterator to display a list of records, and MR corresponding list navigation links at the bottom? MR For instance, I have an Iteration of DataObjects that I can list through MR with the following code: MR while (iteratorName.hasNext()) { MR dataObject = (DataObject)iteratorName.next(); MR out.println(dataObject.getName()); MR } MR I'm assuming I can do this with the Iterator tag, however, I would also like MR to display the following at the bottom of the list: MR First | 1-10 | 11-20 | 20-30 | Last MR Where there are 30 records returned. MR Any ideas? MR Thanks, MR Matt MR _ MR Do You Yahoo!? MR Get your free @yahoo.com address at http://mail.yahoo.com -- Best regards, Olegmailto:[EMAIL PROTECTED]
Re: Logic Tag Library and (Iterator) List Navigation
Please send it - and an example if you have one. Thanks, Matt - Original Message - From: Oleg V Alexeev [EMAIL PROTECTED] To: Matt Raible [EMAIL PROTECTED] Sent: Thursday, June 07, 2001 2:07 PM Subject: Re: Logic Tag Library and (Iterator) List Navigation Hello Matt, I can send you Pager class, used to generate ArrayList of links to the pages in this result set, and a piece of jsp code to display it. I think it can used for any container wich implements Collection interface. Thursday, June 07, 2001, 5:57:12 PM, you wrote: MR Has anyone used logic:iterator to display a list of records, and MR corresponding list navigation links at the bottom? MR For instance, I have an Iteration of DataObjects that I can list through MR with the following code: MR while (iteratorName.hasNext()) { MR dataObject = (DataObject)iteratorName.next(); MR out.println(dataObject.getName()); MR } MR I'm assuming I can do this with the Iterator tag, however, I would also like MR to display the following at the bottom of the list: MR First | 1-10 | 11-20 | 20-30 | Last MR Where there are 30 records returned. MR Any ideas? MR Thanks, MR Matt MR _ MR Do You Yahoo!? MR Get your free @yahoo.com address at http://mail.yahoo.com -- Best regards, Olegmailto:[EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re[2]: Logic Tag Library and (Iterator) List Navigation
Hello Matt, Pager - this one PagerIterator - iterator to review Pager without cach PagerEntry - link to page representation JDBCPagerFactory - sample of Pager utilization pager.jsp - displaying of pager data and current page Friday, June 08, 2001, 12:17:19 AM, you wrote: MR Please send it - and an example if you have one. MR Thanks, -- Best regards, Olegmailto:[EMAIL PROTECTED] PagerIterator.java PagerEntry.java Pager.java JDBCPagerFactory.java pager.jsp
Struts iterate logic tag question
Hello, It's a long mail, after a long day. Following is the scenario I am trying to get it done. My current processing: I have a BuddyListForm bean that has three instance variables name,alias and phoneno. code on my JSP page to iterate over the collection: logic:iterate id="buddylist" name="buddyform" property="buddylist" scope="session" tr td align="left" bean:write name="buddylist" property="name" filter="true"/ /td td align="left" bean:write name="buddylist" property="alias" filter="true"/ /td td align="center" bean:write name="buddylist" property="phoneno" filter="true"/ /td td align="center" html:link page="/pfbuddylist.do?cmd=edit" html:img src="images/edit.gif"/ /html:link html:link page="/pfbuddylist.do?cmd=delete" html:img src="images/delete.gif"/ /html:link /td /tr /logic:iterate This works fine. Now I want to send multible BuddyListBeans as a collection to jsp, iterate first at bean level, then again at attribute level. i.e) logic:iterate id="buddylist" name="buddyform" property="buddylist" scope="session" bean level logic:iterate -This is where help is needed -- attribute level /logic:iterate attribute level /logic:iterate beanlevel How do I do it? Any help is appreciated Sundar
Struts iterate logic tag question
Hello, It's a long mail, after a long day. Following is the scenario I am trying to get it done. My current processing: I have a BuddyListForm bean that has three instance variables name,alias and phoneno. code on my JSP page to iterate over the collection: logic:iterate id="buddylist" name="buddyform" property="buddylist" scope="session" tr td align="left" bean:write name="buddylist" property="name" filter="true"/ /td td align="left" bean:write name="buddylist" property="alias" filter="true"/ /td td align="center" bean:write name="buddylist" property="phoneno" filter="true"/ /td td align="center" html:link page="/pfbuddylist.do?cmd=edit" html:img src="images/edit.gif"/ /html:link html:link page="/pfbuddylist.do?cmd=delete" html:img src="images/delete.gif"/ /html:link /td /tr /logic:iterate This works fine. Now I want to send multible BuddyListBeans as a collection to jsp, iterate first at bean level, then again at attribute level. i.e) logic:iterate id="buddylist" name="buddyform" property="buddylist" scope="session" bean level logic:iterate -This is where help is -- attribute level /logic:iterate attribute level /logic:iterate beanlevel How do I do it? Any help is appreciated Sundar