Geoff Prest

+ Follow
since Feb 20, 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 Geoff Prest

Hi all,

I've been asked to explain a confusing situation. I'm hoping your combined wisdom and experience could shed a little light.

In a nutshell, we had an isolated incident where a page was displayed with two ActionMessages where only one should ever be possible. I have not been able to reproduce this error, and there is no history of it occurring in the past. The Action code in question controls the login logic; its basic flow is as follows:

Attempt to authenticate the given credentials
If authentication was successful, display message 'A'
If authentication failed, display message 'B'
If a technical error occurred, display message 'C'

The problem is that the page was displayed with both messages 'A' and 'B'.

I am suspecting some kind of caching problem, but I can't be sure.

Has anyone out there experienced and explained a similar issue? If not, any creative ideas/explanations would be greatly appreciated.

Thanks in advance,
8 years ago

I'm really new to Struts, so please excuse my ignorance if it's showing.

I have a JSP file that is used as a header tile.

New conditional functionality was added to this JSP to alter what it would display depending on specific criteria that can be found in the session context.

This functionality is implemented in Java code within Struts markup, and I've been tasked with separating the two.

It seems to me that it is a simple matter of creating an Action and Form that will handle my processing and data transfer needs and rewrite the Struts markup to use the Form. My problem is that I can't find the way to wire the Action and Form to the header page.

Thanks in advance for your advice,

9 years ago
Hi Ulises

I'm still working on my submission, but from what I've read here on the ranch it is very dangerous (read automatic failure) for your application to rely on the existence of the file.

A post that eased my concerns about this can be found here.
Howdy all,

Does the restriction on using members of the nio package (APIs Relevent to the Assignment) extend to String constructor parameters?

Thanks for your reply Campbell,

As you suggested, I created a class that perfomed the same function (ie: creating a Character object with a value of 'A') using both direct assignment and construction. Out of curiosity, I extended the class to provide methods that would directly assign various literals of the same equivalent char value to see what that would look like as well.

Here is the class file followed by the javap output:

javap -c LiteralTest

To reiterate the question I had originally asked:
When creating a Character by way of a direct assignment, does the compiler create a char with the provided value and use it to construct (ie: invoke new Character()) the Character object?

The answer is no.

According to the byte code, the process by which an object is created will differ depending on the method used. I don't understand enough about byte code to explain what specifically is going on, but it's evident to me that the process I laid out in the question does not take place.

I've found a starting point for my byte code education on wikipedia and Looking Under The Hood here at the ranch. Any other recommendations of suggested reading materials would be greatly appreciated.

Thanks again Campbell for answering my question in a way that forced me to learn something. It's much more rewarding this way.


[ October 09, 2008: Message edited by: Geoff Prest ]
[ October 09, 2008: Message edited by: Geoff Prest ]
11 years ago
Hi all,

I've a two part question today:

As a Character object can only be constructed using a char value,
is the assignment of a literal int ...

... replaced with the creation of a char that is used to create the Character ...

... at compile time through boxing?

And second:
I've read over the API but cannot understand the reasoning behind the range of values the Character.getNumericValue() method returns. I've figured out that it is not to be used if I want to find out that 'A' is the 65th character, but what would I use it for?

Thanks in advance for any responses,

Have a good day,
[ October 08, 2008: Message edited by: Geoff Prest ]
11 years ago
Thanks Ernest,

Your response clarified the situation for me.

Now I'm off to learn how to use javap (and get over the embarassment that I didn't know it even existed :roll: ).

Thanks again,

PS. I used Martin Cowley's FrontEnd Plus to decompile.
11 years ago
Hi all,

I'm currently practicing with Inner Classes and came across something that's puzzling me.

When I mark an Inner Class as private an extra file (OuterClassName$1.class) is generated. Could anyone explain to me why this is?

Here's what I've done to try to understand the situation:

First I created two files, and, (representing classes that have a public Inner Class and a private Inner Class respectively) as follows:

After compiling, the above the directory showed the following files:
  • OuterClassPrI$1.class
  • OuterClassPrI$InnerClass.class
  • OuterClassPrI.class

  • and:
  • OuterClassPuI$InnerClass.class
  • OuterClassPuI.class

  • By decompiling the class files I found the OuterClassPrI$InnerClass.class had the following code...

    And OuterClassPuI$InnerClass.class had the following:

    The OuterClassPrI$1.class file had the following declaration:

    There is no difference between the OuterClassPuI.class and OuterClassPrI.class files.

    After making sure the OuterClassXxX.class files could be executed successfully I deleted OuterClassPrI$1.class and re-attempted execution of OuterClassPrI.class. It worked.

    I'm figuring at this point that the xxx$1.class file is an artifact from the compilation process, but all in all I'm no closer to understanding the purpose of the extra file.

    Any answers or nudges in the right direction would be greatly appreciated (especially some suggested reading on understanding byte code ).


    11 years ago
    Thanks Marco,

    Once I had the classes all set I ran the server to bind to the RMI registry and then ran the client code. Worked like a charm.

    Thanks for your input

    11 years ago

    I'd really appreciate some help in filling a blind spot in my Java education. I'm currently beginning study of RMI but am at a loss as far as how to run any of the code examples I come across. I use Netbeans 6 (java 6) for all of my coding.

    I'm hoping someone here could give me a run down on how to get an RMI project up and running through Netbeans. To be specific, I'd like to be able to see the examples from HF Design Patterns & HF Java run on my computer. I understand the interactions of the classes invloved and that there is normally the physical separation of a network between the client-side and server-side code, but I'm hoping there might be some way to emulate the operation within my computer.

    If I'm completely out to lunch ... how do I go about building and testing code of this nature.

    Thanks in advance for your time, any pointers will be fantastic.

    11 years ago
    Hello, Kajal,

    You are definitely qualified for the SCJA ... overqualified actually.

    As you already have the SCJP and SCWCD certifications there is no need for you to acquire the SCJA. It sounds more like you should be heading towards the Architect (SCEA) or another Developer certification (SCJD, SCBCD, SCDJWS, or SCMAD).

    SCJA is an introductory certification for aspirants who are new to the Java language and tests knowledge based on the language's basic syntax, functionality, and uses. You have already been certified to a much higher level of these requirements.

    12 years ago
    Marvelous news,

    I had been disppointed when the certmanager site indicated there was no logo for the SCJA. After reading your message, a quick web search uncovered the following URL
    URL where it can be requested.

    Thanks for the heads up,
    12 years ago
    Hello Thiago,

    I hate to be the bearer of disappointing news but according to the certmanager website there is no official logo for Sun Certified Associate for Java Platform, Standard Edition.

    If you remember your login for the site, here is the URL.

    Good luck with your new opportunity.
    12 years ago

    I did a lot of searching while studying for my SCJA certification, and the only ebooks I found were by the people at Head First for the UML topics, and Sang Shin's Java With Passion free online course.

    The UML file is available on the Head First OOA&D page, look at the bottom for the link.

    The Java With Passion introduction course provides the JEDI Introduction to Progamming I & II texts which are easy to read and provide lots of information and exercises. You do not need to be signed up for the course to access the coursework, but you do if you want to submit the homework assignments and recieve a graduation certificate.

    In the spending some money category (or visiting a well stocked library), books I liked and referred to often were: Head First Java (2nd Ed.) by Kathy Sierra and Bert Bates, UML Distilled (3rd Ed.) by Martin Fowler, and The ExamScam SCJA Study Guide by Cameron McKenzie.

    I also did as many mock exams as I could, both free and purchased. You can find many through a web search that are specifically geared towards the SCJA. Having the knowledge required to pass the exam was important, but having practiced taking the exam was invaluable to me.

    Hope this helped,
    Good luck!
    12 years ago