Mark (G.),

Try copying and pasting this sucker into a JSP (don't forget the taglib
import):

   <%
      session.setAttribute("foo","bar");
      session.setAttribute("bar","bubba");
   %>
   <logic:equal name='<%= (String)session.getAttribute("foo") %>'
value="bubba">
      You should see this.
   </logic:equal>

That doesn't work for you?  If not, i'd ask for a refund  :)

chris

> -----Original Message-----
> From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 1:07 PM
> To: 'Struts Users Mailing List'
> Subject: RE: message checking
> 
> 
> 2x doh!  How many times do I miss that cast????
> 
> But I also use WLS 6.1SP2 and the single quotes throw an 
> exception every
> time.  Strange.
> 
> -----Original Message-----
> From: Bartley, Chris P [PCS] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 1:31 PM
> To: 'Struts Users Mailing List'
> Subject: RE: message checking
> Importance: Low
> 
> 
> Sorry dude, it's just not your day.
> 
> The single quotes in my example work just fine (at least they 
> do for me on
> Weblogic 6.1).
> 
> Also, for your example to work, you need to cast the object 
> returned by
> getAttribute() to a String (and spell "attribute" correctly  ;-)
> 
> chris
> 
> > -----Original Message-----
> > From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, September 20, 2002 12:09 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: message checking
> > 
> > 
> > Okay, I didn't realize you were getting the values from a properties
> > file...and Chris got me on the double-quotes (doh!), though 
> his single
> > quotes won't work within a Struts tag (na-na-na-na-na!!); the 
> > "key" quotes
> > have to be escaped.
> > 
> > -----Original Message-----
> > From: Bartley, Chris P [PCS] [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, September 20, 2002 1:04 PM
> > 
> > A couple notes:
> > 
> > * Mark's suggestion will only work if you've already put the 
> > message in the
> > session under the "key" attribute.
> > * The mix of double quotes in Mark's code probably won't 
> > work...i believe it
> > should instead read:
> > 
> >    <logic:equal parameter='<%= session.getAtribute("key") %>' 
> > value="true">
> >       You guessed right! You win an auomatic avocado peeler!
> >    </logic:equal>
> > 
> > Maybe try something like this instead (only works with Struts 1.1):
> > 
> >    <bean:define id="foo">
> >       <bean:message key="isThisTheRightValue"/>
> >    </bean:define>
> >    <logic:equal parameter="<%= foo %>" value="true">
> >       You guessed right! You win an auomatic avocado peeler!
> >    </logic:equal>
> > 
> > Or this, if you're using Struts 1.0.2:
> > 
> >    <bean:define id="foo"
> >              value='<%= ((MessageResources)request
> >                     
> .getAttribute("org.apache.struts.action.MESSAGE"))
> >                     .getMessage("isThisTheRightValue") %>'/>
> >    <logic:equal parameter="<%= foo %>" value="true">
> >       You guessed right! You win an auomatic avocado peeler!
> >    </logic:equal>
> > 
> > Hope that helps.
> > 
> > chris
> > 
> > > -----Original Message-----
> > > From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, September 20, 2002 11:39 AM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: message checking
> > > 
> > > 
> > > Instead of using <bean:message> use a scriptlet:
> > > 
> > > <logic:equal parameter="<%= session.getAtribute("key") %>" 
> > > value="true">
> > >   You guessed right! You win an auomatic avocado peeler!
> > > </logic:equal>
> > > 
> > > Mark
> > > 
> > > -----Original Message-----
> > > From: Mark Silva [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, September 20, 2002 12:03 PM
> > > 
> > > i think your visualization/interpretation of one will do it 
> > > more justice
> > > than i can in words ;-)
> > > 
> > > so whats the technique for doing this?
> > > 
> > > thanks,
> > > mark
> > > 
> > > -----Original Message-----
> > > From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, September 20, 2002 4:57 AM
> > > 
> > > Yes, but first, what is an "auomatic" avocado peeler?  Sounds 
> > > like some kind
> > > of Lisp debugger.
> > > 
> > > Mark
> > > 
> > > -----Original Message-----
> > > From: Mark Silva [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, September 19, 2002 6:53 PM
> > > 
> > > is is possible to check for the existence of a message in my 
> > > page, and then
> > > output some html if it is there?  or if it is equal to 
> > > something.  i am
> > > looking to do something like this, (although this code 
> > > doesn't seem to work)
> > > 
> > > <logic:equal parameter="<bean:message key="isThisTheRightValue"/>"
> > > value="true">
> > >   You guessed right! You win an auomatic avocado peeler!
> > > </logic:equal>
> > > 
> > > thanks,
> > > mark
> > > 
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to