Unresolved compilation problems:
代码如下:publicclassInfoActionextendsAction{JDBConectionjdbc=newJDBConection();publicActi...
代码如下:
public class InfoAction extends Action {
JDBConection jdbc=new JDBConection();
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception {
JspInfoForm newForm=(JspInfoForm) form;
List list2=new ArrayList();
int userID=newForm.getUserID();
String loginName=newForm.getLoginName();
String passWord=newForm.getPassWord();
newForm.setUserID(userID);
newForm.setUserName(userName);
newForm.setLoginName(loginName);
newForm.setPassWord(passWord);
list2.add(newForm);
InfoAction ina=new InfoAction();
if(request.getParameter("submit").equals("add")){
ina.update(userID,list2);
}else if(request.getParameter("submit").equals("change")){
ina.insert(list2);
}else if(request.getParameter("submit").equals("delete")){
ina.Delete(userID);
}
return mapping.findForward("err");
}
public ActionForward update(int userID,List list2){
List list=jdbc.selectDb();
for(int i=0;i<list.size();i++){
JspInfoForm info=(JspInfoForm)list.get(i);
if(userID==info.getUserID()){
jdbc.deleteDb(userID);
jdbc.insertDb(list2);
jdbc.selectDb();
List list3=jdbc.selectDb();
int infoNumber=list3.size();
ServletRequest request = null;
request.setAttribute("list",list3);
ActionMapping mapping = null;
return mapping.findForward("suc");
}
}
ActionMapping mapping = null;
return mapping.findForward("err");
}
public ActionForward insert(List list2){
jdbc.insertDb(list2);
jdbc.selectDb();
List list3=jdbc.selectDb();
int infoNumber=list3.size();
ServletRequest request = null;
request.setAttribute("list",list3);
ActionMapping mapping = null;
return mapping.findForward("suc");
}
public ActionForward Delete(int userID){
jdbc.deleteDb(userID);
jdbc.selectDb();
List list=jdbc.selectDb();
ServletRequest request = null;
request.setAttribute("list",list);
ActionMapping mapping = null;
return mapping.findForward("suc");
}
}
报错如下:
java.lang.Error: Unresolved compilation problems:
Syntax error on token(s), misplaced construct(s)
Syntax error, insert ";" to complete Statement
com.yourcompany.struts.action.InfoAction.execute(InfoAction.java:65)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 展开
public class InfoAction extends Action {
JDBConection jdbc=new JDBConection();
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws Exception {
JspInfoForm newForm=(JspInfoForm) form;
List list2=new ArrayList();
int userID=newForm.getUserID();
String loginName=newForm.getLoginName();
String passWord=newForm.getPassWord();
newForm.setUserID(userID);
newForm.setUserName(userName);
newForm.setLoginName(loginName);
newForm.setPassWord(passWord);
list2.add(newForm);
InfoAction ina=new InfoAction();
if(request.getParameter("submit").equals("add")){
ina.update(userID,list2);
}else if(request.getParameter("submit").equals("change")){
ina.insert(list2);
}else if(request.getParameter("submit").equals("delete")){
ina.Delete(userID);
}
return mapping.findForward("err");
}
public ActionForward update(int userID,List list2){
List list=jdbc.selectDb();
for(int i=0;i<list.size();i++){
JspInfoForm info=(JspInfoForm)list.get(i);
if(userID==info.getUserID()){
jdbc.deleteDb(userID);
jdbc.insertDb(list2);
jdbc.selectDb();
List list3=jdbc.selectDb();
int infoNumber=list3.size();
ServletRequest request = null;
request.setAttribute("list",list3);
ActionMapping mapping = null;
return mapping.findForward("suc");
}
}
ActionMapping mapping = null;
return mapping.findForward("err");
}
public ActionForward insert(List list2){
jdbc.insertDb(list2);
jdbc.selectDb();
List list3=jdbc.selectDb();
int infoNumber=list3.size();
ServletRequest request = null;
request.setAttribute("list",list3);
ActionMapping mapping = null;
return mapping.findForward("suc");
}
public ActionForward Delete(int userID){
jdbc.deleteDb(userID);
jdbc.selectDb();
List list=jdbc.selectDb();
ServletRequest request = null;
request.setAttribute("list",list);
ActionMapping mapping = null;
return mapping.findForward("suc");
}
}
报错如下:
java.lang.Error: Unresolved compilation problems:
Syntax error on token(s), misplaced construct(s)
Syntax error, insert ";" to complete Statement
com.yourcompany.struts.action.InfoAction.execute(InfoAction.java:65)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 展开
3个回答
展开全部
java.lang.Error: Unresolved compilation problems:
Syntax error on token(s), misplaced constuct(s)
Syntax error, insert ";" to complete Statement
你的构造函数错了吧,少了个分号
Syntax error on token(s), misplaced constuct(s)
Syntax error, insert ";" to complete Statement
你的构造函数错了吧,少了个分号
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
亚果会
2024-04-11 广告
2024-04-11 广告
Goma Greens是一家专注于提供高品质有机蔬果的企业。我们致力于为消费者带来新鲜、健康、无污染的食材,以满足现代人对健康生活的追求。我们的产品均来自精心挑选的有机农场,通过严格的品质控制,确保每一份食材都达到最高标准。此外,我们还提供...
点击进入详情页
本回答由亚果会提供
展开全部
哪个地儿少了个分号。用eclipse吧有语法检查
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Action类貌似没问题,检查一下你的struts配置有没问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询