这个名字应该不会重复吧 2018-12-24 17:46 采纳率: 83.3%
浏览 378
已采纳

#java web#com.struts.action.AdminMemberAction

/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.struts.action;

import java.util.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import com.ORM.*;
import com.base.*;
import com.service.*;

/** 
 * MyEclipse Struts
 * Creation date: 09-15-2007
 * 
 * XDoclet definition:
 * @struts.action parameter="method" validate="true"
 * @struts.action-forward name="browseWord" path="/Admin/adminWord.jsp"
 * @struts.action-forward name="browseMember" path="/Admin/adminMember.jsp"
 * @struts.action-forward name="viewWord" path="/Admin/WordInfo.jsp"
 * @struts.action-forward name="viewMember" path="/Admin/MemberInfo.jsp"
 */
public class AdminMemberAction extends BaseAction {
    /*
     * Generated Methods
     */

    /** 
     * Method execute
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     */
    public ActionForward browseMember(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        Admin admin = (Admin)request.getSession().getAttribute("Admin");
        if (admin==null||admin.getAdminType().intValue()!=3){
            return mapping.findForward("sorry");
        }
        MemService service = new MemServiceImpl();
        List result = null;
        try{
            result = service.browseMember();
            if(result!=null&&result.size()>0)request.setAttribute("memberList", result);    
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的browseMember方法时出错:\n");
            ex.printStackTrace();
        }
        return mapping.findForward("browseMember");
    }

    public ActionForward viewMember(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        MemService service = new MemServiceImpl();
        Member member = null;
        String p = request.getParameter("id");
        Integer id = null;
        if(p!=null){
            id = new Integer(p);
        }else{
            id = new Integer(0);
        }       
        try{
            member = service.loadMember(id);
            if(member!=null)request.setAttribute("member", member);
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的viewMember方法时出错:\n");
            ex.printStackTrace();
        }
        return mapping.findForward("viewMember");       
    }

    public ActionForward delMember(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        MemService service = new MemServiceImpl();
        ActionMessages msgs = new ActionMessages();
        String p = request.getParameter("id");
        Integer id = null;
        if(p!=null){
            id = new Integer(p);
        }else{
            id = new Integer(0);
        }       
        try{
            boolean status = false;
            status = service.delMember(id);
            if (status){
                msgs.add("delMemberStatus",new ActionMessage(Constants.MEMBER_DEL_SUC_KEY));
            }else{              
                msgs.add("delMemberStatus",new ActionMessage(Constants.MEMBER_DEL_FAIL_KEY));
            }
            saveErrors(request, msgs);
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的delMember方法时出错:\n");
            ex.printStackTrace();
        }
        return new ActionForward("/Admin/adminMember.do?method=browseMember");      
    }

    public ActionForward browseWord(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        Admin admin = (Admin)request.getSession().getAttribute("Admin");
        if (admin==null||admin.getAdminType().intValue()!=3){
            return mapping.findForward("sorry");
        }
        WordService service = new WordServiceImpl();
        List result = null;
        try{
            result = service.browseWord();
            if(result!=null&&result.size()>0)request.setAttribute("wordList", result);  
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的browseWord方法时出错:\n");
            ex.printStackTrace();
        }
        return mapping.findForward("browseWord");       
    }

    public ActionForward viewWord(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        WordService service = new WordServiceImpl();
        Leaveword word = null;
        String p = request.getParameter("id");
        Integer id = null;
        if(p!=null){
            id = new Integer(p);
        }else{
            id = new Integer(0);
        }       
        try{
            word = service.loadWord(id);
            if(word!=null)request.setAttribute("word", word);
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的viewWord方法时出错:\n");
            ex.printStackTrace();
        }
        return mapping.findForward("viewWord");     
    }

    public ActionForward answerWord(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        WordService service = new WordServiceImpl();
        ActionMessages msgs = new ActionMessages();
        String answerContent = request.getParameter("answerContent");
        Admin admin = (Admin)request.getSession().getAttribute("Admin");        
        Leaveword word = null;
        String p = request.getParameter("id");
        Integer id = null;
        if(p!=null){
            id = new Integer(p);
        }else{
            id = new Integer(0);
        }
        try{
            word = service.loadWord(id);
            word.setAdmin(admin);
            word.setAnswerContent(answerContent);
            word.setAnswerDate(new Date());
            boolean status = service.updateWord(word);
            if (status){
                msgs.add("answerWordStatus",new ActionMessage(Constants.WORD_ANSWER_SUC_KEY));
            }else{              
                msgs.add("answerWordStatus",new ActionMessage(Constants.WORD_ANSWER_FAIL_KEY));
            }
            saveErrors(request, msgs);
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的answerWord方法时出错:\n");
            ex.printStackTrace();
        }
        return new ActionForward("/Admin/adminMember.do?method=browseWord");        
    }

    public ActionForward delWord(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        WordService service = new WordServiceImpl();
        ActionMessages msgs = new ActionMessages();
        String p = request.getParameter("id");
        Integer id = null;
        if(p!=null){
            id = new Integer(p);
        }else{
            id = new Integer(0);
        }       
        try{
            boolean status = false;
            status = service.delWord(id);
            if (status){
                msgs.add("delWordStatus",new ActionMessage(Constants.WORD_DEL_SUC_KEY));
            }else{              
                msgs.add("delWordStatus",new ActionMessage(Constants.WORD_DEL_FAIL_KEY));
            }
            saveErrors(request, msgs);
        }catch(Exception ex){
            logger.info("在执行AdminMemberAction类中的delWord方法时出错:\n");
            ex.printStackTrace();
        }
        return new ActionForward("/Admin/adminMember.do?method=browseWord");        
    }
}

-----------------------------------------分界线-------------------------------
在tomcat的lib中加入commons-long.jar抛出另一个错

HTTP Status 500 – Internal Server Error


Type Exception Report

Message javax.servlet.ServletException: java.lang.ExceptionInInitializerError

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:639)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:500)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    com.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:32)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


Root Cause
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:667)
    org.apache.jsp.Admin.adminUser_jsp._jspService(adminUser_jsp.java:309)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    com.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:32)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


Root Cause
java.lang.ExceptionInInitializerError
    org.apache.commons.lang.builder.ToStringStyle$MultiLineToStringStyle.<init>(ToStringStyle.java:2119)
    org.apache.commons.lang.builder.ToStringStyle$MultiLineToStringStyle.<init>(ToStringStyle.java:2116)
    org.apache.commons.lang.builder.ToStringStyle.<clinit>(ToStringStyle.java:78)
    org.apache.commons.lang.builder.ToStringBuilder.<clinit>(ToStringBuilder.java:97)
    org.apache.commons.lang.ArrayUtils.toString(ArrayUtils.java:171)
    org.apache.commons.lang.ArrayUtils.toString(ArrayUtils.java:152)
    org.displaytag.export.ExportViewFactory.<init>(ExportViewFactory.java:61)
    org.displaytag.export.ExportViewFactory.getInstance(ExportViewFactory.java:79)
    org.displaytag.tags.TableTag.doStartTag(TableTag.java:709)
    org.apache.jsp.Admin.adminUser_jsp._jspService(adminUser_jsp.java:232)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    com.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:32)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


Root Cause
java.lang.NumberFormatException: multiple points
    java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1914)
    java.base/jdk.internal.math.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
    java.base/java.lang.Float.parseFloat(Float.java:455)
    org.apache.commons.lang.SystemUtils.getJavaVersionAsFloat(SystemUtils.java:1117)
    org.apache.commons.lang.SystemUtils.<clinit>(SystemUtils.java:817)
    org.apache.commons.lang.builder.ToStringStyle$MultiLineToStringStyle.<init>(ToStringStyle.java:2119)
    org.apache.commons.lang.builder.ToStringStyle$MultiLineToStringStyle.<init>(ToStringStyle.java:2116)
    org.apache.commons.lang.builder.ToStringStyle.<clinit>(ToStringStyle.java:78)
    org.apache.commons.lang.builder.ToStringBuilder.<clinit>(ToStringBuilder.java:97)
    org.apache.commons.lang.ArrayUtils.toString(ArrayUtils.java:171)
    org.apache.commons.lang.ArrayUtils.toString(ArrayUtils.java:152)
    org.displaytag.export.ExportViewFactory.<init>(ExportViewFactory.java:61)
    org.displaytag.export.ExportViewFactory.getInstance(ExportViewFactory.java:79)
    org.displaytag.tags.TableTag.doStartTag(TableTag.java:709)
    org.apache.jsp.Admin.adminUser_jsp._jspService(adminUser_jsp.java:232)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    com.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:32)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)


Note The full stack trace of the root cause is available in the server logs.


Apache Tomcat/9.0.13
  • 写回答

1条回答 默认 最新

  • 关注

    我是接上一个问题的,采纳问题采纳的太早了,抱歉。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 灰狼算法和蚁群算法如何结合
  • ¥15 这是一个利用ESP32自带按键和LED控制的录像代码,编译过程出现问题,请解决并且指出错误,指导如何处理 ,协助完成代码并上传代码
  • ¥20 stm32f103,hal库 hal_usart_receive函数接收不到数据。
  • ¥20 求结果和代码,sas利用OPTEX程序和D-efficiency生成正交集
  • ¥50 求fpga交通信号灯设计Verilog代码
  • ¥50 adb连接不到手机是怎么回事?
  • ¥20 抓取数据时发生错误: get_mooncake_data() missing 1 required positional argument: 'driver'的问题,怎么改出正确的爬虫代码?
  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头