[英]HTTP Status 500 - Unable to compile class for JSP, The method is undefined
I have a project with Netbeans 7.4/Jdk7/Tomcat7. 我有一个使用Netbeans 7.4 / Jdk7 / Tomcat7的项目。
Project uses Spring framework in front and soap WCF service in backend. Project在前端使用Spring框架,在后端使用soap WCF服务。 There is a problem with one method in service, that I declare. 我声明,服务中的一种方法存在问题。 I can get this method in spring without any compilation errors, but when I try to run the project it throws exception: 我可以在春季获得此方法而没有任何编译错误,但是当我尝试运行项目时,它将引发异常:
org.apache.jasper.JasperException: Unable to compile class for JSP: org.apache.jasper.JasperException:无法为JSP编译类:
An error occurred at line: 30 in the jsp file: /WEB-INF/jsp/include/page_header.jsp jsp文件中的第30行出现错误:/WEB-INF/jsp/include/page_header.jsp
The method isIsPosUser() is undefined for the type UserInfo 未为类型UserInfo定义方法isIsPosUser()
My UserInfo class: 我的UserInfo类:
[Serializable, XmlRoot("user_info")]
[DataContract(Name = "user_info", Namespace = "urn:...")]
public class UserInfo
{
private String _FullName;
private String _EMail;
private bool _IsPosUser;
public UserInfo(string pFullName,
string pEmail)
{
FullName = pFullName;
EMail = pEmail;
}
public UserInfo()
{
//dummy
}
[XmlElement(ElementName = "full_name")]
[DataMember(Name = "full_name")]
public string FullName
{
get { return _FullName; }
set { _FullName = value; }
}
[XmlElement(ElementName = "e_mail")]
[DataMember(Name = "e_mail")]
public string EMail
{
get { return _EMail; }
set { _EMail = value; }
}
[XmlElement(ElementName = "IsPosUser")]
[DataMember(Name = "IsPosUser")]
public bool IsPosUser
{
get { return _IsPosUser; }
set { _IsPosUser = value; }
}
public override string ToString()
{
return string.Format("FullName: {0}, EMail: {1}, IsPosUser: {2}", FullName, EMail, IsPosUser);
}
}
Generated source code of imported wsdl in spring app: 在Spring应用程序中生成导入的wsdl的源代码:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UserInfo", propOrder = {
"fullName",
"eMail",
"isPosUser"
})
public class UserInfo {
@XmlElement(name = "full_name")
protected String fullName;
@XmlElement(name = "e_mail")
protected String eMail;
@XmlElement(name = "IsPosUser")
protected boolean isPosUser;
/**
* Gets the value of the fullName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFullName() {
return fullName;
}
/**
* Sets the value of the fullName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFullName(String value) {
this.fullName = value;
}
/**
* Gets the value of the eMail property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEMail() {
return eMail;
}
/**
* Sets the value of the eMail property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEMail(String value) {
this.eMail = value;
}
/**
* Gets the value of the isPosUser property.
*
*/
public boolean isIsPosUser() {
return isPosUser;
}
/**
* Sets the value of the isPosUser property.
*
*/
public void setIsPosUser(boolean value) {
this.isPosUser = value;
}
}
And I try to get this value in jsp file after authentication: 并在身份验证后尝试在jsp文件中获取此值:
<%
SoapUsernamePasswordAuthenticationToken retVal = (SoapUsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
UserInfo userInfo = retVal.getUserInfo();
boolean isPosUser = userInfo.isIsPosUser();
%>
It throws exception here. 它在这里引发异常。 If I remove this method call from my spring application, everything works fine. 如果我从spring应用程序中删除此方法调用,则一切正常。 The problem is in userInfo.isIsPosUser(); 问题出在userInfo.isIsPosUser();中。 but cannot figure out what is the cause. 但无法找出原因。
Thanks in advance! 提前致谢!
you have missed typed isPosUser() in the scriplet 您错过了在片段中键入isPosUser()的信息
boolean isPosUser = userInfo.IsPosUser();
instead of: 代替:
boolean isPosUser = userInfo.isIsPosUser();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.