You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Christophe Thiebaud <ct...@stylo.it> on 2000/11/08 09:23:02 UTC

kind of inconsistency in the handling of node content

I would like to point out what appear to me as a light/begnin/small
inconsistency.

the code below if from struts example registration.jsp:

<form:form action="saveRegistration.do" name="registrationForm"
            scope="request" type="org.apache.struts.example.RegistrationForm">
[...]
      <logic:equal name="registrationForm" property="action"
                  scope="request" value="Create">
        <form:text property="username" size="16" maxlength="16"/>
      </logic:equal>
      <logic:equal name="registrationForm" property="action"
                  scope="request" value="Edit">
        <bean:write name="registrationForm" property="username"
                   scope="request" filter="true"/>
	<form:hidden property="username"/>
      </logic:equal>
[...]
</form:form>

OK, the basic feature is that in one case, I want to be able to edit the
username field, in the other case I want simply to display it.

what I find odd is that in the second case, I must re-specify the bean name.
Whereas the form:text tag is smart enough to understand that he is in a form
and get the BEAN attribute from the page context, the bean:write tag has
- rightly - no idea of it.

being forced to re-specify the bean is not consistent and error-prone -
I confess that I actually spent some time debugging this very error :( 

would'nt it be nicer to have some kind of read-only, or display-only form:text
variant ? so the jsp would look something like:

<form:form action="saveRegistration.do" name="registrationForm"
            scope="request" type="org.apache.struts.example.RegistrationForm">
[...]
        <form:text property="username" size="16" maxlength="16" 
	read-only= "<logic:equal name="registrationForm" property="action"
		scope="request" value="Create">" /> 
[...]
</form:form>

and the form:text tag would generate appropriate html (<input...> or mere text)
depending on the 'read-only' parameter ?

Christophe