Page 1 of 2 12 LastLast
Results 1 to 20 of 21
  1. #1
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default id not found in servlet

    hi evryone,
    id doesn't work form UserShowServlet,
    beats me thant where I find my err
    my en. is poor, pls。 understand
    thanks

    code:


    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    if(request.getSession().getAttribute("X")==null){
    request.setAttribute("info", "你是非法用户,请先登录!!!!");
    request.getRequestDispatcher("index.jsp").forward( request, response);
    }else{
    UserService service=new UserServiceImpl();
    response.setContentType("text/html;charset=utf-8");
    String Idd=request.getParameter("id");
    System.out.println("Idd==$$=="+Idd);
    try{
    int pageCount=service.getPageCount();
    int page=1;
    if(Idd==null){
    page=1;
    }else{
    page=Integer.parseInt(Idd.trim());
    if(page<1){page=1;}
    else if(page>pageCount){page=pageCount;}
    }
    List list=service.getAllUser(page);
    if(list!=null){
    request.setAttribute("Idd", page);
    request.setAttribute("list", list);
    request.getRequestDispatcher("show.jsp").forward(r equest, response);
    }else{
    request.setAttribute("info", "目前无用户信息");
    request.getRequestDispatcher("index.jsp").forward( request, response);
    }
    }catch(Exception e){e.printStackTrace();}
    }
    }

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Is the parameter called id being submitted to the servlet then?
    If you are submitting from an HTML form then post the code for the form.

  3. #3
    jogep is offline Member
    Join Date
    Dec 2009
    Location
    Germany
    Posts
    43
    Rep Power
    0

    Default

    Do you use a post or a get method to call the Servlet?

  4. #4
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    get method,I‘m sure

    thanks your reply

  5. #5
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    yeah,copy

    my code is dead,doesn't work

    id is a self-growing

    can u help i?

    thanks in advanced

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Not sure I understand exactly what you are asking.
    But if you want to pass lots of values from an HTML page to a servlet then you can pass them as a Javascript array and use request.getParameterValues (returns an array) to retrieve the values.

  7. #7
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    err in console:

    名字==wade&&密码==¥¥wade
    res==$@$true
    用户名==$%$wadeIdd==$$==null
    java.lang.Exception: 很抱歉,分页有问题,请联系管理员
    at com.kang.service.UserServiceImpl.getAllUser(UserSe rviceImpl.java:25)
    at com.kang.servlet.UserShowServlet.doGet(UserShowSer vlet.java:41)
    ..........................

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Parts of the message are showing up in Chineese which I don't understand so I can't help with that one.

  9. #9
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    naa,
    thank you

    thanks

  10. #10
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    get method,I‘m sure

    thanks your reply

  11. #11
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    hi there,
    I forgot

    and wanna that you can google translation

    I try in en.

  12. #12
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Better that you translate the messages yourself and post the translated version.

  13. #13
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    okay
    err in console:

    username==wade&&password==¥¥wade
    res==$@$true
    username==$%$wadeIdd==$$==null
    java.lang.Exception: Sorry, paging problems, please contact the administrator
    at com.kang.service.UserServiceImpl.getAllUser(UserSe rviceImpl.java:25)
    at com.kang.servlet.UserShowServlet.doGet(UserShowSer vlet.java:41)
    ..........................

    sorry。。。。that's biz process ,just tips

    thanks

  14. #14
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Since you set the Idd value in the request, when the next request comes this value will not be available unless if you add it to the new request on the client. Consider storing this value as a session attribute instead. That way it will be available across multiple requests and you can update it on each request.

    The other error is coming from an exception being thrown on line 25 of your UserServiceImpl class. Look up that code and find out the conditions under which it throws an exception with the provided message.

  15. #15
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Better that you translate the messages yourself and post the translated version.

  16. #16
    jogep is offline Member
    Join Date
    Dec 2009
    Location
    Germany
    Posts
    43
    Rep Power
    0

    Default

    do you respect case sensitivity?

    Maybe your URL use ID instead of id as parameter name.

  17. #17
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    thank you very very much

    I wanna made it and I have a rest ,eating

    thanks

  18. #18
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    thanks

    I can care

    Okay,made it

  19. #19
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

    Default

    hi,
    my windows 2000 ad server ,Password forgotten。
    coming ctrl+alt+del,then Switching input method, help is gray.
    Should not be how to do the next

    thanks Dance master

  20. #20
    kondiweyane's Avatar
    kondiweyane is offline Member
    Join Date
    Jan 2010
    Location
    Mountain Hua,Xi'AN,China
    Posts
    17
    Rep Power
    0

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 12-02-2008, 12:23 AM
  2. javax.servlet.ServletException: No collection found
    By pushpendra21only in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-18-2008, 08:07 AM
  3. Replies: 0
    Last Post: 08-30-2008, 11:52 AM
  4. Replies: 1
    Last Post: 08-07-2007, 03:47 PM
  5. Error: javax.servlet.ServletException: Column not found
    By barney in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2007, 07:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •