If I understand you question correctly, you want to dynamically determine whether to 
display the data in an editable manner or not.

You could save the condition (that determines whether to allow edits or not) in the 
form bean and then do something like:

<logic:equal property="canEdit" value="true">
  <%-- Editable version goes here --%>
</logic:equal>
<logic:equal property="canEdit" value="false">
  <%-- Non-editable version goes here --%>
</logic:equal>

At any given time either the editable or the non-editable version will be displayed.  
There are a variety of tags in the <logic> library.  You can try equal, match, present 
etc.

Sri

-----Original Message-----
From: Tom Klaasen [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 26, 2002 9:09 AM
To: [EMAIL PROTECTED]
Subject: Editable/non-editable fields


Hi all,

It's been some time, but it seems I'm back :)

I'm currently working on a project where lots of forms are used. The forms are backed 
up by a DB. Somewhere in the DB, there is a table which tells me which fields should 
be editable and which shouldn't (they should only be displayed).

Until now, we were looking in the db manually, and changing tags if some field changed 
from editable to non-editable.

We want to change that: let our application look in the db and decide whether the 
current property should be editable or not.

I've already implemented this for html:text fields (which was fairly trivial), but now 
I want to do this for html:select fields also. This seems to be less trivial to say 
the least.

I just looked around on the net and found http://struts.application-servers.com, but 
it seems to be too restricting in terms of layout and granularity.

Does anybody has any pointers on solutions for editable/non-editable fields? Basically 
I want one tag that can decide whether it's editable or not (based on business logic 
that I provide). Eg a text tag that is editable would generate the same output as 
html:text, if it's not editable it would be a bean:write followed by a html:hidden.

(I've used struts some months ago, and I'm not totally up to speed with its recent 
developments, so please forgive me if this is a trivial question.)

Any pointers are appreciated!

Thanks,
tomK


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