JSP 提示错误:The method setUserID(int) is undefined for the type words
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/><title>...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>保存留言</title>
<jsp:useBean class="database.words" id="words" scope="page"/>
</head>
<body>
<%
//获取session中UserID变量的值
String str_UserID = session.getAttribute("UserID").toString();
//设置words中UserID变量的值
words.setUserID(Integer.parseInt(str_UserID));
//获取留言标题
String WordsTitle = request.getParameter("WordsTitle");
//编码转换
WordsTitle=new String(WordsTitle.getBytes("utf-8"));
//设置words中WordsTitle变量的值
words.setWordsTitle(WordsTitle);
//获取留言内容
String WordsContent =request.getParameter("WordsContent");
//编码转换
WordsContent=new String(WordsContent.getBytes("utf-8"));
//设置words中WordsContent变量的值
words.setWordsContent(WordsContent);
//判断保存留言是否成功
if(words.add_words())
{
out.println("<h2 align=center>留言保存成功</h2>");
}
else
{
%>
<h2 align="center">留言保存失败</h2>
<center>
<input type="button" name="goback" value="返回"
onClick="javascript:window.history.go(-1)"/>
</center>
<%
}
%>
</body>
</html>
错误为:The method setUserID(int) is undefined for the type words
请问怎么解决? 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>保存留言</title>
<jsp:useBean class="database.words" id="words" scope="page"/>
</head>
<body>
<%
//获取session中UserID变量的值
String str_UserID = session.getAttribute("UserID").toString();
//设置words中UserID变量的值
words.setUserID(Integer.parseInt(str_UserID));
//获取留言标题
String WordsTitle = request.getParameter("WordsTitle");
//编码转换
WordsTitle=new String(WordsTitle.getBytes("utf-8"));
//设置words中WordsTitle变量的值
words.setWordsTitle(WordsTitle);
//获取留言内容
String WordsContent =request.getParameter("WordsContent");
//编码转换
WordsContent=new String(WordsContent.getBytes("utf-8"));
//设置words中WordsContent变量的值
words.setWordsContent(WordsContent);
//判断保存留言是否成功
if(words.add_words())
{
out.println("<h2 align=center>留言保存成功</h2>");
}
else
{
%>
<h2 align="center">留言保存失败</h2>
<center>
<input type="button" name="goback" value="返回"
onClick="javascript:window.history.go(-1)"/>
</center>
<%
}
%>
</body>
</html>
错误为:The method setUserID(int) is undefined for the type words
请问怎么解决? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询