You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jonathan Eric Miller <je...@uchicago.edu> on 2005/03/16 21:46:46 UTC

Easy way to make fields in first row of h:dataTable required?

Does anyone know if there is an easy way to make it so that the fields in 
the first row of a h:dataTable are required, while making the remaining rows 
not required?

What I'm wondering is if something similar to the following is possible. 
Note, the "firstRow == true" is just pseudo-code for what I want to do. If I 
remember correctly, JSTL has something like this.

<h:dataTable id="references" value="#{applicationHandler.references}" 
var="reference">
<h:column>
<h:inputText id="name" required="#{firstRow == true}" 
value="#{reference.name}"/>
</h:column>
</h:dataTable>

Failing this, I was thinking I could just have two h:dataTables, one after 
the other, with the first table only containing the first row. However, if 
the column widths are variable, then the columns won't line up correctly.

Jon


Re: Easy way to make fields in first row of h:dataTable required?

Posted by Jonathan Eric Miller <je...@uchicago.edu>.
No problem. Thanks for the pointer anyways. It looks like it does exactly 
what I want, it just doesn't work that's all. ;-)

Jon

----- Original Message ----- 
From: "Heath Borders" <he...@gmail.com>
To: "MyFaces Discussion" <my...@incubator.apache.org>
Sent: Wednesday, March 16, 2005 3:44 PM
Subject: Re: Easy way to make fields in first row of h:dataTable required?


> Sorry, I'm not that well versed in the extended datatable apart from a
> few of its features.


Re: Easy way to make fields in first row of h:dataTable required?

Posted by Heath Borders <he...@gmail.com>.
Sorry, I'm not that well versed in the extended datatable apart from a
few of its features.


On Wed, 16 Mar 2005 15:41:17 -0600, Jonathan Eric Miller
<je...@uchicago.edu> wrote:
> Thanks, I should have checked the extensions documentation first. I figured
> that it would probably be the case that MyFaces would have an extension to
> do that. It would be nice if there was a way using standard JSF to do it
> though. I tried changing my h:dataTable to a x:dataTable, but, I receive the
> following exception when I do so.
> 
> Jon
> 
> Mar 16, 2005 3:33:10 PM com.sun.faces.lifecycle.ApplyRequestValuesPhase
> execute
> SEVERE: 4
> java.lang.ArrayIndexOutOfBoundsException: 4
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTableHack.refreshDescendantDataStates(HtmlDataTableHack.java:174)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:147)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex(HtmlDataTableHack.java:71)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTable.setRowIndex(HtmlDataTable.java:168)
>        at javax.faces.component.UIData.iterate(UIData.java:989)
>        at javax.faces.component.UIData.processDecodes(UIData.java:737)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTable.processDecodes(HtmlDataTable.java:180)
>        at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
>        at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
>        at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
>        at
> javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
>        at
> com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
>        at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
>        at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
>        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> edu.uchicago.at.alt.SessionManager.doFilter(SessionManager.java:41)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:119)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> edu.uchicago.at.servlet.http.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:33)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
>        at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>        at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
>        at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>        at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>        at
> org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:481)
>        at
> org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
>        at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>        at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
>        at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
>        at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
>        at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>        at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>        at java.lang.Thread.run(Unknown Source)
> Mar 16, 2005 3:33:10 PM org.apache.catalina.core.StandardWrapperValve invoke
> SEVERE: Servlet.service() for servlet facesServlet threw exception
> java.lang.ArrayIndexOutOfBoundsException: 4
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTableHack.refreshDescendantDataStates(HtmlDataTableHack.java:174)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:147)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex(HtmlDataTableHack.java:71)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTable.setRowIndex(HtmlDataTable.java:168)
>        at javax.faces.component.UIData.iterate(UIData.java:989)
>        at javax.faces.component.UIData.processDecodes(UIData.java:737)
>        at
> org.apache.myfaces.component.html.ext.HtmlDataTable.processDecodes(HtmlDataTable.java:180)
>        at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
>        at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
>        at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
>        at
> javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
>        at
> com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
>        at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
>        at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
>        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> edu.uchicago.at.alt.SessionManager.doFilter(SessionManager.java:41)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:119)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> edu.uchicago.at.servlet.http.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:33)
>        at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>        at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>        at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
>        at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>        at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
>        at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>        at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>        at
> org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:481)
>        at
> org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
>        at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>        at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
>        at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
>        at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
>        at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>        at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>        at java.lang.Thread.run(Unknown Source)
> 
> ----- Original Message -----
> From: "Heath Borders" <he...@gmail.com>
> To: "MyFaces Discussion" <my...@incubator.apache.org>
> Sent: Wednesday, March 16, 2005 3:08 PM
> Subject: Re: Easy way to make fields in first row of h:dataTable required?
> 
> > If you use the extended datatable, it puts the current rowIndex on the
> > request.
> >
> > You could then make your EL statement like "rowIndex == 0".  However,
> > this is supposing that you aren't paging your data.  It gets a little
> > more complicated in this case, but its still doable.
> >
> >
> > On Wed, 16 Mar 2005 14:46:46 -0600, Jonathan Eric Miller
> > <je...@uchicago.edu> wrote:
> >> Does anyone know if there is an easy way to make it so that the fields in
> >> the first row of a h:dataTable are required, while making the remaining
> >> rows
> >> not required?
> >>
> >> What I'm wondering is if something similar to the following is possible.
> >> Note, the "firstRow == true" is just pseudo-code for what I want to do.
> >> If I
> >> remember correctly, JSTL has something like this.
> >>
> >> <h:dataTable id="references" value="#{applicationHandler.references}"
> >> var="reference">
> >> <h:column>
> >> <h:inputText id="name" required="#{firstRow == true}"
> >> value="#{reference.name}"/>
> >> </h:column>
> >> </h:dataTable>
> >>
> >> Failing this, I was thinking I could just have two h:dataTables, one
> >> after
> >> the other, with the first table only containing the first row. However,
> >> if
> >> the column widths are variable, then the columns won't line up correctly.
> >>
> >> Jon
> >>
> >>
> >
> >
> > --
> > -Heath Borders-Wing
> > hborders@mail.win.org
> >
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org

Re: Easy way to make fields in first row of h:dataTable required?

Posted by Jonathan Eric Miller <je...@uchicago.edu>.
Thanks, I should have checked the extensions documentation first. I figured 
that it would probably be the case that MyFaces would have an extension to 
do that. It would be nice if there was a way using standard JSF to do it 
though. I tried changing my h:dataTable to a x:dataTable, but, I receive the 
following exception when I do so.

Jon

Mar 16, 2005 3:33:10 PM com.sun.faces.lifecycle.ApplyRequestValuesPhase 
execute
SEVERE: 4
java.lang.ArrayIndexOutOfBoundsException: 4
        at 
org.apache.myfaces.component.html.ext.HtmlDataTableHack.refreshDescendantDataStates(HtmlDataTableHack.java:174)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:147)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex(HtmlDataTableHack.java:71)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTable.setRowIndex(HtmlDataTable.java:168)
        at javax.faces.component.UIData.iterate(UIData.java:989)
        at javax.faces.component.UIData.processDecodes(UIData.java:737)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTable.processDecodes(HtmlDataTable.java:180)
        at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
        at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
        at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
        at 
javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
        at 
com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
        at 
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
        at 
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
edu.uchicago.at.alt.SessionManager.doFilter(SessionManager.java:41)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:119)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
edu.uchicago.at.servlet.http.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:33)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at 
org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:481)
        at 
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
        at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
        at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Unknown Source)
Mar 16, 2005 3:33:10 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet facesServlet threw exception
java.lang.ArrayIndexOutOfBoundsException: 4
        at 
org.apache.myfaces.component.html.ext.HtmlDataTableHack.refreshDescendantDataStates(HtmlDataTableHack.java:174)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTableHack.saveDescendantComponentStates(HtmlDataTableHack.java:147)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTableHack.setRowIndex(HtmlDataTableHack.java:71)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTable.setRowIndex(HtmlDataTable.java:168)
        at javax.faces.component.UIData.iterate(UIData.java:989)
        at javax.faces.component.UIData.processDecodes(UIData.java:737)
        at 
org.apache.myfaces.component.html.ext.HtmlDataTable.processDecodes(HtmlDataTable.java:180)
        at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
        at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
        at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
        at 
javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306)
        at 
com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
        at 
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
        at 
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
edu.uchicago.at.alt.SessionManager.doFilter(SessionManager.java:41)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:119)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
edu.uchicago.at.servlet.http.SessionExpiredFilter.doFilter(SessionExpiredFilter.java:33)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at 
org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:481)
        at 
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
        at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
        at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Unknown Source)

----- Original Message ----- 
From: "Heath Borders" <he...@gmail.com>
To: "MyFaces Discussion" <my...@incubator.apache.org>
Sent: Wednesday, March 16, 2005 3:08 PM
Subject: Re: Easy way to make fields in first row of h:dataTable required?


> If you use the extended datatable, it puts the current rowIndex on the 
> request.
>
> You could then make your EL statement like "rowIndex == 0".  However,
> this is supposing that you aren't paging your data.  It gets a little
> more complicated in this case, but its still doable.
>
>
> On Wed, 16 Mar 2005 14:46:46 -0600, Jonathan Eric Miller
> <je...@uchicago.edu> wrote:
>> Does anyone know if there is an easy way to make it so that the fields in
>> the first row of a h:dataTable are required, while making the remaining 
>> rows
>> not required?
>>
>> What I'm wondering is if something similar to the following is possible.
>> Note, the "firstRow == true" is just pseudo-code for what I want to do. 
>> If I
>> remember correctly, JSTL has something like this.
>>
>> <h:dataTable id="references" value="#{applicationHandler.references}"
>> var="reference">
>> <h:column>
>> <h:inputText id="name" required="#{firstRow == true}"
>> value="#{reference.name}"/>
>> </h:column>
>> </h:dataTable>
>>
>> Failing this, I was thinking I could just have two h:dataTables, one 
>> after
>> the other, with the first table only containing the first row. However, 
>> if
>> the column widths are variable, then the columns won't line up correctly.
>>
>> Jon
>>
>>
>
>
> -- 
> -Heath Borders-Wing
> hborders@mail.win.org
> 


Re: Easy way to make fields in first row of h:dataTable required?

Posted by Heath Borders <he...@gmail.com>.
If you use the extended datatable, it puts the current rowIndex on the request.

You could then make your EL statement like "rowIndex == 0".  However,
this is supposing that you aren't paging your data.  It gets a little
more complicated in this case, but its still doable.


On Wed, 16 Mar 2005 14:46:46 -0600, Jonathan Eric Miller
<je...@uchicago.edu> wrote:
> Does anyone know if there is an easy way to make it so that the fields in
> the first row of a h:dataTable are required, while making the remaining rows
> not required?
> 
> What I'm wondering is if something similar to the following is possible.
> Note, the "firstRow == true" is just pseudo-code for what I want to do. If I
> remember correctly, JSTL has something like this.
> 
> <h:dataTable id="references" value="#{applicationHandler.references}"
> var="reference">
> <h:column>
> <h:inputText id="name" required="#{firstRow == true}"
> value="#{reference.name}"/>
> </h:column>
> </h:dataTable>
> 
> Failing this, I was thinking I could just have two h:dataTables, one after
> the other, with the first table only containing the first row. However, if
> the column widths are variable, then the columns won't line up correctly.
> 
> Jon
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org