[ http://issues.apache.org/jira/browse/MYFACES-980?page=comments#action_12361259 ]
shi nong commented on MYFACES-980: ---------------------------------- Thanks for your kindess and efficiency first. I make a further test, I found that may be the problem when using tile. I modify the page use single page , and it work fine. But when I use tile to config my page layout , the problem occur.I need to debug again. And I test on 1.0.9 and 1.1.1, the behaviour is same. this is the correct page : <%@ page session="true" contentType="text/html;charset=GBK"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %> <html> <f:view> <HEAD> <title><h:outputText value=".........."/></title> <meta http-equiv="Content-Type" content="text/html;charset=GBK"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> </HEAD> <body> <h:form> <h:panelGrid columns="3" width="100%"> <h:outputLabel for="qc_insert_index_number" value="指标编号 : "/> <h:inputText id="qc_insert_index_number" value="#{tyjqjBSO.tyjqj.indexNumber}" required="true"> <f:validateLength minimum="4" maximum="8"/> <f:validator validatorId="cn.ccb.narmis.jsf.keyValidator"/> </h:inputText> <h:message for="qc_insert_index_number"/> <h:outputLabel for="qc_insert_index_name" value="指标名称 : " /> <h:inputText id="qc_insert_index_name" value="#{tyjqjBSO.tyjqj.indexName}" required="true"> <f:validateLength minimum="1" maximum="20"/> </h:inputText> <h:message for="qc_insert_index_name" /> ........................ <h:commandButton id="yjqjInsertOk" value=" 提 交 " action="#{tyjqjBSO.insert}" styleClass="buttons" /> <h:commandButton id="yjqjInsertCancel" value=" 重 置 " type="reset" styleClass="buttons" /> </h:panelGrid> </h:form> </body> </f:view> </html> and the bean "tyjqjBSO" is session scope. This is the error pages: tile definition in tiles.xml <definition name="layout.narmis.normal" path="/comm/normal_template.jsp" > <put name="normal_header" value="/comm/normal_header.jsp" /> <put name="normal_footer" value="/comm/normal_footer.jsp" /> </definition> normal_template.jsp: <%@ page contentType="text/html; charset=GBK" %> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %> <%@ taglib prefix="x" uri="http://myfaces.apache.org/extensions" %> <%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%> <tiles:importAttribute scope="request"/> <html> <f:loadBundle basename="common_messages" var="msgs"/> <head> <meta http-equiv="Content-Type" content="text/html;charset=GBK"> <meta http-equiv="Pragma" content="no-cache"> <title><h:outputText value="#{msgs.system_chinese}"/></title> </head> <body> <f:view> ...... <f:facet name="header"> <f:subview id="normal_body" > <tiles:insert attribute="normal_header" flush="false"/> </f:subview> </f:facet> <f:facet name="body"> <h:panelGrid columns="1" width="100%" cellpadding="0" cellspacing="0" style="vertical-align:top;padding-left:0px;padding-top:0px;margin-left:0px;marign-top:0px"> <f:subview id="normal_content" > <tiles:insert attribute="normal_content" flush="false"/> </f:subview> </h:panelGrid> </f:facet> <f:facet name="footer"> <f:subview id="normal_footer" > <tiles:insert attribute="normal_footer" flush="false"/> </f:subview> </f:facet> ........ </f:view> </body> </html> testaddtitle.jsp : <%@ page contentType="text/html; charset=GBK" %> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %> <%@ taglib prefix="x" uri="http://myfaces.apache.org/extensions" %> <%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%> <tiles:insert definition="layout.narmis.normal" flush="false"> <tiles:put name="module_title" type="string" value="『 test 』" /> <tiles:put name="normal_content" value="/testaddtile_content.jsp" /> </tiles:insert> testaddtitle_content.jsp : <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %> <%@ taglib prefix="x" uri="http://myfaces.apache.org/extensions"%> <%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%> <h:form> <h:panelGrid columns="3" width="100%"> <h:outputLabel for="qc_insert_index_number" value="指标编号 : "/> <h:inputText id="qc_insert_index_number" value="#{tyjqjBSO.tyjqj.indexNumber}" required="true"> <f:validateLength minimum="4" maximum="8"/> <f:validator validatorId="cn.ccb.narmis.jsf.keyValidator"/> </h:inputText> <h:message for="qc_insert_index_number"/> <h:outputLabel for="qc_insert_index_name" value="指标名称 : " /> <h:inputText id="qc_insert_index_name" value="#{tyjqjBSO.tyjqj.indexName}" required="true"> <f:validateLength minimum="1" maximum="20"/> </h:inputText> <h:message for="qc_insert_index_name" /> ...................... <h:commandButton id="yjqjInsertOk" value=" 提 交 " action="#{tyjqjBSO.insert}" styleClass="buttons" /> <h:commandButton id="yjqjInsertCancel" value=" 重 置 " type="reset" styleClass="buttons" /> </h:panelGrid> </h:form> Is it any wrong ? By the way, when the error message is shown, it shows as these format : compoent-id : error message. Can we change the paramter to show a label for component-id? > the implementation problem of validation > ----------------------------------------- > > Key: MYFACES-980 > URL: http://issues.apache.org/jira/browse/MYFACES-980 > Project: MyFaces > Type: Bug > Components: Implementation > Versions: 1.0.9m9, 1.1.1 > Reporter: shi nong > > Recently I compare the Sun's JSF RI and Myfaces, I found one problem of > myfaces. > If you page has many input tags with validation , just like below > > <h:inputText id="qc_1" value="#{tyjqj.indexNumber}" > required="true"> > <f:validateLength minimum="4" maximum="8"/> > </h:inputText> > <h:inputText id="qc_2" value="#{tyjqj.indexName}" required="true"> > <f:validateLength minimum="1" maximum="20"/> > </h:inputText> > when submit page, and not every validation is passed, the pre-input value > in the return page will be clear, but in Sun's JSF Ri, only invalidated > input is clear, and others are remained. I think remaining the correct value > is a better choice, consider the scene , if one user type 20 fields, only > one error, but you clear all 20 fields, it would make the user boring. > so , can myfaces provide a flag or attribute to configure the behaviour > style, remain the correct value or clear all. > -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
