Postgresql javax.el.PropertyNotWritableException值=”处设置操作的语法非法#{request.getParameter(';code';)};
我有一个Primefaces数据表,在数据库中搜索。结果显示在datatable中,您可以单击该行末尾的按钮,该行将在另一个页面上发送给您,您可以在该页面上对其进行编辑。 我对最后一部分有意见。我尝试使用inplace,但当我单击末尾或行中的edit按钮时,我无法在下一页中获取当前元素。我试着在下一页上发送当前元素的id,但无效。我试过用f:param,效果很好。。。直到我按下保存按钮。我遇到以下问题:Postgresql javax.el.PropertyNotWritableException值=”处设置操作的语法非法#{request.getParameter(';code';)};,postgresql,primefaces,getparameter,Postgresql,Primefaces,Getparameter,我有一个Primefaces数据表,在数据库中搜索。结果显示在datatable中,您可以单击该行末尾的按钮,该行将在另一个页面上发送给您,您可以在该页面上对其进行编辑。 我对最后一部分有意见。我尝试使用inplace,但当我单击末尾或行中的edit按钮时,我无法在下一页中获取当前元素。我试着在下一页上发送当前元素的id,但无效。我试过用f:param,效果很好。。。直到我按下保存按钮。我遇到以下问题: 09:20:02,254 SEVERE [javax.enterprise.resource
09:20:02,254 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (default task-80) javax.faces.component.UpdateModelException: javax.el.PropertyNotWritableException: /SmPestsEditable.xhtml @37,74 value="#{request.getParameter('code')}": Illegal Syntax for Set Operation
SmPestsList.xhtml:
<p:dataTable id="pestsTbl" var="zuzek" value="#{smPestsList.pests}" editable="true"
style="margin-bottom:40px">
<f:facet name="header">
PESTS
</f:facet>
<p:column headerText="Id">
<h:outputText value="#{zuzek.idPest}" />
</p:column>
<p:column headerText="Code">
<h:outputText value="#{zuzek.code}" />
</p:column>
<p:column headerText="Latin Name">
<h:outputText value="#{zuzek.latinName}" />
</p:column>
<p:column headerText="Image Recognition">
<h:outputText value="R-CNN"
rendered="#{zuzek.imgRecognition eq 1900}" />
<h:outputText value="NONE - COPY MARKINGS"
rendered="#{zuzek.imgRecognition eq 1951}" />
<h:outputText value="SEGMENTATION"
rendered="#{zuzek.imgRecognition eq 1899}" />
</p:column>
<p:column headerText="Hide score">
<h:outputText value="#{zuzek.hideScore}" />
</p:column>
<p:column>
<p:linkButton outcome="SmPestsEditable" update="pestsListEdit" value="Edit" style="font-size:3em" title="edit">
<f:param name="id" value="#{zuzek.idPest}" />
<f:param name="code" value="#{zuzek.code}" />
<f:param name="lname" value="#{zuzek.latinName}" />
<f:param name="irecog" value="#{zuzek.imgRecognition}" />
</p:linkButton>
</p:column>
</p:dataTable>
害虫
SmPestsEditable.xhtml:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<f:metadata>
<f:viewParam name="id" value="#{smPestsEditable.id}" />
<f:viewParam name="code" value="#{smPestsEditable.code}" />
<f:viewParam name="lname" value="#{smPestsEditable.latinName}" />
<f:viewParam name="irecog" value="#{smPestsEditable.imgRecognition}" />
</f:metadata>
<h:messages />
<h:head></h:head>
<h:body>
<style type="text/css">
.ui-row-editor .ui-row-editor-pencil {
margin-left:8px;
}
</style>
<h:form id="pestsListEdit">
<p:growl id="msgs" showDetail="true" />
<p:panel id="SearchPest" header="EDIT PEST" toggleable="true"
closable="true" toggleSpeed="500" closeSpeed="500" widgetVar="panel"
style="margin-bottom:20px">
<p:panelGrid columns="2">
<h:outputLabel for="Id" value="Id" />
<h:outputText value="#{request.getParameter('id')}"/>
<h:outputLabel for="Id" value="Id" />
<p> View parameter is "#{smPestsEditable.id}"
</p>
<h:outputLabel for="Code" value="Code" />
<p:inplace id="Code" editor="true">
<p:inputText value="#{request.getParameter('code')}" label="Code" />
</p:inplace>
<h:outputLabel for="" value="Latin Name" />
<p:inplace id="Latin">
<p:inputText value="#{request.getParameter('lname')}" label="Latin name" />
</p:inplace>
<h:outputLabel for="Recog" value="Image Recognition" />
<p:inplace id="Recog" label="Image Recognition" event="dblclick" value=#{request.getParameter('irecog')}" >
<h:selectOneMenu id="selectOne">
<f:selectItem itemLabel="SEGMENTATION" itemValue="1899" />
<f:selectItem itemLabel="R-CNN" itemValue="1900" />
<f:selectItem itemLabel="NONE - COPY MARKINGS" itemValue="1951" />
</h:selectOneMenu>
</p:inplace>
<f:facet name="footer">
<p:commandButton value="SAVE"
actionListener = "#{smPestsEditable.saveButton}"
action = "SmPestsList?faces-redirect-true" />
<p:linkButton outcome="SmPestsList" value="CLOSE"
style="margin-right:20px;">
</p:linkButton>
</f:facet>
</p:panelGrid>
</p:panel>
<p:dataTable var="ime" value="#{smPestsEditable.imena}">
<p:column headerText="ID PEST NAME">
<h:outputText value="#{ime.idPestName}" />
</p:column>
<p:column headerText="LANGUAGE">
<h:outputText value="Srpski"
rendered="#{ime.idLanguage eq 12}" />
<h:outputText value="Français"
rendered="#{ime.idLanguage eq 13}" />
<h:outputText value="Italiano"
rendered="#{ime.idLanguage eq 8}" />
<h:outputText value="Slovensko"
rendered="#{ime.idLanguage eq 1}" />
<h:outputText value="English"
rendered="#{ime.idLanguage eq 4}" />
<h:outputText value="Português"
rendered="#{ime.idLanguage eq 9}" />
<h:outputText value="Deutsch"
rendered="#{ime.idLanguage eq 11}" />
<h:outputText value="Magyar"
rendered="#{ime.idLanguage eq 10}" />
<h:outputText value="Português"
rendered="#{ime.idLanguage eq 14}" />
<h:outputText value="Yкраїнський"
rendered="#{ime.idLanguage eq 15}" />
</p:column>
<p:column headerText="DISPLAY NAME">
<p:inplace id="name">
<p:inputText value="#{ime.name}" label="Name" />
</p:inplace>
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
.ui行编辑器.ui行编辑器铅笔{
左边距:8px;
}
视图参数为“#{smPestsEditable.id}”
只是在Stackoverflow中搜索,alraedy多次讨论了此异常的含义。
@Named(value="smPestsEditable")
@RequestScoped
public class SmPestsEditable {
private List<SmPestsNames> pests = new ArrayList<SmPestsNames>();
private EntityManager em =null;
private EntityManagerFactory emf = Persistence.createEntityManagerFactory("tvTutorialPU");
private int stevilka;
private int id;
private int idPest=77;
SmPests zuzek1=loadPestById(idPest);
private String code = zuzek1.getCode();
private String oldCode = code;
private String latinName = zuzek1.getLatinName();
private String oldLatinName = latinName;
private String refLink = zuzek1.getRefLink();
private String oldRefLink = refLink;
private Integer imgRecognition = zuzek1.getImgRecognition();
private Integer oldImgRecognition = imgRecognition;
private Integer hideScore = zuzek1.getHideScore();
private Integer oldHideScore = hideScore;
private Integer recognitionModel = zuzek1.getRecognitionModel();
private Integer oldRecognitionModel = recognitionModel;
private Double alarmThresholdUp = zuzek1.getAlarmThresholdUp();
private Double oldAlarmThresholdUp = alarmThresholdUp;
private Double alarmThresholdLow = zuzek1.getAlarmThresholdLow();
private Double oldAlarmThresholdLow = alarmThresholdLow;
List<SmPestsNames> imena = zuzek1.getSmPestsNames();
private Long idPestName;
private int idLanguage;
private String name;
private LocalDateTime dInsert;
private Long idInserter;
private LocalDateTime dUpdate;
private Long idUpdater;
SmPests zuzek;
public void saveButton() {
System.out.println("SAVE button");
}
private SmPests loadPestById(int id) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("tvTutorialPU");
EntityManager em = emf.createEntityManager();
SmPests zuzek = em.find(SmPests.class, id);
return zuzek;
}