Ted Smyth

Ranch Hand
+ Follow
since May 28, 2008
Merit badge: grant badges
For More
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 Ted Smyth

Yani Abela wrote:I am currently doing a DVD Rental System that when the user runs the program, he gets to choose from the menus. My problem is that when the user enters a menu and customizes for example a client, I don't know how to go back for the main menu.

Hi Yani! When case #6 is selected, you need to break out of that loop (typically by setting your while condition to false, see code snippet below). Without seeing your program I can't guarantee this will work, but likely this is the solution you are looking for. The "Clients" screen is a loop that was accessed from the Main Menu loop, so to return to the first loop, simply break out of the second loop.

12 years ago

Tina Smith wrote:This is confusing...
What is Calico? Is it a String? An Object in a different class?

I was about to ask the same thing! And to the OP, it's normally bad form to capitalize the first letter of an object instance (ie. private String Calico; //bad form, use calico instead). Because that is the convention for a Class or Interface name (ie. public class Calico). You can easily confuse variables/members with classes that way.

Tina Smith wrote:If I follow your question, which I think occurs around line 24, you'd be better off putting into a List. List provides a .contains() method that will allow you to skip any looping entirely. So you could just write

OP: Using this method you need not worry about how checking for existence of the String occurs (however, an ArrayList implementation of List will simply loop through the internal collection using the equals method against each item in the list).

Tina Smith wrote:And Welcome to the Ranch

Yes, welcome!
12 years ago

bunta bunty wrote:Hi,

But its a blank page. I just created a new dynamic web page and tried to run that page, hence i dont think there is some object which is throwing this exception. There might be some jars missing or something related to apache but i am not able to figure it out

For setting up the workspace i followed this link:


After clicking finish, when the project is created i run my blank web page and got this exception.

Please help


I ran into a similar issue, albeit with Glassfish and JSF 2. What version of tomcat are you running? There may be some incompatibilities between your JSF version and tomcat...
12 years ago

Campbell Ritchie wrote: . . . and why are you suppressing a deprecation warning? That looks suspicious to me.

Likewise. The getMonth() method of java.util.Date was deprecated some time ago (JDK 1.1, lol, that's some serious backwards compatibility right there).
12 years ago

Maneesh Godbole wrote:I think if it was part of the "official" java, it would get widespread attention. I really think it is a good and powerful layout. After viewing many threads about people getting confused either with the concept of layouts or with which layout to use, I found Mig Layout comes closest to "natural thinking" in terms of alignment and placement.

Couldn't agree more Maneesh... I also voted for MigLayout to make it in. Best LayoutManager there is!
12 years ago

Natalie Kopple wrote:
code snippet:

That's not a valid class definition (you cannot place statements like "someObject.someMethod(params);" in a class body, they must be in a method or static initializer). This would be an example of a valid ConsumerOrchestratorComponent which does some "orchestration" via a static method:

You can then invoke it like this:
12 years ago

Mark Reyes wrote:Hi,

I've been exploring Primefaces components for sometime and I am impressed with the responsiveness of the tool.
Just would like to ask from ranchers here if they would recommend this?

I havent check Richfaces/MyFaces or Icefaces though.


I can only provide input on PrimeFaces, but I think it's a really great set of components and is actively developed and maintained. I recommend it. Over the other two? I can't say, having had no experience with them.
12 years ago
Hey Jesse, try putting the [ code ] and [ /code ] tags around your code to format it nicely, like so:

And can you post the source code for TextIO? Without it we can't really tell if the file is even being read properly. To start, before you start parsing the file contents, just print out the "input" string, to see what was read from the file:

12 years ago
Probably need to move this to the "IDEs, Version Control and other tools" forum.
A thrown exception will be caught by whatever catch clause exists to catch it; whether it's in the your current method or the method that called it doesn't matter, for example:

This will simply print the message.

In your code:

The exception is caught immediately, you print a message and then the stack trace, and the Java program happily executes the rest of itself, whatever it may be - the exception has been handled and will not be passed on to anything UNLESS you re-throw it:

Note that I just added "throw ex;" to the catch block. So in your case, methodB and methodA will never catch the exception from method C because you've already handled it right away (try removing the catch clause from your methodC, then from methodB, and finally from methodA!).
12 years ago

fred rosenberger wrote:When it terminates, do you get an error message? Those actually give you a HUGE hint as to what the problem is. You did not give us enough code to try and run this, so nobody can really make suggestions - only wild guesses.

Indeed, post some sample contents (or the entire file content if you can) of a line in the file you are reading.

If Java is terminating, there should be a stacktrace which tells you what went wrong, and where.
12 years ago
The problem is you're following RoseIndia's tutorials. AVOID THEM AT ALL COST. OK - they're not all bad, but the vast majority of their tutorials are garbage, nonsense, or use bad/outdated java practices.

Try mkyong's http://www.mkyong.com/jsf2/ tutorials first.
12 years ago
Running a JSF 2, PrimeFaces, Spring 3 MVC/WebFlow application and I've run into an issue with JSF's <h: outputStylesheet> tag. Specifically the order in which it renders all of the specified stylesheets.

PrimeFaces uses themes and a number of CSS fiels which are linked in using the JSF resource loading mechanism (in some arcane manner hidden from the developer). I am overriding certain PrimeFaces CSS classes to tweak the look & feel with a custom style.css file (which naturally, must be the final .css file linked on the rendered html).

All that to say, the stylesheets are being rendered in a bizarre order. On initial page load (after application deployment), the style.css link appears at the top of the script links:

yet after hitting refresh, the style.css link appears at the end:

Is there any way to ensure the order in which style sheets are included on the page? Seems like Mojarra/PrimeFaces are not respecting the order in which I write the includes.
12 years ago

I ended up having the DBA delete the trigger, which resolved my issue when using Hibernate (I had to add the appropriate @SequenceGenerator and @GeneratedValue annotations, however). But I encountered ANOTHER issue with a very simple query that Hibernate just refused to execute due to invalid column names. I tried Toplink and Eclipselink, and ran into similar issues...

Soooo back to OpenJPA it is! So much for JPA compliance across persistence providers...