Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"

Meghna Bhardwaj

Ranch Hand
+ Follow
since Jun 08, 2007
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 Meghna Bhardwaj

Thanks Nitin for pointing me to the other post about the same issue. i am not using Tomahawk, also the code I currently have is like so. The first column just writes out labels for the column names and the second column the values.

9 years ago
HI All,

I want to display data using the h:dataTable tags in JSF
The data I am displaying has to be in a format like this:

Name: XXXX
ID: 8989
Age: 32

I have seen several examples on the web that tell you how to display the
data like this:

Name ID Age
XXX 8989 32

Since the dataTable tag only has a sub tag h:column and NO h:row I am having issues with this. Is there a better way to do this? I have implemented the first format I mentioned using h:datable and h:column, so first I just write out all the column headers in column 1 and then I write out all the values in column2. The issue I am facing is that when one of the values is blank the next value gets printed in its place and the data appears wrong, this is really a formatting issue. When data is blank it should leave space for it and then print the next value in the next row. Hope I am making sense, any thoughts will be much appreciated.

Is there a better way to do this maybe by not using h:dataTable (I am using JSF ), is my approach correct?
9 years ago
Dear Rancher,

I am using JSF validation to simply check that the length of a field is 15, if not an error message is shown. My issue with this approach is
that user enters a number which is the correct length and clicks a button and some information is displayed about it. The second time when the user enters a number whose length is <15 then the validation error is shown BUT the information about the previous number remains on the screen.
My trouble is I am not sure how to do a refresh of the page.
I am doing validation like this:

Any ideas much appreciated.
9 years ago
I believe I am on the right forum, my project is JSF, but since the actual pages are .jsp files that is why i have mentioned jsp.
9 years ago

I am writing a simple enough program using JSF, and I need some advice about how to go about it. I have a jsp which takes a unique ID and has to find out if the ID exists in 3 different databases. If it does it should display a message telling user, where it exists, otherwise it should give the user option to add the ID to a particular database.

I have the jsp page which has a text field for the input ID and I have a button called "Submit" which should trigger the process of querying the db to see where the ID exists. My question is, how to structure this project, in terms of front end, middle teir and db layer. I have a JSP page, when the user clicks the Submit button, I have a listener in the managed bean which gets executed. I have also read up that the listeners can either be a managed bean or a separate class. Should I have a separate class which is the listener? If so, should it be a Servlet mapping in the web.xml file, so all request get forwarded to this class. Should there then be a separate DAO class where the actual query gets executed. We are using hibernate as well.

I would jsut like to hear people comments about how many classes there should be and how a particular ID Check will flow through the program from JSP->Servlet(?)-> DAO and then back to the same jsp. There is only JSP , there will be no other navigation pages.

Any direction will be much appreciated.
9 years ago
I just want to add that I sat the exam yesterday and I did see topics on:
Serialization and var-args, contrary to what was mentioned in a separate post about
changes to SCJP6 exam.
HI All,

I have finally cleared SCJP6 after 3 months of preparations, this was my second try at it. First time
I rushed things and was not in good shape to take the test and failed by1 question getting (63%).
I learned my lesson from then and this time I have cleared with 80% score.

Oh what a journey it has been, it was a loooog and tiring road.... but it feel really good to have put it behind me. I felt the exam was tough
only slightly easier than Whizlabs. Also the time was sufficient but NOT plenty. I had about 50 mins remaining
for reviewing marked questions where I had doubts. So my advice would be, be very used to giving the full exam
I mean sitting for 3 hrs and completing it from start to end. First time around I ran out of time and had to rush
thru the last 20 questions (there were 72 when i first sat the exam).

Good Luck to folks aspiring to get SCJP-fied!

9 years ago
I am wondering why this compiles fine when placed inside the same class:

if called like output is In string.

However this does not:

HI Victor,

I am studying for just the SCJP, Java exam so Head first Servlets and JSP won't work for me :-)
9 years ago
Hi All,

I have questions about my preparedness..... please advice, I have listed my scores on Whizlabs exams at this link:

Please let me know what you think, should I take the real SCJP? Appreciate any responses.

Many thanks.
9 years ago
Hi All,

Just wanted to hear people's opinion on whether I am ready for the real exam SCJP6.
I have done all Whizlabs tests 1,2,3,4 and my score respectively is: 79%,82%,75%,71%
and today I finally sat the final exam and got 72%, its not great but thats what it is.
I am finding it hard to get time out of work and family and realised that i had gone 2 weeks
without any preparations.... I dont want to leave it too long as I am losing what I already know.
So, I am thinking of taking it. The exams all had 72 questions, i know the exam has changed recently
to have just 60 questions.

What do you think, am I ready for it?

Also, is there partial marking in the real exam, so if you get 1 out of 2 multiple choices right for a question
do you get 0.5 mark credit for it?

Any suggestions much appreciated.

Hi Madhu,

Thanks for your reply, but in the first code sample looking at the logic it is also
gauranteed that y will be assigned a value, since x =10 and x is either > or <= 100

I think the code the going to enter at least 1 if statement so y will also end up will a value???
HI All,

The below code throws the compiler error: "Local variable may not have been initialized" on Line 6.

However the code below does NOT throw any compiler error, it appears like it should as its similar to what the
above example does. Can anyone explain why it does not?
HI All,

I understand this question and the solution to it. As the wait and notify are not both working on the same objects Lock. However , I have the same question as daniele... is it not possible that inside run() the JVM decides to switch threads and starts executing main thread before "Ready to Print" gets executed....therefore producing the output...
"Now Printing," first???
Thanks people...I have been trying to prepare since, but the biggest battle is finding a 4hr chunk of time to do 1 mock exam!
I came across a question like this in a mock over the weekend :

float f = 10;

Will this compile? Now I see this as absurd! As yes the above will compile, but this won't
float = 10.0; // Will not compile until you put a 10.0f behind it!! It needs the f as any decimal point is implicitly double.

Its these kind of questions that lead to frustration. But anyways...I'll continue on my road to SCJP.
9 years ago