Re: fmt:param not working as expected...
Nope, I'm not using Resin. I did however get it to work with someone else's suggestion... For those who are interested In my Messages.properties file I needed to escape the single qoute in the word Can't... Notice the 2 single quotes '' md.tree.label.feedback1=Can''t find the {0}? Mail Then in my JSP I did the following... fmt:message key=md.tree.label.feedback1 fmt:paramc:out value=${mdTreeForm.map.itemDesc}//fmt:param /fmt:message Thanks to those who offered suggestions! - Billy - On 9/26/03 12:31 PM, Karr, David [EMAIL PROTECTED] wrote: You're not using Resin, are you? Resin has their own JSTL implementation, which might be different from the Jakarta implementation. -Original Message- From: Billy Bacon [mailto:[EMAIL PROTECTED] I tried this after your suggestion and I still get the same result. Are you doing something differently? fmt:message key=md.tree.label.feedback1 fmt:paramc:out value=${mdTreeForm.map.itemDesc}//fmt:param /fmt:message On 9/26/03 3:54 AM, Martin van Dijken [EMAIL PROTECTED] wrote: Hey Billy, I've got your example working with one little difference, though it may not be significant. I've got the value within the param tags instead of as value. Grtz, Martin -Original Message- From: Billy Bacon [mailto:[EMAIL PROTECTED] I searched the archives and didn't see any issues like this listed. Can anyone help me out here? I original had all struts tags and in my messages.properties file where all my localized content is stored I had the following entry... md.tree.label.feedback1=Can't find the {0}? Mail Notice the {0} which is a place holder for an argument/parameter... This was working fine with Struts but the following is not working in JSTL.. fmt:message key=md.tree.label.feedback1 fmt:param value=xyz/ /fmt:message For some reason it's printing out Can't find the {0}? Mail and not replacing {0} with 'xyz'... - 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]
fmt:param not working as expected...
I searched the archives and didn't see any issues like this listed. Can anyone help me out here? I original had all struts tags and in my messages.properties file where all my localized content is stored I had the following entry... md.tree.label.feedback1=Can't find the {0}? Mail Notice the {0} which is a place holder for an argument/parameter... This was working fine with Struts but the following is not working in JSTL.. fmt:message key=md.tree.label.feedback1 fmt:param value=xyz/ /fmt:message For some reason it's printing out Can't find the {0}? Mail and not replacing {0} with 'xyz'... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
c:import
I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
I tried catching any exceptions and nothing was printed to the screen :-/ On 9/17/03 10:41 AM, Rick Ross [EMAIL PROTECTED] wrote: Also, you might wanna do this to see if an error occurred: c:catch var=ex c:import url=${viewPage}/ /c:catch c:if test=${not empty ex} c:out value=${ex} / /c:if Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Awesome. That worked! Thanks Kris! - Billy - On 9/17/03 12:05 PM, Kris Schneider [EMAIL PROTECTED] wrote: Have you tried a context-relative path (starts with /) to the page? Quoting Billy Bacon [EMAIL PROTECTED]: It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Yep, all my JSPs are in the same directory. c:import url=xyz.jsp/ // didn't work c:import url=/jsp/xyz.jsp/ // did the trick. Dunno... On 9/17/03 1:14 PM, Kris Schneider [EMAIL PROTECTED] wrote: Okay, that's good, but I use page-relative paths successfully with c:import all the time. Are you sure the page doing the import is in the same directory as the page being imported? Quoting Billy Bacon [EMAIL PROTECTED]: Awesome. That worked! Thanks Kris! - Billy - On 9/17/03 12:05 PM, Kris Schneider [EMAIL PROTECTED] wrote: Have you tried a context-relative path (starts with /) to the page? Quoting Billy Bacon [EMAIL PROTECTED]: It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get the size of a java.util.List object in EL?
I need to get the size (as an int) of a java.util.List I have. The following doesn't work c:out value=Size = ${browseForm.map.colInfoList.size}/ It gives me the following exception... ServletException in:/jsp/browseQueueBody.jsp] An error occurred while evaluating custom action attribute value with value Size = ${browseForm.map.colInfoList.size}: The . operator was supplied with an index value of type java.lang.String to be applied to a List or array, but that value cannot be converted to an integer. (null)' Does anyone know how I could get the size of the List? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding 1 to my varStatus variable within a c:forEach tag
I'm getting an exception for adding 1 to my counter variable with my c:forEach tag. ServletException in:/jsp/kmoCreateSimpleBody.jsp] An error occurred while evaluating custom action attribute value with value ${counter +1}: Attempt to coerce a value of type javax.servlet.jsp.jstl.core.LoopTagSupport$1$Status to type java.lang.Long (null)' Here's my loop tag... c:forEach items=${kmoCreateSimpleForm.map.contentFields} var=contentField varStatus=counter And here's the tag it doesn't like... html-el:hidden property=fieldLabel${contentField.id} value=${counter +1}/ Does anyone know how I could get this to work the correct way? Thanks in advance - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding 1 to my varStatus variable within a c:forEach tag
Awesome. Actually for those interested, the syntax is... ${counter.index + 1} // index returns you the status of the counter. Thanks Adam. - Billy - On 9/15/03 11:39 AM, Adam Hardy [EMAIL PROTECTED] wrote: status is an object, you have to retrieve its counter property. Something like ${counter.count + 1} (but that's off the top of my head, so the property name might not be right.) Adam On 09/15/2003 07:07 PM Billy Bacon wrote: I'm getting an exception for adding 1 to my counter variable with my c:forEach tag. ServletException in:/jsp/kmoCreateSimpleBody.jsp] An error occurred while evaluating custom action attribute value with value ${counter +1}: Attempt to coerce a value of type javax.servlet.jsp.jstl.core.LoopTagSupport$1$Status to type java.lang.Long (null)' Here's my loop tag... c:forEach items=${kmoCreateSimpleForm.map.contentFields} var=contentField varStatus=counter And here's the tag it doesn't like... html-el:hidden property=fieldLabel${contentField.id} value=${counter +1}/ Does anyone know how I could get this to work the correct way? Thanks in advance - Billy - - 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]
How can I convert this to JSTL?
I'm hoping someone can help me out with this one I'm almost finished converting the entire app :-) I have a c:forEach loop and within the loop I have a scriptlet. Now I'm aware that JSTL variables are *not* visible within scriptlets. So how would I convert the following below... 'suggestionList' is the variable that I'm having trouble with. c:forEach items=${SPELL_CHECK_SUGGESTIONS_BEAN} var=suggestionList % String[] suggs = (String[])((java.util.Map.Entry)suggestionList).getValue(); % /c:forEach - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I convert this to JSTL?
Yea, I need to access the 'suggestionList' EL variable from within a scriplet. I don't prefer to use scriplets in my JSPs but in this case I don't think I can get around it because this loop that I'm in is creating javascript. Here's what the JSP currently looks like... script language=javascript !-- var suggestions = new Array(); var replaceWin = null; c:forEach items=${SPELL_CHECK_SUGGESTIONS_BEAN} var=suggestionList varStatus=count suggestions[c:out value=${count.index}/] = new Array(c:out value='${suggestionList.key}'/); % String[] suggs = (String[])((java.util.Map.Entry)suggestionList).getValue(); int len = suggs.length; for (int i=0; i len; i++) { % suggestions[c:out value=${count.index}/][%= i+1 %] = %= suggs[i] %; % } % /c:forEach /script This use to work when I had the logic:iterate Struts tag that defined the suggestionList variable since that allowed scriplets to access it... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can EL take variables?
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] Date: Thu, 11 Sep 2003 10:25:48 -0600 (MDT) To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: Can EL take variables?
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] Date: Thu, 11 Sep 2003 10:25:48 -0600 (MDT) To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] 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
Re: Can EL take variables?
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can EL take variables?
I'm hoping there is a way to do this but I haven't figured it out yet... I have a DynaActionForm but the form name is a variable since the user could be coming from two different sections and I'm trying to utilize one page to handle either request... So I have a c:set tag that defines the formName like so... c:set var=formName value=${formName}/ but when I try to use this in my conditional statements, EL is treating formName as a string and not a form c:if test=${formName.map.} %-- Whatever --% /c:if I'm getting a compilation error. 'formName' should be translated to the actual form bean name such as 'kmoCreateComplexForm' or 'kmoCreateSimpleForm' depending on where the user is coming from. Is there a way to do this? What am I doing wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can EL take variables?
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} On Wed, 10 Sep 2003 12:44:19 -0400, Serge Knystautas wrote: [EMAIL PROTECTED] wrote: I'm hoping there is a way to do this but I haven't figured it out yet... I have a DynaActionForm but the form name is a variable since the user could be coming from two different sections and I'm trying to utilize one page to handle either request... So I have a c:set tag that defines the formName like so... c:set var=formName value=${formName}/ Can you expand on this? The example provided does exactly nothing... you assign the variable formName what's in variable formName. In Java, you just wrote... formName = formName; but when I try to use this in my conditional statements, EL is treating formName as a string and not a form This predicates on how you setup formName. -- Serge Knystautas President Lokitech software . strategy . design http://www.lokitech.com p. 301.656.5501 e. [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can EL take variables?
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 [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Performing a .equals() within a c:if tag....
All, I hope I'm asking the correct list... if not, please direct me to the correct one... I'm converting my struts taglibs to JSTL tags and I've attempted to convert the following tag to JSTL... logic:equals nameform property=id value= and I tried performing this even though I know it's not the exact conversion (I thought it would convert the value to null if it was empty...) I tried this and I got an exception... c:if test=${form.id == null} Can someone tell me how to perform the .equals() test within a c:if tag. Thank you - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How come c:out didn't regonize variable?
Yansheng, Two questions for you 1.) Is sortField a property in your form-bean? 2.) If yes to question 1, are you using a DynaActionForm for your form-bean? - Billy - On Thu, 10 Jul 2003 14:01:59 -0400, Chris Winters wrote: Yansheng Lin wrote: I have a simple c:out statement in my jsp file: html:hidden property=sortField/ c:out value=${sortField} default=nothing/ The output source is: input type=hidden name=sortField value=service_provider nothing As you can see, the struts tag html:hidden rendered the value, but c:out didn't. I am new to JSTL, so I have no clue why this didn't work. The 'html' form tags for Struts pull their values (in this case for 'sortField') from the form bean in scope. If you reference that form bean in your JSTL expression (usually by whatever name you've given it in your 'action' declaration) it should output the same thing. Chris -- Chris Winters ([EMAIL PROTECTED]) Senior Software Architect - 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: Problems with c:out tag
I've run into the same issue but with a different tag other than c:out. I'm assuming they are related but I'm really looking for some advice here... I'm in the process of converting my application to JSTL from Struts tags. Once Struts 1.1 Release Candidate 2 came out supporting EL I decided to stick with Struts EL since converting the entire application to JSTL and removing all of my Struts tags didn't seem possible when I started to run into this issue. In my original code I had the following if statement within my JSP... logic:equal name=adminDownloadForm property=idFlag value=true %-- Show some related information if 'idFlag' evaluates to true --% /logic:equal The above worked just fine and returned the expected information. When I tried to convert this simple if statement to JSTL I ran into a problem... Here's the code I attempted to use... c:if test=${adminDownloadForm.idFlag} %-- Show some related information if 'idFlag' evaluates to true --% /c:if Once I tried the c:if tag and executed the JSP I received the error described by Matt below... An error occurred while evaluating custom action attribute value with value ${adminDownloadForm.idFlag}: Unable to find a value for ifFlag in object of class com..xxx..xxx using operator . (null)' JSTL is not aware of the adminDownloadForm object. I know this Form is related to Struts but the behavior of these JSTL tags is inconsistent. In order to get my c:if tag to work properly I had to use a bean:define tag from the Struts library and define the 'idFlag' variable. Now if I do something like this, my c:if tag works fine bean:define id=idFlag name=adminDownloadForm property=idFlag / c:if test=${idFlag} /c:if But now I'm writing two lines of code when all I needed was one line using the logic:equals tag from the Struts library. I know an additional line of code is not the end of the world but which is better practice? Is having Struts tags and JSTL tags in your JSP bad practice? Could it cause confusion to other developers down the road? Back to my point of JSTL being inconsistent... I have this standalone tag in my JSP (with no bean define or c:set and I do not get an exception from this tag... It works just fine c:forEach var=assetType items=${summaryForm.assetTypeQueues} What's confusing and inconsistent is that I didn't need to define the 'summaryForm' object. It was capable of seeing it and extracted the variable I asked from it just fine. Why doesn't the c:if tag act in the same manner? Is this a bug or am I doing something wrong? I apologize for the novel I just wrote but I didn¹t want to leave out any details. Any advice would be greatly appreciated. Thanks - Billy - On 7/3/03 9:47 AM, Michael Duffy [EMAIL PROTECTED] wrote: Hi Sgarlata, I had this problem, too. Drove me crazy! I had a class named Component that didn't behave correctly. When I renamed the class to AssemblyComponent, everything worked fine. The only class in the JDK that might interfere this way is java.awt.Component. I'm not sure how it happens, but JSTL couldn't find my methods on my Component class. I know it's not a great answer, but it is a workaround. At least I can offer my sympathy - I suffered with this, too. - MOD --- Sgarlata Matt [EMAIL PROTECTED] wrote: Hello, I'm having some problems with the c:out tag (and also with the bean:write tag from Struts) where I have some code that works in one application but does not work in another application. I know my variables are set out correctly because of some scriptlet code. Here is the working code: c:forEach items=${lookup.days} var=day c:out value=${day.title}/ /c:forEach Here is the same code that does not work in another application: c:forEach items=${lookup.components} var=component c:out value=${component.shortDesc}/ /c:forEach The error message is: An error occurred while evaluating custom action attribute value with value ${component.shortDesc}: Unable to find a value for shortDesc in object of class com.bah.ebspnp.dao.Component using operator . (null)' However, this does work correctly: c:forEach items=${lookup.components} var=item %= ((Component)pageContext.getAttribute(item)).getShortDesc() % /c:forEach Any ideas? Thanks! Matt __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with c:out tag
Thanks for your response Hans, that was very helpful. This might be more of a Struts issue then because I don't have a JavaBean for my 'Form' object. I use the Struts DynaActionForm object which does all the 'getting' and 'setting' for you. I have this element defined in my struts-config.xml file... form-bean name=adminDownloadForm type=org.apache.struts.action.DynaActionForm form-property name=idFlag type=java.lang.Boolean / /form-bean Defining the property 'idFlag' with a type Boolean is all I have to do and Struts pretty much does the rest of the getting/setting. I'm not sure how the DynaActionForm is implemented since it's a core Struts class but in anycase it doesn't look like I could fix this since I don't define the Bean. Thanks for the input! - Billy - On 7/5/03 6:53 PM, Hans Bergsten [EMAIL PROTECTED] wrote: Billy Bacon wrote: I've run into the same issue but with a different tag other than c:out. I'm assuming they are related but I'm really looking for some advice here... I'm in the process of converting my application to JSTL from Struts tags. Once Struts 1.1 Release Candidate 2 came out supporting EL I decided to stick with Struts EL since converting the entire application to JSTL and removing all of my Struts tags didn't seem possible when I started to run into this issue. In my original code I had the following if statement within my JSP... logic:equal name=adminDownloadForm property=idFlag value=true %-- Show some related information if 'idFlag' evaluates to true --% /logic:equal The above worked just fine and returned the expected information. When I tried to convert this simple if statement to JSTL I ran into a problem... Here's the code I attempted to use... c:if test=${adminDownloadForm.idFlag} %-- Show some related information if 'idFlag' evaluates to true --% /c:if Once I tried the c:if tag and executed the JSP I received the error described by Matt below... An error occurred while evaluating custom action attribute value with value ${adminDownloadForm.idFlag}: Unable to find a value for ifFlag in object of class com..xxx..xxx using operator . (null)' This means that there's something quite not right with the idFlag property in your bean. The JSTL EL goes strictly by the JavaBeans specification, so the bean must satisfy all rules for the property access methods. A quite common problem is to have a getter method that returns an object of one type, and a setter method that takes an object of another type: public class MyBean { ... public boolean getIdFlag() {...} public setIdFlag(String value) {...} } This is not valid according to the JavaBeans spec, so the end result is that this class doesn't define a property named idFlag at all, even though it has a getIdFlag() method. JSTL is not aware of the adminDownloadForm object. I know this Form is related to Struts but the behavior of these JSTL tags is inconsistent. In order to get my c:if tag to work properly I had to use a bean:define tag from the Struts library and define the 'idFlag' variable. Now if I do something like this, my c:if tag works fine bean:define id=idFlag name=adminDownloadForm property=idFlag / c:if test=${idFlag} /c:if I have not looked at the Struts code, but I assume that it doesn't use the JavaBeans support classes to get the property value. If it uses plain introspection to get hold of a method called getIdFlag() and call it, it works even though the class doesn't have a bean property with the name idFlag according to the JavaBeans spec. But now I'm writing two lines of code when all I needed was one line using the logic:equals tag from the Struts library. I know an additional line of code is not the end of the world but which is better practice? Is having Struts tags and JSTL tags in your JSP bad practice? Could it cause confusion to other developers down the road? In general, using more than one tag library from different sources in a JSP application is not bad practice (it's commonly needed, actually). But I recommend sticking to JSTL in the cases where there's a direct replacement for the Struts tag, as in the case of logic:equals vs. c:if. Back to my point of JSTL being inconsistent... I have this standalone tag in my JSP (with no bean define or c:set and I do not get an exception from this tag... It works just fine c:forEach var=assetType items=${summaryForm.assetTypeQueues} What's confusing and inconsistent is that I didn't need to define the 'summaryForm' object. It was capable of seeing it and extracted the variable I asked from it just fine. Why doesn't the c:if tag act in the same manner? Is this a bug or am I doing something wrong? See above. It's arguably a bug in your bean class (unless there's something else going on here that I'm not aware of). I apologize for the novel I just wrote but I didn¹t want to leave out any details. Any advice
Re: out not working properly?
Yes I do. I also have the following c: tags in my page before this and the page is executing... c:forEach var=assetType items=${summaryForm.assetTypeQueues} c:set var=assetTypeName value=${assetType.key} / On 6/18/03 4:10 PM, Wendy Smoak [EMAIL PROTECTED] wrote: Billy wrote: I have the following tag: c:out value=${assetTypeName} default=Default Value / And I'm getting this in the browser when the page executes... ${assetTypeName} Any ideas as to why the EL is not being executed? Maybe too obvious, but do you have %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % At the top of the page? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:out not working properly?
Still no good :-( I tried single quotes around the EL and I am also using the c-rt.tld file which has rtexprvaluetrue/rtexprvalue for the value attribute. Bummin' On 6/18/03 4:17 PM, N. Chen [EMAIL PROTECTED] wrote: hehe, try instead c:out value='${assetTypeName}' default=Default Value / nick On Wed, 18 Jun 2003, Billy Bacon wrote: I have the following tag: c:out value=${assetTypeName} default=Default Value / And I'm getting this in the browser when the page executes... ${assetTypeName} Any ideas as to why the EL is not being executed? Thanks for the help - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:out not working properly?
Yes, I'm using the c-rt.tld in my web.xml file. Is that why I'm getting the result I don't want? On 6/18/03 4:41 PM, N. Chen [EMAIL PROTECTED] wrote: are you using c-rt.tld or c.tld? c-rt.tld cause it to display ${assetTypeName} on my test case. nick On Wed, 18 Jun 2003, Billy Bacon wrote: Still no good :-( I tried single quotes around the EL and I am also using the c-rt.tld file which has rtexprvaluetrue/rtexprvalue for the value attribute. Bummin' On 6/18/03 4:17 PM, N. Chen [EMAIL PROTECTED] wrote: hehe, try instead c:out value='${assetTypeName}' default=Default Value / nick On Wed, 18 Jun 2003, Billy Bacon wrote: I have the following tag: c:out value=${assetTypeName} default=Default Value / And I'm getting this in the browser when the page executes... ${assetTypeName} Any ideas as to why the EL is not being executed? Thanks for the help - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:out not working properly?
You are the man Nick. I would have never found this. I almost launched my powerbook out the window due to frustration. Thanks for the help! - Billy - On 6/18/03 4:49 PM, N. Chen [EMAIL PROTECTED] wrote: c-rt.tld - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL c:out Output Problem
Adam, You are receiving the print out you have stated b/c you are telling c:out to print the array object itself. You need to give it an index to print out. Try this... c:out value=${header[0]} / this will obviously just print the first element in your array (index at 0) which will be ...'Name'. You should define a counter for the index so it can loop through each value. For example.. ${header[x]} but you'll need to define x. I'm sure the c:forEach tag has some way of defining an indexer. Hope that helps... - Billy - On Tue, 25 Mar 2003 10:36:29 -0800 (PST), Adam Sherman wrote: I have the following JSP: c:forEach items=${list.headers} var=header thc:out value=${header} //th /c:forEach ${list.headers} is set to String[] HEADERS = {Name, Email Address}. I get: [EMAIL PROTECTED] [EMAIL PROTECTED] WTF? I tried looking at it from avery angle, using a List of Strings instead of an array to no avail. Help! Thanks, A. -- Adam Sherman Tritus CG Inc. a href=http://mail.thirty3.net/jump/http://www.tritus.ca;http://www.tritus.ca/a/ +1 (613) 797-6819 - 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]