struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Thiebaud <cthieb...@stylo.it>
Subject kind of inconsistency in the handling of <struts-form:form> node content
Date Wed, 08 Nov 2000 08:23:02 GMT
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

Mime
View raw message