If you add a file to the project folder outside the Eclipse IDE, that file will not be seen inside the IDE until that particular project is refreshed :|
This blog is supposed to keep track of all the small fixes, good tutorials and cheat-sheets I encounter in my binary life so I won't have to seek them on the web again.
Monday, April 27, 2009
Friday, April 24, 2009
Java operators game
Given the following code:
int var = 2;
var+= 2.5;
System.out.println("var="+var);
the result will be var=4
Now we change that to
int var = 2;
var=var + 2.5;
System.out.println("var="+var);
The result should be the same at first sight but it's not. Compound operators do implicit casting whereas the line "var=var + 2.5;" does not. Explicit casting is required in this situation.
Have a nice day!
int var = 2;
var+= 2.5;
System.out.println("var="+var);
the result will be var=4
Now we change that to
int var = 2;
var=var + 2.5;
System.out.println("var="+var);
The result should be the same at first sight but it's not. Compound operators do implicit casting whereas the line "var=var + 2.5;" does not. Explicit casting is required in this situation.
Have a nice day!
Thursday, April 23, 2009
Spring & XML quickie
something nasty occured today as i tried to pass an attribute from a spring controller to a JSP-page view. That attribute is an XML string of the form "<root><item1>...</item1><item2>...</item2>...</root>", written without newlines. all fine and dandy so far, but when i tried to obtain the attribute in my jsp using ${var}, all i got was the item values without any of the tags... to fix this i had to rewrite the code in the jsp to <% String str = request.getAttribute("var").toString %> . I'm curious why the jsp has interpreted the xml string like that
Subscribe to:
Posts (Atom)