That being said, you can accomplish what you need using the <bean:define> tag *before* the scriptlet -- bean:define unlike the JSTL tags creates a scripting variable. As Helga would say "Would you like a scripting variable with that, dear?"
Try this ...
<bean:define id="offset" value="offset" scope="request"/> <% offset = 0; try { // do stuff with offset } catch ( Exception e ) { // do nothing } %>
Please, however, try and avoid scriptlet if it not necessary.
Caroline Jen wrote:
Yes, I have:
<%@ taglib uri="/tags/struts-html-el" prefix="html" %> <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
on the top of my page.
--- Can Zheng <[EMAIL PROTECTED]> wrote:
Hi,
did you add the taglib declarations for the prefix "c"
On Thu, 1 Jul 2004 11:30:48 -0700 (PDT), Caroline Jen <[EMAIL PROTECTED]> wrote:
My JSP worked well when I used JSP expressions, scriptlets, .... I tried to use JSTL instead and encountered some compilation problems. I am
unable to
see my mistakes and need help:
Problme #1: [code] int offset = 0; try { <c:set var="offset"
value="${requestScope.offset}"
/> } catch ( Exception e ) { // do nothing } [/code]
The above code has two compilation errors:
Generated servlet error: [javac] Compiling 1 source file
illegal start of expression <c:set var="offset"
value="${requestScope.offset}"
/> ^
Generated servlet error: ';' expected <c:set var="offset"
value="${requestScope.offset}"
/>
^ Problem #2: [code] <c:set var="threadBean" value="${requestScope.ThreadBean}" /> ...... ...... int threadID_int = ParamUtil.getParameterInt(
request,
"thread" ); <c:if test="${threadBean.threadID} !=
threadID_int">
throw new AssertionException( "The two threadID are not the same." ); </c:if> [/code]
Generated servlet error: illegal start of expression <c:if test="${threadBean.threadID !=
threadID_int}">
^
__________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
-- Best regards,
Can Zheng
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]