struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Gallaway <geof...@geoffeg.org>
Subject Easier/simplier way to do read-only versions of pages?
Date Fri, 14 Sep 2007 19:17:39 GMT
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message