Wendy, Thanks so much for your response. Sorry I have replied until now Ive had my head down trying to get the coding done. I used the
<c:set var="jstlName"> <bean:write name="myDynaBean" property="name" /> </c:set> <c:out value="${jstlName}"> trick for the demo version. I will revisit this this week with a view to hopefully using the DynaActionForms technique. Im using tomcat 5 by the way. Charles Quoting Wendy Smoak <[EMAIL PROTECTED]>: > From: <[EMAIL PROTECTED]> > > > We're using Struts and Dynabeans to pass data from DB to the view > tier. > > What Servlet container and version are you using? (The real question > is, > what version of the Servlet specification does it support?) It's > becoming > more and more important to state that up front... I don't want to > give the > usual > "use JSTL 1.0 and Struts-EL" speech, only to find out that you're > on > Tomcat 5. > > > So my first question is how can I check the value in a Dynabean > against > > a value in session scope? > > Say for example I have the active session ID in a session scoped > > variable called sectID and a bean containing the rows from the main > query: > > > > <logic:equal name="row" property="sect_id" > > value="<% request.getAttribute("sectID") %>"> > > > > (which doesn't work, of course). > > Well... actually it _would_ if you'd make that: > <logic:equal name="myBean" property="name" > value="<%= request.getAttribute("someName") %>"> > (Note the <%= instead of <% in 'value'. ) > > > I wondered about using jstl to do this > > and thereby avoiud the scriptlet but it was beyond me how I could > get it > > to work with the Dynabean. > > I don't think JSTL 1.0 and DynaBean will work together: > > http://www.mail-archive.com/commons- [EMAIL PROTECTED]/msg00864.html > That's an old message, but I did a quick test with Tomcat > 4.1/BeanUtils 1.6 > and was not able to access a LazyDynaBean property with JSTL. So I > think it > still holds for that combination. > > Take a look at the Struts DynaActionForm classes and see what they > did to > fix the problem... there is a 'getMap()' method, so you can get to > the > properties with JSTL: > <c:out value="${myForm.map.propName}"/> > or <c:out value="${myForm.map['propName']}"/> > > The Struts tags _do_ recognize DynaBeans, > <bean:write name="myDynaBean" property="name" /> > but then you're back to needing an expression in the <logic:equal> > 'value' > attribute. > > This is ugly, but it works: > <c:set var="jstlName"> > <bean:write name="myDynaBean" property="name" /> > </c:set> > <c:out value="${jstlName}"> > > I've never needed to do this, so there may be another combination of > things > that will get you what you need. > > As for comparing objects, <logic:equal> turns into: > <c:if test="${someObj.prop eq someRequestAttr}"> ... </c:if> > > -- > Wendy Smoak > > > > --------------------------------------------------------------------- > 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]