gpt4 book ai didi

java - JSF 实体转换错误 : rich suggestionbox Conversion Error setting value '*' for 'null Converter'

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:00:48 24 4
gpt4 key购买 nike

我正在使用 rich:suggestionbox

  • 从建议框中选择一个建议
  • 然后保存我的表单
  • 它引发验证错误说 rich suggestionbox Conversion Error setting value '568-UNIMED-2005' for 'null Converter'

我需要帮助

  • 我的代码有什么问题?
  • 如何解决问题?

这是我的LcInfo bean

@AutoCreate
@Scope(ScopeType.CONVERSATION)
@Name("lcInfo")
@Entity
@Table(name="lc_info")
public class LcInfo implements Serializable {
private static final long serialVersionUID = 1L;

private Integer id;
private ItemIndentMast itemIndentMastBean;

public LcInfo() {
}


@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(unique=true, nullable=false)
public Integer getId() {
return this.id;
}

public void setId(Integer id) {
this.id = id;
}

//bi-directional many-to-one association to ItemIndentMast
@ManyToOne
@JoinColumn(name="item_indent_mast", nullable=false)
public ItemIndentMast getItemIndentMastBean() {
return this.itemIndentMastBean;
}

public void setItemIndentMastBean(ItemIndentMast itemIndentMastBean) {
this.itemIndentMastBean = itemIndentMastBean;
}


@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}

@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null) return false;
if (getClass() != object.getClass()) return false;
LcInfo other = (LcInfo) object;
return id.equals(other.id);
}


}

这是我的带有 rich:suggestionbox 的 XHTML 源代码。

            <h:inputText value="#{lcInfo.itemIndentMastBean}" id="itemIndentMastBean" required="true"/>
<rich:suggestionbox for="itemIndentMastBean"
suggestionAction="#{lcInfoController.suggestion}"
var="result"
fetchValue="#{result}"
minChars="3"
nothingLabel="No capitals found" >
<f:facet name="header">
<h:outputText value="Select Indent Number" style="font-size: 10px; padding-left: 5px"/>
</f:facet>
<h:column>
<h:outputText value="#{result}" />
</h:column>
</rich:suggestionbox>

这是 Controller 代码如何从 Controller 加载建议

@Name("lcInfoController")
@Scope(ScopeType.CONVERSATION)
@AutoCreate
public class LcInfoController {


public List<ItemIndentMast> suggestion(Object query) {
String queryText = query.toString();
if(StringUtils.isBlank(queryText) || queryText.length() < 3) {
return Collections.emptyList();
}

return itemIndentMastService.filterIndent(queryText+"%");
}

}

最佳答案

这是我最后想到的:Seam: Creating a custom converter

关于java - JSF 实体转换错误 : rich suggestionbox Conversion Error setting value '*' for 'null Converter' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7137083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com