Return-Path: Delivered-To: apmail-jakarta-taglibs-user-archive@www.apache.org Received: (qmail 25254 invoked from network); 2 Sep 2004 16:34:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Sep 2004 16:34:49 -0000 Received: (qmail 28989 invoked by uid 500); 2 Sep 2004 16:34:16 -0000 Delivered-To: apmail-jakarta-taglibs-user-archive@jakarta.apache.org Received: (qmail 28918 invoked by uid 500); 2 Sep 2004 16:34:15 -0000 Mailing-List: contact taglibs-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tag Libraries Users List" Reply-To: "Tag Libraries Users List" Delivered-To: mailing list taglibs-user@jakarta.apache.org Received: (qmail 28856 invoked by uid 99); 2 Sep 2004 16:34:14 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [216.82.244.35] (HELO mail54.messagelabs.com) (216.82.244.35) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 02 Sep 2004 09:34:12 -0700 X-VirusChecked: Checked X-Env-Sender: asleson@biworldwide.com X-Msg-Ref: server-10.tower-54.messagelabs.com!1094142847!13226005 X-StarScan-Version: 5.2.10; banners=biworldwide.com,-,- X-Originating-IP: [198.246.150.101] Received: (qmail 23800 invoked from network); 2 Sep 2004 16:34:07 -0000 Received: from mimesweeper.biperf.com (198.246.150.101) by server-10.tower-54.messagelabs.com with SMTP; 2 Sep 2004 16:34:07 -0000 Received: from smtp.biperf.com (smtp.biperf.com) by mimesweeper.biperf.com (Content Technologies SMTPRS 4.2.10) with ESMTP id for ; Thu, 2 Sep 2004 11:26:54 -0500 Received: by smtp.biperf.com with Internet Mail Service (5.5.2657.72) id ; Thu, 2 Sep 2004 11:34:06 -0500 Message-ID: <6D46CCFBEB83D21199EB0001FAD4E4EE0FBDE33D@mail5.biperf.com> From: "Asleson, Ryan" To: "'taglibs-user@jakarta.apache.org'" Subject: RE: Dynamic Expressions for Struts-EL and JSTL Date: Thu, 2 Sep 2004 11:34:04 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N You read my mind. This does seem to work: ${formBean[prop1][prop2]} where prop1 and prop2 are Strings defined in a scriptlet as "userInfo" and "firstName", respectively. Apparently the dot notation can't be used in a dynamic expression. Not sure why, you would think that it would. -----Original Message----- From: Karr, David [mailto:david.karr@wamu.net] Sent: Thursday, September 02, 2004 11:09 AM To: Tag Libraries Users List Subject: RE: Dynamic Expressions for Struts-EL and JSTL I wonder if you need something like this: ${formBean[layoutObject.property][layoutObject.property2]} Where "layoutObject.property" is "userInfo" and "layoutObject.property2" is "firstName". That will obviously be a litter harder to construct, but determining whether this works would be one step forward. > -----Original Message----- > From: Asleson, Ryan [mailto:asleson@BIWORLDWIDE.com] > Sent: Thursday, September 02, 2004 8:33 AM > To: 'taglibs-user@jakarta.apache.org' > Subject: RE: Dynamic Expressions for Struts-EL and JSTL > > > > We must be close. I tried this: > > > > (Assume that layoutObject.property evaluates to a String of > userInfo.firstName) > > > And the container threw this exception: > > > > [ServletException in:/jsp/registration/registerDisplay.jsp] > An error occurred while evaluating custom action attribute > "value" with value > "${formBean[layoutObject.property]}": Unable to find a value > for "userInfo.firstName" in object of class "app.MyFormBean" > using operator "[]" (null)' javax.servlet.jsp.JspException: > An error occurred while evaluating custom action attribute > "value" with value > "${formBean[layoutObject.property]}": Unable to find a value > for "userInfo.firstName" in object of class "app.MyFormBean" > using operator "[]" > (null) at > org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evalu > ator.java:146) > at > > > > Like I said before, I want c:out to output the resulting > String of formBean.getUserInfo.getFirstName, but it won't do > it. Any more ideas?? I have to believe this can be done > somehow using these tags. > > > > > > > -----Original Message----- > From: Helios Alonso [mailto:halonso@atg.com.uy] > Sent: Thursday, September 02, 2004 9:48 AM > To: Tag Libraries Users List > Subject: Re: Dynamic Expressions for Struts-EL and JSTL > > > > So, you could change this: > > >String expr = "formBean." + > >((app.LayoutObject)pageContext.getAttribute("layoutObject")). > getPropert > >y(); > > to this: > > formBean[pageContext.layoutObject.property] > > (If I understood you have a layoutObject with a property saying which > property read from formBean). > > At 08:37 02/09/2004 -0500, you wrote: > > >Hello, > > > >I'm using the Struts-EL and JSTL custom tag implementations > in my Web > >app. > > > >I want to use the c:out tag to output dynamic data. The > tricky part is > >I want to dynamically build the EL expression at runtime by > building up > >a String that should be evaluated. I don't want to output > the String, > >I want the String to be evaluated by the expression engine and then > >that written out. An example follows below. > > > > > > > ><% > >//Assume that after this line runs, expr has a value of > >formBean.property.value //This is the expression I want evaluated > >String expr = "formBean." + > >((app.LayoutObject)pageContext.getAttribute("layoutObject")). > getProperty(); > > > >pageContext.setAttribute("expr", expr); > >%> > > > > > > > > > > > >The c:out tag above renders the text Expression Value is: > >formBean.property.value . > > > >This isn't what I want -- I want it to evaluate the > >formBean.property.value down to an expression, and then spit out the > >value of that expression (basically, > formBean.getProperty().getValue() > >). > > > >Interestingly, if I "hard code" the expression, it works: > > > > > > > >The only problem is I need to dynamically change this expression at > runtime. > > > >Can this be done? If so, how? I'm hoping so otherwise I'll have a > mountain > >of new code to write. Also, is there a more elegant way to > do what I > >show in the example above, like using tags instead of scriptlets? I > >don't care if I use Struts-EL tags, JSTL tags, or both. > > > >Thank you very much!! > > > >This e-mail message is being sent solely for use by the intended > >recipient(s) and may contain confidential information. Any > unauthorized > >review, use, disclosure or distribution is prohibited. If > you are not the > >intended recipient, please contact the sender by phone or > reply by e-mail, > >delete the original message and destroy all copies. Thank you. > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org > >For additional commands, e-mail: taglibs-user-help@jakarta.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org > > This e-mail message is being sent solely for use by the > intended recipient(s) and may contain confidential > information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the intended > recipient, please contact the sender by phone or reply by > e-mail, delete the original message and destroy all copies. Thank you. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: taglibs-user-help@jakarta.apache.org This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: taglibs-user-help@jakarta.apache.org