Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

praveen Shangunathan

Ranch Hand
+ Follow
since Sep 06, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by praveen Shangunathan


I am trying to pass parameters for attributes that are required.

String name;

String city;

The above works fine. But I want to use a generic "{0} is required" message that I want to reuse instead of Errors.NAME_REQURED and Errors.CITY_REQURED.
Is there a way to pass the offending attribute as a parameter to a generic error message?

8 years ago
yes it is pretty bad
but for now this is how i got it to work.
and about displaytag already supporting i18n, it does. that is the reason the browser reads from japanese property file. the issue is specific only with displaying japanese characters properly. i do have chracterencoding set to utf8 and all other non-displaytag renders properly.
im using displaytag as below

<display:table name="aaa" uid="bbb" defaultsort="2" defaultorder="descending" requestURI="" pagesize="25">


In the mean time I fixed the issue by changing the displaytag.jar. I updated file in the jar and this fixed the issue.

Thank guys for looking into this.
@ Christophe and Paul
it is a requirement that properties be in japanese and NOT in unicode. therefore no native2ascii and no unicode escapes, although they will work !

The thing is I fixed a similar issue for property files read by our own codebase, because i know the api and was able to write wrappers. But with displaytag Im not sure which class to write a wrapper for or how the displaytag specific property files are read.

thank you
This is not a java property file although I did have the same issue with java property file which i solved. the way i did is to have a wrapper around the getResouceBundle which returns a utf encoded resource bundle, so all is fine there.
But in this case im not sure how the displaytag api reads from the displaytag property file and the disaplaytag_ja.propeties file has to contain proper japanese characters and not unicode escapes.
hi all,
i have some trouble with displaytag 1.1. hope you can help me with this. i am trying to display japanese characters in the footer like the number of pages, first, next etc., The page reads from a separate japanese property file( but the display is gibberish. also the property file is utf-8, it contains actual japanese characters and not ascii.
is there a way i can manipulate how displaytag api reads from ?

for ex. one line in my japanese property file is
paging.banner.some_items_found=<span class="pagebanner">{0} {1} 日本found, displaying日本 {2} 日本to日本 {3}.</span>
but the page displayed is
205 items 日本found, displaying日本 1 日本to日本 25

please advice.
the InvocationTargetException is thrown because i do not have permission to access privaMethodB when i am running private MehodA.
I wasnt o know how to avoid it.
12 years ago
the JUnit test throws an InvocationTargetException. this is because from the JUnit using reflection I call methodA. but since methodA calls methodB and that is private as well, an exception is thrown.
12 years ago
I have tested private methods using reflection API.
Now I want to test a private method which inturens calls another private method.
Sure enough I get InvocationTargetException when I try to run this test.

for example,

in the above ex. i can run tests on privateMethodB(), but not on privateMethodA().
SO what do I do using reflection to test privateMethodA() ?

suggestions please...

12 years ago
Hi Mark,
Thanks. that worked.
going to the design issue you had mentioned, i did not want spring access code lying around, but did not find an alternative.
i want to inject one of a dozen reports at runtime depending on something. i am not sure how to have spring do this. i could use a factory but did not want to use "new" and want spring inject a report.
kindly advice.
Hi all,
I want to getBean(s) from springs applicationContext. Since this is from the business layer I dont want to getServletContext() etc.and of course injection is not an option here.

Right now I am using ClasspathXmlApplicationContext and it works fine.

Is there a better way to do this?
Also when i do ApplicationContext context = new FileSystemXmlApplicationContext("applicationContext.xml"); is a new context created?(i hope only the context loaded at startup is returned.)

I am trying to inject a class type using a setter. I am able to do it by defining what i want to inject as a bean.
How can I do this without having to define what I am injecting as a bean.

When I tried <property name="name" value=""> I get a type mismatch error that string cannot be cast to className.

Please advice.
this is a very low-tech solution.
when you use split and print you run the loop from 0 to strArray.length.
You can instead run from 1 to (strArray.length-1).
13 years ago