tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Billy Bacon <billy.ba...@thirty3.net>
Subject Re: Can EL take variables?
Date Fri, 12 Sep 2003 19:25:19 GMT
So it's safe to say that I'm not the sharpest tool in the shed....

I was making it more difficult than needed when just trying to print out the
variable name as a literal String.... A simple <c:out value="${formName}"/>
did the trick instead of trying... <c:out
value="${requestScope[formName].map.dynaClass"/>

Thanks for your help Adam, you did push me in the right direction.

- Billy -


On 9/12/03 9:57 AM, "Adam Hardy" <ahardy.struts@cyberspaceroad.com> wrote:

> Hi Billy,
> 
> you seem to have had all the possible errors that you can get with this.
> 
> If you use <c:out> it won't give you an exception. Try this:
> 
> <c:out value="${formName.map.dynaClass}" default="error"/>
> <br>
> <c:out value="${requestScope[formName].map.dynaClass}" default="error"/>
> 
> 
> 
> Adam
> 
> On 09/12/2003 05:40 PM Billy Bacon wrote:
>> Adam, thank you for the suggestion.... Unfortunately when I tried it I
>> receive the following exception ...
>> 
>> [ServletException in:/jsp/kmoCreateComplexBody.jsp] An error occurred while
>> evaluating custom action attribute "value" with value
>> "${formName.map.dynaClass}": Unable to find a value for "map" in object of
>> class "java.lang.String" using operator "." (null)'
>> 
>> What else is there?
>> 
>> On 9/12/03 2:19 AM, "Adam Hardy" <ahardy.struts@cyberspaceroad.com> wrote:
>> 
>> 
>>> In this case it looks like you've got the form object in the 'formName'
>>> variable. Try just:
>>> 
>>> <c:out value="${formName.map.dynaClass}"/>
>>> 
>>> On 09/11/2003 07:07 PM billy.bacon@thirty3.net wrote:
>>> 
>>>> How come doing the following won't render to
>>>> 'kmoCreateComplexForm'...
>>>> 
>>>> <c:out value="${requestScope[formName].map.dynaClass}"/>
>>>> 
>>>> I'm getting the following exception instead...
>>>> 
>>>> [ServletException in:/jsp/kmoCreateComplexBody.jsp]
>>>> Cannot find bean under name
>>>> DynaActionForm[dynaClass=kmoCreateComplexForm,createdDate=2003-09-11
>>>> William
>>>> Bacon,docType=kmo.infodoc,nonsolaris=,title=dd212121212121,editErrorList={}
>>>> 
>>>> 
>>>> 
>>>> ------- Start of forwarded message -------
>>>> 
>>>> Subject: Re: Can EL take variables?
>>>> From: billy.bacon@thirty3.net
>>>> Date: Thu, 11 Sep 2003 10:25:48 -0600 (MDT)
>>>> To: taglibs-user@jakarta.apache.org
>>>> 
>>>> Okay, I finally found my issue but can't seem to figure
>>>> out the solution :-)
>>>> 
>>>> My <c:if test="${requestScope[formName].map.function}"
>>>> /> works nicely and doesn't through any exceptions. The
>>>> following is my problem...
>>>> 
>>>> <html-el:select
>>>> name="${requestScope[formName].map.dynaClass}"
>>>> styleClass="metadata-select-box" property="techareas"
>>>> size="4" multiple="true">
>>>> 
>>>> I've had two versions of this tag... I've had the
>>>> 'name' attribute as name="${requestScope[formName]} and
>>>> the one above as well. Both do not render properly.
>>>> When I use the one above with the 'map.dynaClass' I
>>>> receive the following error when I request the JSP
>>>> page...
>>>> 
>>>> ServletException in:/jsp/kmoCreateComplexBody.jsp]
>>>> Cannot find bean under name '
>>>> 
>>>> When I perform a <c:out
>>>> value="${requestScope[formName]}"/> it does print out
>>>> the form-bean object with all it's parameters so I know
>>>> it's finding it...
>>>> 
>>>> Any suggestions?
>>>> 
>>>> 
>>>> 
>>>> On Thu, 11 Sep 2003 17:33:22 +0200, Adam Hardy wrote:
>>>> 
>>>> 
>>>> 
>>>>> I've not tried that yet. Seems logical. What do you
>>>> 
>>>> get
>>>> 
>>>> 
>>>>> for:
>>>>> 
>>>>> <c:out value="${requestScope[formName].map.function}"
>>>> 
>>>> />
>>>> 
>>>>> ?
>>>>> 
>>>>> Adam
>>>>> 
>>>>> 
>>>>> On 09/11/2003 02:06 PM Billy Bacon wrote:
>>>>> 
>>>>> 
>>>>>> Yes, that's what I'm using but for some reason it's
>>>>> 
>>>>> not working :-/
>>>>> 
>>>>> 
>>>>>> Here's one of my tags...
>>>>>> 
>>>>>> <c:if test="${requestScope[formName].map.function ==
>>>>> 
>>>>> 'edit'}">
>>>>> 
>>>>>> - Billy -
>>>>>> 
>>>>>> On 9/11/03 4:04 AM, "Adam Hardy"
>>>>> 
>>>>> <ahardy.struts@cyberspaceroad.com> wrote:
>>>>> 
>>>>> 
>>>>>>> What about ${requestScope[formName].map.whatever}
>>>>>>> 
>>>>>>> If not, post the tag you actually trying to use it
>>>>> 
>>>>> with.
>>>>> 
>>>>> 
>>>>>>> Adam
>>>>>>> 
>>>>>>> On 09/11/2003 04:30 AM Billy Bacon wrote:
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>>> From the original Struts Tags I had the following
>>>>> 
>>>>> in the parent JSP which
>>>>> 
>>>>> 
>>>>>>>> has 2 <%@ include%> statements...
>>>>>>>> <bean:define id="formName"
>>>>> 
>>>>> value="kmoCreateComplexForm"/>
>>>>> 
>>>>>>>> Now within my included pages I was able to
>>>> 
>>>> reference
>>>> 
>>>> 
>>>>> that variable by
>>>>> 
>>>>> 
>>>>>>>> <%=formName%> and that worked just fine. Now I'm
>>>>> 
>>>>> converting to JSTL and even
>>>>> 
>>>>> 
>>>>>>>> if I do a <c:set var="formName"
>>>>> 
>>>>> value="kmoCreateComplexForm"/> it doesn't
>>>>> 
>>>>> 
>>>>>>>> allow the embedded pages to use the value.
>>>>>>>> 
>>>>>>>> I tried the requestScope[formName] idea that David
>>>>> 
>>>>> suggested and that has
>>>>> 
>>>>> 
>>>>>>>> gotten me a little farther but I'm still getting an
>>>>> 
>>>>> exception 'Cannot find
>>>>> 
>>>>> 
>>>>>>>> bean name' and it spits out the DynaActionForm with
>>>>> 
>>>>> everything. It seems to
>>>>> 
>>>>> 
>>>>>>>> be finding the variable but I'm not sure what it's
>>>>> 
>>>>> complaining about b/c JSP
>>>>> 
>>>>> 
>>>>>>>> errors are brutal sometimes to figure out. It
>>>>> 
>>>>> doesn't give me a line number
>>>>> 
>>>>> 
>>>>>>>> or anything else to use for debugging...
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 9/10/03 11:08 AM, "Serge Knystautas"
>>>>> 
>>>>> <sergek@lokitech.com> wrote:
>>>>> 
>>>>> 
>>>>>>>> 
>>>>>>>>> billy.bacon@thirty3.net wrote:
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> Sure, I can expand on this. 'formName' is a
>>>>> 
>>>>> variable in
>>>>> 
>>>>> 
>>>>>>>>>> the request which points to an object (in this
>>>>> 
>>>>> case a
>>>>> 
>>>>> 
>>>>>>>>>> DynaActionForm object from Struts). So even
>>>> 
>>>> though
>>>> 
>>>> 
>>>>> it
>>>>> 
>>>>> 
>>>>>>>>>> seems that the <c:set> tag is unnecessary I'm
>>>>> 
>>>>> slightly
>>>>> 
>>>>> 
>>>>>>>>>> confused on how to expose it to the EL without it
>>>>>>>>>> treating it as a literal String such as
>>>> 
>>>> "formName".
>>>> 
>>>> 
>>>>>>>>>> What I really need is the 'formName' variable to
>>>>>>>>>> translate to 'kmoCreateSimpleForm' so that when I
>>>>> 
>>>>> use
>>>>> 
>>>>> 
>>>>>>>>>> it in the EL it will execute as
>>>>>>>>>> ${kmoCreateSimpleForm.map.whatever}
>>>>>>>>> 
>>>>>>>>> Yeah, but where in the request is it?  Put it this
>>>>> 
>>>>> way, how would you
>>>>> 
>>>>> 
>>>>>>>>> get to it in a scriptlet?
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 
>>>>>>> 
>>>>>>>> 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
>>>>> 
>>>>> 
>>>>> -- 
>>>>> struts 1.1 + tomcat 4.1.27 + java 1.4.2
>>>>> Linux 2.4.20 RH9
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 
>>>> 
>>>>> To unsubscribe, e-mail:
>>>>> taglibs-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail:
>>>>> taglibs-user-help@jakarta.apache.org
>>>> 
>>>> 
>>>> ------- End of forwarded message -------
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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
>> 
>> 


Mime
View raw message