gpt4 book ai didi

java - 找不到 JSP 方法 : class java. lang.String

转载 作者:行者123 更新时间:2023-11-30 08:10:20 24 4
gpt4 key购买 nike

我遇到了这个异常,但我找不到解决方案

Controller :

@RequestMapping(value="/sujet")
public String detail(Model model, HttpServletRequest request, Long idSujet) {
Utilisateur user = (Utilisateur) request.getSession().getAttribute("user");
model.addAttribute("nbrMails", metierUtilisateur.listDesEmailsRecuNonLu(user.getIdUtilisateur()).size());

SujetForum sujet = metierSujetForum.findById(idSujet);
sujet.setMessagesForums(metierSujetForum.getListMessageForum(idSujet));

model.addAttribute("sujet", sujet);
model.addAttribute("messages", metierSujetForum.getListMessageForum(idSujet));


return "/coordinateur/detailSujetForum";
}

这是我的 Bean 定义:我为所有属性定义了所有 getter 和 setter,但直到得到相同的异常

@Entity
public class MessagesForum implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idMessage;
private String message;
private Date dateDepotMessage;
private boolean messageCorrecte;

@ManyToOne
@JoinColumn(name = "idSujet")
private SujetForum sujetForum;

@ManyToOne
@JoinColumn(name = "idUtilisateur")
private Utilisateur utilisateur;

@OneToMany(mappedBy = "messageForum")
private Collection<PieceJointeForum> pieceJointeForums;

public MessagesForum(String message, Date dateDepotMessage, boolean messageCorrecte) {
super();
this.message = message;
this.dateDepotMessage = dateDepotMessage;
this.messageCorrecte = messageCorrecte;
}

public MessagesForum() {
super();
}

public Long getIdMessage() {
return idMessage;
}

public void setIdMessage(Long idMessage) {
this.idMessage = idMessage;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

public Date getDateDepotMessage() {
return dateDepotMessage;
}

public void setDateDepotMessage(Date dateDepotMessage) {
this.dateDepotMessage = dateDepotMessage;
}

public boolean isMessageCorrecte() {
return messageCorrecte;
}

public void setMessageCorrecte(boolean messageCorrecte) {
this.messageCorrecte = messageCorrecte;
}

public SujetForum getSujetForum() {
return sujetForum;
}

public void setSujetForum(SujetForum sujetForum) {
this.sujetForum = sujetForum;
}

public Utilisateur getUtilisateur() {
return utilisateur;
}

public void setUtilisateur(Utilisateur utilisateur) {
this.utilisateur = utilisateur;
}

public Collection<PieceJointeForum> getPieceJointeForums() {
return pieceJointeForums;
}

public void setPieceJointeForums(Collection<PieceJointeForum> pieceJointeForums) {
this.pieceJointeForums = pieceJointeForums;
}

}

这是异常的输出

615:                 <div class="media-body">
616: <div class="media-text">
617: <h5 class="semibold mt0 mb5 text-accent"></h5>
618: <p class="mb5">${msg.getIdMessage() }.</p>
619: <!-- meta icon -->
620: <p class="mb0">
621: <span class="media-meta"></span> <span class="mr5 ml5 text-muted">*</span> <a href="javascript:void(0);" class="media-meta text-default" data-t
oggle="tooltip" title="" data-original-title="Reply"><i class="ico-reply"></i></a>


Stacktrace:] with root cause
javax.el.MethodNotFoundException: Method not found: class java.lang.String.getIdMessage()
at javax.el.Util.findWrapper(Util.java:352)
at javax.el.Util.findMethod(Util.java:214)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:174)
at org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:139)
at org.apache.el.parser.AstValue.getValue(AstValue.java:173)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:967)
at org.apache.jsp.WEB_002dINF.views.coordinateur.detailSujetForum_jsp._jspx_meth_c_005fforEach_005f0(detailSujetForum_jsp.java:1242)
at org.apache.jsp.WEB_002dINF.views.coordinateur.detailSujetForum_jsp._jspService(detailSujetForum_jsp.java:832)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

最佳答案

<c:forEach items="=${messages }" var="msg">
<div class="media-list media-list-bubble">
<div class="media">
<a href="javascript:void(0);" class="media-object pull-left"> <img src="" class="img-circle" alt="">
</a>
<div class="media-body">
<div class="media-text">
<h5 class="semibold mt0 mb5 text-accent"></h5>
<p class="mb5">${msg.idMessage }.</p>
<!-- meta icon -->
<p class="mb0">
<span class="media-meta"></span> <span class="mr5 ml5 text-muted">*</span> <a href="javascript:void(0);" class="media-meta text-default" data-toggle="tooltip" title="" data-original-title="Reply"><i class="ico-reply"></i></a>
</p>
<!--/ meta icon -->
</div>

</div>
</div>
</div>
</c:forEach>

关于java - 找不到 JSP 方法 : class java. lang.String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30484442/

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