Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Fredrik Larsback

Greenhorn
+ Follow
since Dec 21, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Fredrik Larsback

Tim Holloway wrote:I believe that's within the capabilities of the JSF Converter architecture. A Converter basically has 2 methods in it (inbound and outbound conversions), and is typically registered in the faces-config file, where you bind the actual converter class to a logical converter name for use in converter tags.



Ok, thanks. Then I'll write a converter.
11 years ago
JSF

Tim Holloway wrote:What are you expecting JSF to do? Your example is just free-floating data without any context. You're describing a process that can be done without JSF or even any web application at all.



I have a Seam application which reads a date as a string from a backing bean which is packaged in a jar which can't be modified. I'd like to know if there is way to format this date-String to another format in my .xhtml page through some tag library like <f:convertDateTime> or should a write my own facelet tag library to achive this?
11 years ago
JSF
How do I format a date string to a string with another format with JSF?

E.g.
Format "20100224091007.000000Z" to "2010-02-24 09:10:07"

Regards
/Fredrik
11 years ago
JSF
Read the file into a StringBuilder, then use String replaceFirst(String regex,String replacement) to replace the word, then write the String back to the file.
12 years ago
You're correct Rob.
But I'd say it's micro optimization. If you've got performance problems in your code it isn't because of how you implement your System.out.println.
12 years ago

Though the result of last two lines are same, I would like to know which one is better in terms of performance etc.



Correct me if I'm wrong but I think that creates a StringBuilder behind the scene and appends the empty String and a.toString together.
Performance wise there is no difference between the two, what's important for the performance point of view is the implementation of the toString() method.
The cleanest way to implement is just to do .

What are the other ways I can use to convert this integer to String effectively




12 years ago

Minhaj kaimkhani wrote:moreover take a look on following example



In a multithreaded environment the shared variable should declared as volatile because of visibility issues when sharing a variable between threads.
Vector is synchronized, ArrayList isn't.
12 years ago