Skip to content

Tag: java

How to put variable in OGNL tag

In this code questions is a list which contain questions object with In my program, I will make it appears in browser like The list may contain multiple question objects so I made it to show 5 question per page. My problem is (for example) the user may go from page 4 to page 2 and I want to refill

Use Exchange Property in Camel DSL “to”

I want to set a property on a Camel Exchange and then use this property when saving the file. In my camel dsl I have the following: The file is being saved as: My processor is as follows: Any thoughts on what may be going wrong or how I can achieve this? Answer The to in the Camel is not

String.split() at a meta character +

I’m making a simple program that will deal with equations from a String input of the equation When I run it, however, I get an exception because of trying to replace the ” +” with a ” +” so i can split the string at the spaces. How should I go about using the string replaceAll me…

Convert Java Number to BigDecimal : best way

I am looking for the best way to convert a Number to a BigDecimal. Is this good enough? Can we lose precision with the toString() method ? Answer This is fine, remember that using the constructor of BigDecimal to declare a value can be dangerous when it’s not of type String. Consider the below… Th…

How to find an object in a Set of custom objects

The code below contains a Set of CustomObjects. I am trying to search an object in it. I’ve overridden equals() method to match it with a specific field, am not able to understand why is it not able to find it. “XXtNot FoundtXX” is getting printed instead of “Found!!” import java…