Win a copy of Java Challengers this week in the Java in General forum!

Izanami Caster

+ Follow
since Mar 05, 2020
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 Izanami Caster

Just found this in the documentation:

Similar to @Autowired, @Resource may fall back to standard bean type matches (i.e. find a primary type match instead of a specific named bean) as well as resolve well-known "resolvable dependencies": the BeanFactory interface, the ApplicationContext interface, the ResourceLoader interface, the ApplicationEventPublisher interface and the MessageSource interface. Note that this only applies to @Resource usage with no explicit name specified!


I've found my answer.


Based on what I've read on @Resource annotation, it's DI is by-Name. However, using a bean that's named differently from its setter method (Bean: resourceDependencyTwo vs Setter: resourceDependency) also worked.

Isn't this a contradiction ?

Please check the following:

Dependent Resource:



ResourceDependent da = (ResourceDependent) context.getBean("resourceDependent");

Message from Dependency:Chuck!
hi @Paul,

The JSTL pre-requisite was my preference. I just wanted to test its maneuverability and my comfort with it.

hi @Tim,

Thank you for the clarity regarding JSTL, EL, and the uses of the latter! The perspective was much needed.

As for the example, the following Java-code would explain it better (assuming TreeMap T1 contains the users answers and TreeMap T2 contains the correct answers)….I'm writing untested code here just for analogy...hope syntax errors are excused:

- correctAnswerMap was meant to be a reference to t2.

I had wanted to write code that

1) Places T1's and T2's values for the same key, adjacent to each other.
2) Avoids iterating through both T1 and T2 to arrive at common keys.

- The following is a somewhat costly approach to last resort. It works okay, but I wonder whether there's a better way to do this. I've renamed correctAnswerMap to cMap for brevity.

1 year ago
Hi Ranch,


- Quiz taker keys in answers for a user defined number of questions, which are saved off in a TreeMap, T1, ordered by question number. T1 has sessionScope.
- TreeMap T2 has the correct answers ordered by question number. T2 has sessionScope too.

Prerequisite: Use JSTL.

My Approach:

Role 1:
Quiz Taker:
1) Take the quiz by answering questions one by one, hitting a submit button after each question. The answers are saved off in T1 by a servlet, S1. This servlet then dispatches the same JSP J1.   Accomplished!
2) After each submit, display the question number along with the user's answer in a growing table in J1. This table also has a third column C3 with an input field (explained in the next point).   Accomplished!
3) When the allotted time has passed, or when the quiz-taker  decides, 'Finalize' the answers by hitting a Finalize button. This seals the user's answers. Accomplished!

Role 2:
   Score Calculator:
4) The user looks up a source (say OCPs' answers to review questions) and keys in the correct answers manually into C3. Once all the answers have been keyed in to the input text field Tx1, the user hits the SCORE button. Accomplished!
    a) This action is forwarded to the servlet S1, which saves the answers off to TreeMap T2. Accomplished!
    b) S1 then calculates the score, and passes and then dispatches J1. Accomplished!
    c) About text Field Tx1: This input field has a default value intended to be set to T2's values for the question key. NOT ACCOMPLISHED!!

Now, I know the following doesn't, and shouldn't work, but I was hoping someone could understand my problem based on the above description and fill in the gaps.

Please refer to my attachment to achieve more clarity as to this problem.

Please advise.

1 year ago
Thanks for the perspective, @Ron! The thread stands resolved!
1 year ago
Thanks Ron! The good news - I've got what I wanted; the not so good news - I'm not sure how.

The problem turned out more annoying...somehow, the sessionScope and param references weren't being read, despite me having added what I thought were the correct libraries.

I had previously accessed requestScope, so this was a bit bothersome. Just when I was about to give up, I  did a few things that ended up working for me.

Here's a summary  involving A) the deployment descriptor and B) , the POM. Could you help me disambiguate ?

A) I initially used a maven-archetype-webapp archetype to create this project. I added the following dependencies initially:

The archetype choice created a Deployment Descriptor file with the following content, as it would

….I changed this explicitly to the following, based on an internet source that I don't recall now...

B) I also added the jstl-api library along with the previously added dependencies, so that my POM dependencies looked as follows:

Now, I'm not sure if the last dependency did the trick, or if it was the DD change; it initially didn't work, but then somehow, after a quick, unrelated edit to the JSP (printing the requestScope and sessionScope side by side), it started working.

I'm able to access sessionScope and param variables now.

Here's an excerpt from the JSP, that falls in line with my original requirement.

Could you throw some perspective into this if possible ? Is JSP engine unpredictable in that way ? Did adding the additional library do the trick, or was it the DD ?

I apologize for the open ended question; I don't like the fact that I don't know what worked.

1 year ago
hi Ron, Bear,


Using the following directly causes a NumberFormatException :

....prompting the question, "Shouldn't this be converted to an Integer/Number first ?"

Using an Integer.parseInt as follows is probably bad syntax, but the effect is the same..NumberFormatException:


Perhaps there's a provision in JSTL that allows me to code this more elegantly. Googling isn't helping.

1 year ago
Hi Bear,

I tried the following.

This is most certainly incorrect syntax, but I've hit a dead end here.

The JSP Error is the same...

Root Cause
java.lang.NumberFormatException: For input string: "${Integer.parseInt(param.numberOfQuestions)}"

1 year ago
Hi Bear,

I did try that prior to this post (through

The JSP Error:
java.lang.NumberFormatException: For input string: "${param.numberOfQuestions}"
1 year ago
I may be wrong but the answer to this is seemingly simple, but unknown to me.

My Problem: Let's say I'm trying to set myself up for a mock OCP test and I'd like to keep count.

My Approach :
Step 1: Create a form (form 1) that accepts the total number of questions (say 70) and the duration of the exam in minutes (150); pass these request parameters to another form (form 2)
Step 2: In form 2, set up a table with 70 rows (total number of questions), with column 1 numbered 1 through 70, and column 2 containing 1 text field per row, with my guess/answer (A/B/C/D etc.).

The issue:
I'm able to access Form1's request parameters in Form2 using a JSP expression; my need though for Form 2, is a table-like display with blank text fields per question, so a forEach is the key.
My attempts to access the request parameters within the forEach tag have failed so far.



Any idea where I'm going wrong here ?

1 year ago
Hi @Paul!

The following worked.

I had to add the following:

1) Add <%@ taglib prefix="c" uri = "" %> to the JSP page. Doing this alone didn't help. So I also did 2.
2) Add the following maven dependency (POM) to support JSTL:

Thanks a lot for the help!

1 year ago

I'm using a backend service to

1) Fetch a list of users' email-addresses  and
2) Print them out in a table.

For now, I've used out.println to print out just the values without the table markup.

I don't want to use out.println to print table markup (feels a little dirty). Is there a better way to print table rows iteratively within a scriptlet ? Am I doing this the wrong way ? Please advise.

hi @Claude,

THANK YOU! Changing the hibernate release version worked.


1) I ran into an issue with a Hibernate-generated Oracle SQL query in which the table alias in the FROM clause was being prefixed, incorrectly, with AS.
2) This was reverified by running the SQL query on SQL+ both with (didn't work) and without (worked) the keyword AS.
3) The problem seems to be with version  6.0.0.Alpha4. Changing that dependency to <version>5.4.12.Final</version> worked.


Thanks again!