Hello,

I've been looking for a solution that allows me to create form and read-only versions of the same page. Each page will have a version where a logged-in user can enter the data and a version where a non logged in user will only be able to view the data. This is my current solution:

<logic:equal name="readOnly" value="true">
    <bean:write name="myFormBean" property="firstName"/>
</logic:equal>
<logic:equal name="readOnly" value="false">
<html:text property="firstName" maxlength="100" styleClass="textInput"/>
</logic:equal>

That's 6 lines of code for what only needs to be 1 or 2 lines of code. It would be 8 lines if I wrapped it in a logic:present tag to prevent errors if readOnly doesn't get set in the action.

I've received suggestions such as "just set the field to read-only or disabled" but I don't want the user to see the form-elements. I've also been told to use javascript and spin through each field on page load. I don't like relying on javascript for this kind of problem. I've considered extending the standard struts html taglib to allow for a "editMode" tag but if someone has already come up with a good solution I'd like to hear about it.

Thanks,
Geoffeg

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

Reply via email to