我不确定从哪里开始,但基本上,我有一个将值保存到数据库的应用程序。我想要的是将某个用户的行中的所有值相加,然后除以13得到平均值
这就是我目前可以显示所选用户的所有值的方式:
<p:outputLabel value="#{bundle.labelEditMarkSectionTwo}"/>
<p:inputText id="mark2"
value="#{markingBean.markToEdit.markSectionTwo}"
required="true"
maxlength="3"
requiredMessage="Mark for section 2 is requried."
converterMessage="Must be a number greater than zero and less than 100" >
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionThree}"/>
<p:inputText id="mark3"
value="#{markingBean.markToEdit.markSectionThree}"
required="true"
maxlength="3"
requiredMessage="Mark for section 3 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionFour}"/>
<p:inputText id="mark4"
value="#{markingBean.markToEdit.markSectionFour}"
required="true"
maxlength="3"
requiredMessage="Mark for section 4 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionFive}"/>
<p:inputText id="mark5"
value="#{markingBean.markToEdit.markSectionFive}"
required="true"
maxlength="3"
requiredMessage="Mark for section 5 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionSix}"/>
<p:inputText id="mark6"
value="#{markingBean.markToEdit.markSectionSix}"
required="true"
maxlength="3"
requiredMessage="Mark for section 6 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionSeven}"/>
<p:inputText id="mark7"
value="#{markingBean.markToEdit.markSectionSeven}"
required="true"
maxlength="3"
requiredMessage="Mark for section 7 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionEight}"/>
<p:inputText id="mark8"
value="#{markingBean.markToEdit.markSectionEight}"
required="true"
maxlength="3"
requiredMessage="Mark for section 8 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionNine}"/>
<p:inputText id="mark9"
value="#{markingBean.markToEdit.markSectionNine}"
required="true"
maxlength="3"
requiredMessage="Mark for section 9 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
<p:outputLabel value="#{bundle.labelEditMarkSectionTen}"/>
<p:inputText id="mark10"
value="#{markingBean.markToEdit.markSectionTen}"
required="true"
maxlength="3"
requiredMessage="Mark for section 10 is requried.">
<f:validateLongRange minimum="0" maximum="100"/>
<p:ajax update="save"
listener="#{markingBean.editChange}"
event="keydown"/>
</p:inputText>
</p:panelGrid>
这只显示所有13个值
我想要做的是平均所有这些标记的总和,然后能够将此值传递回数据库
因此用户按下计算,该值将显示在
下方传递价值是我能做的事情,但我不能做的是计算
谢谢你们