Benjamin Samuel

Ranch Hand
+ Follow
since Dec 15, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Benjamin Samuel

Consider a webapp that has been pre-authenticated by an external system, and the authenticated user id is send via request headers. A UserService is invoked to load a custom UserDetails object from the app database. Want to know if the UserService will be invoked every time a request hits the application or only when SecurityContext doesn't have an Authentication object. Won't it be a performance hit if the UserService is called every time the request is passed via filters.
14 years ago
Say a form has a set of fields.

I have an 'Add' button that duplicates the set of fields and 'Delete' button that deletes a chosen section. Add and delete functionality is done via jquery() clone and remove() methods. While i clone, obviously the cloned section will have the same radio button name and hence it will become the part of the first radio group. What i wanted is a new set of radio button group. For this I can manipulate the name of the radio button by appending an index. What I wanted to know is how should we handle these multiple radio button group in the ActionForm.

Thanks in advance
15 years ago
Jeanne,

Could you please elaborate on this? Could you provide me a sample code if possible?
Depending on the property i want to color the cell.

Thank you.
15 years ago
Hi,

I want to know how to apply styles to the rows of a generated spreadsheet, based on a particular condition.

The scenario is like this:

I have a jsp, jsp1 which displays a report. This jsp contains an 'export to excel' button, on click of which, another jsp, jsp2 is displayed with the report data rendered as an xml. Certain rows of the report is coloured, based on the property 'agingColor' of the report bean, reportLineItemBean.

I need to colour the rows of my generated excel sheet also in a similar way. But i was unable to do the same as i could specify only one interior(background) colour in a particular style. The code is as follows:



The above code displays the hexadecimal value of the agingColor along with the cell value, rather than applying that color to the styles. I need to apply the values for the background color for the cells as specified by the agingColor property, in a similar way the color #000000 is applied to the cells.

Please help.
Thanks in advance.
15 years ago
Thanks Himanshu. I tried with HSSFRichTextString and the code is given below:




Couldnt attach the generated xls.

The second cell displays 000005544 and when i navigate to this cell and double click on it and come out of it, the leading zeros are lost.
The fourth cell displays '000005544 and when i double click on this one, the apostrophe is gone and the leading zeros are retained.

The problem is: The user is going to copy the values from the xls i have generated. While copying only the number is expected to be copied. The user may/may not double click on the cells in the xls generated. How can I achieve this? please help.

Thanks
15 years ago
Rob, Thank you for your time.

I tried with an apostrophe before the number with leading zeros. But when i open the xls it shows the cell value as '00012345. If i double click on the cell, then the value is displayed without a '

What could be the workaround for this?

From the xls that i generate programatically, the user needs to copy the value to another application. And the above scenario will copy the text along with the apostrophe(') sign.
15 years ago
Hi,

I want to preserve leading zeros while exporting the data into an xls using Apache POI. If I set the data type to text, the leading zeros are getting removed on double clicking the in cell. Below is how i set the value:


please help. How can this be achieved via POI?

Thanks
15 years ago

I 'm pretty sure that you're not creating an XLS file, but rather some text file that you're trying to have Excel open by setting the content type; is that correct?




Yes, thats exactly what i have done. I am not creating a binary file and data writing into it.
I tried to display the field as a formula field[by prefixing and'=' sign], and tried appending a space [ ] to convert it to string format. But this is not how they want it to be done. please let me know if you are aware of any other workaround.
15 years ago
JSP
Hi,

I have a jsp which i am rendering as an xls. I need to convert the numbers as text format.

for example: If i have a number as 00010345 it should be displayed as is when exported to an xls. Currently the number is displayed as, 10345 (Without the zeros)

Hope it was descriptive enough. Please help.
15 years ago
JSP
My actual problem is little more complicated than this

So is it not possible to do the Criteria check on 'age' field?
Consider the following bean class:



Assume the hbm file have the mapping for the first 3 fields viz. id, name and yearOfBirth. Field 'age' is calculated based on the yearOfBirth and is set via setYearOfBirth() (Age is not stored in DB). I need a solution using Criteria API (org.hibernate.Criteria) to search on Person objects based on 'age' field. I'm trying the below code; but it raises an exception: org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException (could not resolve property: age of: Person)


Any solutions ?

Thanks,
Binil
Got it!
Thanks for the explanation
16 years ago
But how is that the anonymous class extends HashMap even without specifying the 'extends' keyword.
16 years ago
Hi,

I just came across this code below. I'm not clear how this works. Can you please explain me how this works?



I'm not understanding how this put() is working normally.

Thanks in advance
Binil
16 years ago
I'm having a double value
e.g. a)99558669546.
b)0.00125

I have to convert these values into String. I need to read the value as-is without any truncation or formatting. For E.g. i do not want 'a'
to be formatted in Exponential format (like E9) and i dont want 'b' to be truncated to 0.001 while converting to String.

How can I achieve this using NumberFormat class or is there any other class through which this can be achieved?
16 years ago