我正在使用<rich:fileupload>
,我需要向我的控制器发送一些额外的参数。我试着用<f:param>
这个。
这是视图:
<rich:fileUpload
fileUploadListener="#{fileUploadController.listener}"
maxFilesQuantity="#{fileUploadController.uploadsAvailable}"
addControlLabel="Hinzufügen"
uploadControlLabel="Hochladen"
cancelEntryControlLabel="Abbrechen"
doneLabel="Fertig"
clearAllControlLabel="Alle entfernen"
noDuplicate="true"
stopControlLabel="Stop"
clearControlLabel="Entfernen"
id="upload"
immediateUpload="#{fileUploadController.autoUpload}"
ajaxSingle="true"
acceptedTypes="jpg"
allowFlash="#{fileUploadController.useFlash}"
rerender="info">
<a4j:support event="onuploadcomplete" reRender="info" status="globalStatus" />
<f:param
value="#{imageFormat}"
name="#{fileUploadController.imageFormat}"/>
</rich:fileUpload>
这是FileUploadController
支持bean:
private String imageFormat;
public void setImageFormat(String imageFormat) {
this.imageFormat = imageFormat;
}
public String getImageFormat() {
return imageFormat;
}
但是,setter 永远不会被调用,所以变量总是null
. 具有正确的#{imageFormat}
值,我用<h:outputText>
.
我不能使用<a4j:param>
,因为没有可以挂接的按钮。
我们使用的是 JSF 1.2,而不是 JSF 2.0。