Caroline,

Have you tried the following?:

<c:set var="threadBean" value="${requestScope.ThreadBean}" />
<c:set var="threadID_int value="some int value" />

<c:if test="${threadBean.threadID != threadID_int}">
        <!-- Do something -->
</c:if>


-----Original Message-----
From: Caroline Jen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 29, 2004 1:12 AM
To: Struts Users Mailing List
Subject: Re: Converting Java Code in JSP to JSTL


I pass an object ThreadBean from an action servlet in
a request scope:

request.setAttribute( "ThreadBean", threadBean );

In my JSP, there is no problem and everything works
well if I use scripting element:

<%
ThreadBean threadBean  = ( ThreadBean
)request.getAttribute( "ThreadBean" );
%>

I then re-write the above statement to:

<c:set var="threadBean"
value="${requestScope.ThreadBean}" />

when I tried to use the properties of the threadBean:

if ( threadID_int != threadBean.getThreadID() ) {}

I got compilation error "illegal start of expression".
 Why JSTL does not work?


--- Ron Grabowski <[EMAIL PROTECTED]> wrote:
> > 1. what is the JSTL equivalent of the <%else {%>
> ...
> > <%}%> tag?
> 
> The c:choose, c:when, and c:otherwise tags:
> 
>  http://tinyurl.com/2kqlz
> 
> > 2. how to write a <html:link ....> tag to replace
> the
> > <a href ... > tag while passing a number of
> > parameters?
> 
> You could do this:
> 
>  <c:url var="listThreadsUrl" value="listthreads">
>   <c:param name="sort" value="${sort}"/>
>   <c:param name="order" value="${order}"/>
>   <c:param name="offset" value="${offset}"/>
>  </c:url>
> 
>  <a href='<c:out value="${listThreadsUrl}"/>'>
>   Click Me
>  </a>
> 
> Depending on how your Actions are setup you may be
> able to do this:
> 
> <html-el:link action="${listThreadUrl}">
>  Click Me
> </html-el>
> 
> James Mitchell gave this example a few weeks ago:
> 
> > <jsp:useBean id="myLinkParams"
> class="java.util.HashMap"/>
> > <c:set target="${myLinkParams}" property="id"
> value="${dto.id}"/>
> > <c:set target="${myLinkParams}" property="type"
> value="edit"/>
> > 
> > ...later down the page...
> > 
> >      <html:link action="/manageUserAccount"
> > name="myLinkParams">
> >          <bean:message key="edit.user.link.text"/>
> >      </html:link>
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
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]

Reply via email to