Why is my list empty, java error when judging that the list is empty?

Updated on technology 2024-04-11
17 answers
  1. Anonymous users2024-02-07

    %;What is this?!

    The expression should be written like this<%=

    To add an equal sign (=) without a semicolon (; )

    Premise: You've got the data!

    There is also a list that is taken from 0.

    You take get(1) and hope you have at least 2 pieces of data!

  2. Anonymous users2024-02-06

    In the servlet, the setattribute needs to be outside of the while loop.

    And rs and rs2 need to be next together, so you also need to judge if ( in while

    Then proceed with the following operations.

  3. Anonymous users2024-02-05

    Should be. %=;

    ;Right? Gotta while (right.)

    Shouldn't you use two RSs, how do you make sure that the users taken out by rs2 are the users of news?

  4. Anonymous users2024-02-04

    "newslist", list);

    It should be placed outside the loop.

    Then confirm that your database has data.

  5. Anonymous users2024-02-03

    First, listselectitem = null;

    Directly afterward. Don't you think there's something missing, what's the difference?

    It should be listselectitem = new arraylist<>(

    Your second question is very simple, have you not figured out whether the selectitem wants to store an appointmentitem or a list??? According to your question 2, the list is stored as a listselectitem in the definition, and the other is add instead of addall. If it is indeed an appointmentitem, then you are writing correctly.

  6. Anonymous users2024-02-02

    Problem 2: When selectitem is defined, the object must be created, otherwise the null pointer will be reported.

  7. Anonymous users2024-02-01

    "That is, when I directly enter the address of the jsp page, I can print "hehe"."?

    No, if you type it directly, you'll definitely throw an exception.

    searchlist").The tostring() phrase means that you get the"searchlist"Object.

    But just"object"If you want to use it, you have to change the type first<% list list = (list)"searchlist");

    if(%>

    If you enter the address directly, there is no one in the request"searchlist"object, which must be a null

    If you call the tostring() method again, an exception will be thrown.

  8. Anonymous users2024-01-31

    To determine the size of the list, you should use size().

    list list = (list) "searchlist")if(

    searchlist").tostring().length() is equivalent to the value of the string object@hashcode, and his length is greater than 0, strange, it is strange to open jsp directly without nullpointerexception??

  9. Anonymous users2024-01-30

    If you judge whether there is data in the collection, if you don't judge, there will be a nullpointexception

    arraylist al;If this is a record that your database queries up, you first if(

    In this, write iterations, go through the journey, and you're going to see the specifics, and if you want to know, you have to look at jdkapi's isempty method, isempty is to determine whether a set is empty or not.

    You**should first judge whether rs is null to determine whether the demolition spring is empty when the page is displayed**To be robust。

  10. Anonymous users2024-01-29

    Make a judgment before output, undefined will output an empty string.

  11. Anonymous users2024-01-28

    You didn't get it in the right way, even though the value stack is there, but you wrote it wrong on the jsp page. It is recommended to use a set put press-in. Especially when dealing with list collections.

  12. Anonymous users2024-01-27

    listdepartment=;

    department:"+department);I can print out the data.

    You can definitely print out the data when you update the list. But preferably; See if there's any value.

  13. Anonymous users2024-01-26

    AJAX polling the request will do the trick.

  14. Anonymous users2024-01-25

    Who can read if you post it like this, let everyone guess Post your **, save the tips and other information.

  15. Anonymous users2024-01-24

    Does your DAO layer take any value from the database?

  16. Anonymous users2024-01-23

    We say that the essence of manipulation of data is that space is allocated to it in memory before data can be processed.

    The meaning of null is empty. That is, no space is allocated.

    So at this time if you give it an operation. assignment, the method will definitely be incorrect.

    new, memory will allocate an address to your new object. That is, this object points to an address. Then act on it. Leave it to the computer.

    A little deeper. Object assignment means that the address in the stack points to the change of data in the heap. Generally, the default value in the heap will be given when new.

  17. Anonymous users2024-01-22

    I think: frm=null; It's just that the object is a null reference, but the object still exists, for example you can frm=new form2(); Yes, too; So frm=null, it doesn't have to be garbage**; As for when**, there should be a framework to decide, of course you can show the dispose; I think there's an easy way to test it:

    You call directly:; Then see if frm has a value (frm is not null after dispose. )

Related questions
8 answers2024-04-11

Recently, QQ has been updating (upgrading) QQ space in batches,Many people's space has such and such problems,Some problems are normal,Some people are allowed to try the latest version,I estimate that it will be normal soon,Don't rush to change anything first。 Since it's in batches, not everyone is the same. You can consider logging in from QQ mailbox, you can operate on many parts, open it if the mailbox is not opened, QQ mailbox is the best of all mailboxes, it is worth using it, it is very powerful, and user-friendly. >>>More

25 answers2024-04-11

When the monster is in the air, press the skill shortcut and normal attack to double the attack power.

4 answers2024-04-11

What should I do if the QQ space cannot be opened? The following method teaches you how to deal with the situation that you can't open the QQ space Now many people often encounter the situation that the QQ space can't be opened, of course, the solution is not absolute, there are many kinds of situations where the QQ space can't be opened, there are mainly the following nine solutions to the QQ space, which can solve the problem that most of the current QQ space can't be opened, according to your situation, choose one or more of the following methods, of course, you first have to make sure that you can access the network correctly, You can browse the web normally, and your network management does not block Tencent's QQ** Method 1: Enable the ActiveX control execution permission of IE browser 1 >>>More

18 answers2024-04-11

Now the biggest problem for you is no longer the difficulty of the question, but your own problem--- you are too careless! >>>More

10 answers2024-04-11

1.It has to do with integrated graphics, you are playing a 3D game, preferably a discrete graphics card. >>>More