JSTL simply love it however ...
I have started to use JSTL this week. I simply love it !!! However, I have one small problem that I cannot seem to get working. Here is a snippet of code that works fine: c:forEach items=${dynaCWWHistoryForm.map.historyItems} var= historyItems varStatus=status tr valign=top td id=cc:out value='${status.index}'/2 c:forEach items=${dynaCWWHistoryForm.map.scheduleTypes} var= option html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select /td /tr /c:forEach What I need to do is add an onChange event for the html:select tag such as: c:forEach items=${dynaCWWHistoryForm.map.historyItems} var= historyItems varStatus=status tr valign=top td id=cc:out value='${status.index}'/2 c:forEach items=${dynaCWWHistoryForm.map.scheduleTypes} var= option varStatus=optionStatus html:select name=historyItems onchange= addTableRow('historyTable','s_SOMETHING_HERE') property=scheduleTypeId indexed=true styleClass= dropdowns2 html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select /td /tr /c:forEach Where the SOMETHING_HERE would need to be c:out value='${status.index}'/ . Is this possible? Any help would be appreciated. - Glenn
RE: JSTL simply love it however ...
I think ${status.index} in place of s_SOMETHING_HERE would work fine. Otherwise, try setting onChange=${addTableRow} with addTableRow prior defined as: c:set var=addTableRowaddTableRow('historyTable','c:out value=${status.index} /')/c:set -Abdullah -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 14, 2005 7:59 AM To: user@struts.apache.org Subject: JSTL simply love it however ... I have started to use JSTL this week. I simply love it !!! However, I have one small problem that I cannot seem to get working. Here is a snippet of code that works fine: c:forEach items=${dynaCWWHistoryForm.map.historyItems} var= historyItems varStatus=status tr valign=top td id=cc:out value='${status.index}'/2 c:forEach items=${dynaCWWHistoryForm.map.scheduleTypes} var= option html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select /td /tr /c:forEach What I need to do is add an onChange event for the html:select tag such as: c:forEach items=${dynaCWWHistoryForm.map.historyItems} var= historyItems varStatus=status tr valign=top td id=cc:out value='${status.index}'/2 c:forEach items=${dynaCWWHistoryForm.map.scheduleTypes} var= option varStatus=optionStatus html:select name=historyItems onchange= addTableRow('historyTable','s_SOMETHING_HERE') property=scheduleTypeId indexed=true styleClass= dropdowns2 html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select /td /tr /c:forEach Where the SOMETHING_HERE would need to be c:out value='${status.index}'/ . Is this possible? Any help would be appreciated. - Glenn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL simply love it however ...
Niether solution works... The expression is never evaluated. The output is: select name=historyItems[2].scheduleTypeId onchange=addTableRow('historyTable','sc:out value='${status.index}'/') class=dropdowns2 Abdullah Jibaly [EMAIL PROTECTED] 14/04/2005 10:06 AM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:RE: JSTL simply love it however ... Classification: I think ${status.index} in place of s_SOMETHING_HERE would work fine. Otherwise, try setting onChange=${addTableRow} with addTableRow prior defined as: c:set var=addTableRowaddTableRow('historyTable','c:out value=${status.index} /')/c:set -Abdullah -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 14, 2005 7:59 AM To: user@struts.apache.org Subject: JSTL simply love it however ... I have started to use JSTL this week. I simply love it !!! However, I have one small problem that I cannot seem to get working. Here is a snippet of code that works fine: c:forEach items=${dynaCWWHistoryForm.map.historyItems} var= historyItems varStatus=status tr valign=top td id=cc:out value='${status.index}'/2 c:forEach items=${dynaCWWHistoryForm.map.scheduleTypes} var= option html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select /td /tr /c:forEach What I need to do is add an onChange event for the html:select tag such as: c:forEach items=${dynaCWWHistoryForm.map.historyItems} var= historyItems varStatus=status tr valign=top td id=cc:out value='${status.index}'/2 c:forEach items=${dynaCWWHistoryForm.map.scheduleTypes} var= option varStatus=optionStatus html:select name=historyItems onchange= addTableRow('historyTable','s_SOMETHING_HERE') property=scheduleTypeId indexed=true styleClass= dropdowns2 html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select /td /tr /c:forEach Where the SOMETHING_HERE would need to be c:out value='${status.index}'/ . Is this possible? Any help would be appreciated. - Glenn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
[EMAIL PROTECTED] wrote: Niether solution works... The expression is never evaluated. The output is: select name=historyItems[2].scheduleTypeId onchange=addTableRow('historyTable','sc:out value='${status.index}'/') class=dropdowns2 Are you using the EL version of the struts tags? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
How can I tell which version of the struts tags? Dave Newton [EMAIL PROTECTED] 14/04/2005 10:53 AM Please respond to Struts Users Mailing List To: Struts Users Mailing List user@struts.apache.org cc: (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA) Subject:Re: JSTL simply love it however ... Classification: [EMAIL PROTECTED] wrote: Niether solution works... The expression is never evaluated. The output is: select name=historyItems[2].scheduleTypeId onchange=addTableRow('historyTable','sc:out value='${status.index}'/') class=dropdowns2 Are you using the EL version of the struts tags? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
[EMAIL PROTECTED] wrote: How can I tell which version of the struts tags? You choose to use the struts EL tags by a) using the struts EL tld (like struts-html-el.tld) and b) by having the struts-el tag JAR file. I don't know if they come by default with the latest release or not; you'd have to check. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
Okay... I am not using the Struts EL taglibs. Should I be using them? You choose to use the struts EL tags by a) using the struts EL tld (like struts-html-el.tld) and b) by having the struts-el tag JAR file. I don't know if they come by default with the latest release or not; you'd have to check. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
I think Dave's got it. Use the struts-el tags if you want to have EL expressions instead of RT expressions (%= ... %) If you want/have to stick with RT, then you'd need this instead of ${status.index} %= ((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex() % K.C. Dave Newton wrote: [EMAIL PROTECTED] wrote: Niether solution works... The expression is never evaluated. The output is: select name=historyItems[2].scheduleTypeId onchange=addTableRow('historyTable','sc:out value='${status.index}'/') class=dropdowns2 Are you using the EL version of the struts tags? Dave - 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: JSTL simply love it however ...
[EMAIL PROTECTED] wrote the following on 4/14/2005 12:03 PM: Okay... I am not using the Struts EL taglibs. Should I be using them? I think you should. Makes the code a lot cleaner. Remember if you are using a JSP2.0 container (ie Tomcat 5), just use the regular html tags (not the el ones). (Then you can do what Abdullah demonstrated). -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
Okay... I tried the following: html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 onchange=addTableRow('historyTable', 's%=((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex()%') html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select and I get this error: Error 500: /WEB-INF/personal/timeAndAttendance/cWWHistory.jsp(215,129) Attribute status has no value I'd really like to get this working, I will then spend some time looking into upgrading to a later version of Struts ti use the EL tags. This upgrade will give me more work than I had anticipated... but in the end it is GOOD extra work ! : I think Dave's got it. Use the struts-el tags if you want to have EL expressions instead of RT expressions (%= ... %) If you want/have to stick with RT, then you'd need this instead of ${status.index} %= ((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex() % K.C.
Re: JSTL simply love it however ...
I think that with RT the attribute is all expression or no expression. so try : html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 onchange=% = addTableRow('historyTable', 's + ((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex() + ') % I'm not sure if i parsed your intention correctly, but the idea is that the attribute should be all expression. a simpler example: wrong - sometag value=this is a %= beanName.getValue() % right - sometag value=%= this is a + beanName.getValue() % dave On Thu, 2005-04-14 at 12:42, [EMAIL PROTECTED] wrote: Okay... I tried the following: html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 onchange=addTableRow('historyTable', 's%=((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex()%') html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select and I get this error: Error 500: /WEB-INF/personal/timeAndAttendance/cWWHistory.jsp(215,129) Attribute status has no value I'd really like to get this working, I will then spend some time looking into upgrading to a later version of Struts ti use the EL tags. This upgrade will give me more work than I had anticipated... but in the end it is GOOD extra work ! : I think Dave's got it. Use the struts-el tags if you want to have EL expressions instead of RT expressions (%= ... %) If you want/have to stick with RT, then you'd need this instead of ${status.index} %= ((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex() % K.C. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL simply love it however ...
Umh... I am now getting this error: Attribute addTableRow( has now value. I have downloaded the Struts 1.2.4 and noticed that there is a lib directory and then there is a contrib/lib. What is necessary to use the Struts-EL tags? I think that with RT the attribute is all expression or no expression. so try : html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 onchange=% = addTableRow('historyTable', 's + ((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex() + ') % I'm not sure if i parsed your intention correctly, but the idea is that the attribute should be all expression. a simpler example: wrong - sometag value=this is a %= beanName.getValue() % right - sometag value=%= this is a + beanName.getValue() % dave
Re: JSTL simply love it however ...
The error is suggesting that it can't find an entry for status in the page scope of your page. Do you still have the c:forEach in there? If you have the scope attribute, make sure it's set to page. Otherwise you'll have to replace pageContext with request, or session depending on your choice of scope. K.C. [EMAIL PROTECTED] wrote: Okay... I tried the following: html:select name=historyItems property=scheduleTypeId indexed=true styleClass=dropdowns2 onchange=addTableRow('historyTable', 's%=((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex()%') html:optionsCollection name=dynaCWWHistoryForm property= scheduleTypes label=label value=value/ /html:select and I get this error: Error 500: /WEB-INF/personal/timeAndAttendance/cWWHistory.jsp(215,129) Attribute status has no value I'd really like to get this working, I will then spend some time looking into upgrading to a later version of Struts ti use the EL tags. This upgrade will give me more work than I had anticipated... but in the end it is GOOD extra work ! : I think Dave's got it. Use the struts-el tags if you want to have EL expressions instead of RT expressions (%= ... %) If you want/have to stick with RT, then you'd need this instead of ${status.index} %= ((javax.servlet.jsp.jstl.core.LoopTagStatus) pageContext.getAttribute(status)).getIndex() % K.C. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]