Struts has logic tags so you don't need to
use your scriptlet at all for this.

See the tag documentation for this.

-- Larry Maturo


-----Original Message-----
From: Esbrook, Scott [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 24, 2001 9:58 AM
To: [EMAIL PROTECTED]
Subject: referring to a formBean property in a scriptlet


Hello,

I'm new to Struts, and really like what I see. I didn't see this in the
docs, so maybe someone can answer this.

I'm working on a small sample app that displays an Employee Id on a form for
maintenance. I need to display the ID as static text if the Employee record
already exists, or in a textfield if the Employee record does not yet exist.
So I put a boolean flag 'isNew' in the formBean. What's the best way to
refer to that flag within a scriptlet? That is,

<% if ( ??FORMBEAN??.getIsNew() ) { %>
   <html:text property="employeeId" size="30" maxlength="30"/>
<% } else { %>
   <%= ??FORMBEAN??.getEmployeeId() %>
<% } %>

Does Struts provide a standard id I can use to refer to my formBean? Or do I
have to put in a 'useBean' directive and access the bean directly?

Thanks,

Scott Esbrook
Software Developer
Compuware Corporation

Reply via email to