我有一个Netbeans 7.4 / Jdk7 / Tomcat7的项目。
Project在前端使用Spring框架,在后端使用soap WCF服务。我声明,服务中的一种方法存在问题。我可以在Spring中获得此方法而不会出现任何编译错误,但是当我尝试运行该项目时会抛出异常:
org.apache.jasper.JasperException:无法为JSP编译类:
,方法isIsPosUser()未定义
在jsp文件中的行:30处发生错误:/ WEB-INF/jsp/include/page_header.jsp
对于UserInfo类型
我的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);
}
}
在spring app中生成导入的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;
}
}
我尝试在身份验证后在jsp文件中获取此值:
<%
SoapUsernamePasswordAuthenticationToken retVal = (SoapUsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
UserInfo userInfo = retVal.getUserInfo();
boolean isPosUser = userInfo.isIsPosUser();
%>
这里抛出异常。如果我从我的spring应用程序中删除此方法调用,一切正常。问题出在userInfo.isIsPosUser();但无法弄清楚是什么原因。
提前致谢!
答案 0 :(得分:1)
您在scriptlet中错过了类型化的issUes()
boolean isPosUser = userInfo.IsPosUser();
而不是:
boolean isPosUser = userInfo.isIsPosUser();