tangara goh

Ranch Hand
+ Follow
since Dec 27, 2009
I am a beginner in Java and hope to pick up the trade secrets so that I can move on to Android development
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
88
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tangara goh

Stephan van Hulst wrote:Get rid of the attributes. Show us the latest version of your code, and the error message.



The problem is that there isn't any error at all.  And with the added fn:users.length, it is not printing anything at all....as in not showing that row of data earlier on.
3 days ago
JSP

Dave Tolls wrote:If you want to display everything in the list, why are you using the begin.end attributes of the tag?



Because it is not printing everything.  It only printed the first row.

Hence, at first I tried to use {fn:length(users)} to see if it captured the length of the attributes users.

But, it will give me error even though I have put in the import fn Taglib.

4 days ago
JSP

Stephan van Hulst wrote:You know, you can easily solve these problems by yourself if you just format your code correctly:

XML tags must either have a closing tag, or must be self closing. I can count 4 unclosed start tags, and one closing tag without a start tag.

By the way, did you mean to enclose the last four counts in double quotes? That's not necessary for XML element values.



Thanks for your hints.  I got it.  I guess I am exhausted and flat from coping with so much things...i wonder if other people will get this kind of tiredness...

Anyway, I hope to seek your advice on why I still can't get the list to be printed after adding this :



as suggested by this : https://stackoverflow.com/questions/15905055/jstl-message-dont-know-how-to-iterate-over-supplied-items-with-foreach



4 days ago
JSP

Ron McLeod wrote:

tangara goh wrote:Cos I have closed off <c:/forEach> so why is it unbalanced ?


I see two problems with your markup:

1. The first <c:forEach> tag is self-closing, but you have a </c:forEach> tag later-on in the document.
2. There doesn't appear to be an opening <table> tag anywhere.

Hi Ron, Even after removing the / at the varStatus I am still getting same error :( I have further removed all the / that is under each </td>

4 days ago
JSP

Junilu Lacar wrote:Check out https://docs.oracle.com/javaee/6/api/javax/servlet/jsp/jstl/core/LoopTagStatus.html to see other properties of varStstus you can use.



Hi Junilu,

I have read the link.  However, I do not think you can use .getCount() inside JSP/JSTL right ?

Anyway, I get to learn .count from stackoverflow ...

Could you let me know why am I getting that error ?

Cos I have closed off <c:/forEach> so why is it unbalanced ?

Anyway I can find out what unbalanced mean ?
1 week ago
JSP
I am trying to find out the length of the arraylist I am publishing to JSTL in JSP so here's what I did :



And could someone also advise me how do I know if is the way to find out if the element in the list is at which index ?

Thanks.
1 week ago
JSP

Dave Tolls wrote:If you want a subject per row (along with all the other details) then both for-each loops need to be outside the <tr> element.



Hi Dave,

Thanks.  The subject is now in per row.  However, the data returned is only the last row of data and each row only contains just the last row of data repeatedly.

What do you think is happening ?

Is there any debugging technique in order to see the cause ?

1 week ago
JSP

Ron McLeod wrote:

tangara goh wrote:I also do not know how to add the subj to MyList before setAttributes and forward it to the display page which contains the jstl c:out.


How are you using JSTL in your JSP page?



Hi Ron,

Here's the layout I plan to get the result onto the jstl :



Could you let me know how do I write it in order for the List of subjects to appear in rows and not just return in a straight line horizontally.

And am I right I need to use Map ?

Thanks.
2 weeks ago
JSP

Carey Brown wrote:

Carey Brown wrote:I would need 3 things:

  • A complete posting of your code with the new changes and how the method is being called and how the list is being used. Is it being called more than once?
  • A print of the contents of your subjs.
  • A dump of your database with the column_labels column.


  • The thing is that the method used is really wrong already.

    What I need now is really how to put a List<String> inside a List<Object> ....so that I can print out the resultset in rows in JSTL...

    cos Right now...the List<String> appear in one line instead of in rows....in JSTL

    So, that's the problem now.

    2 weeks ago

    Carey Brown wrote:



    HI Carey,

    I think the way I  was doing it not going to help me.

    The problem is I need a method to put the List<String> into List<tutor> so that it is easier for me to later display the resultset data in JSTL.

    So, could you let me know should I use a Map instead for I can't see how I can add List<String> to List<tutor>
    2 weeks ago
    I just want to add that this is not returning resultset on the subjects alone.  Above that, I have other resultsets which are giving me the right return of data.  Prior to doing the resultset, the preparedStatement already set the arrays.

    Since I can't add the finding of the subjects to another List which is the resultSet of other data, I am separating out the resultsets of subjects and then display it separately as another list via set attributes.



    3 weeks ago

    Carey Brown wrote:This is just a wild guess because you've left a lot of information out of your post.



    I did it the way as above but it is giving me the same result - duplications.

    [UHigherPriEnglish]
    [LSHigherMaths]
    [UHigherPriEnglish]
    [LSHigherMaths]

    It is supposed to only give me just UHigherPriEnglish and LSHigherMaths.....

    Kindly advise.
    3 weeks ago

    Hello experts,

    I hope someone can tell me what's wrong with the below code where I am trying to filter out the element in the List<string> which contains the data from the resultset.



    It gives me a duplication so I tried to remove .collect(Collectors.toList()) but it is worse -  it is not showing anything and I am not sure in what way can I filter the elements that matches the resultSet...

    Hope someone can tell me what's wrong with the above code or if there are other ways to achieve my goal.

    Thanks.
    3 weeks ago

    Campbell Ritchie wrote:There must be an easier way to return that list.

    Assuming we don't simply want to return the List unchangedLooks much more elegant, but it doesn't allow copying a null reference, which the other techniques mentioned probably don't, and doesn't permit any null elements in the source Collection.
    As you have already been told, there is no need for a deep copy of a List<String>.



    Thanks for the above.  However, I am still puzzled I am not able to do it without using static if I were to use the above as suggested by you.

    My aim is to eradicate static altogether.

    In the below example which I have googled from Stackoverflow where they explained using Shallow copy and static is used.


    How can we do away static altogether ?
    3 weeks ago
    Hello experts,

    I have come to know that instead of using static, we can use copy constructor like this :




    However, I can't find anything that explain how to deep copying a List<String> in a class, cos I can't imagine using static all over ?

    My another question is what if all the fields in the class we need to make use of in another class, isn't it weird to use static all over the place ?

    Hope someone can share with me what are the alternatives out there.

    Thanks.
    3 weeks ago