I guess the questions I have are:
If by "from scratch" you mean you don't want to just skin previously existing widgets, I would start by picking a javascript framework that met your specs (jquery, dojo, aria, etc.) and then seeing if they can stretch as far as you can push them. (this is assuming you don't mind the widgets being open-source. Also that you can either make up for any lack of accessibility or don't see that as an issue.)
I would not rely on server-side for more than outputing the code, saving changes, and loading saved data for the widget. If you are already going to need ajax to pass interactions from the client to the server, why stall out the widget making the server pay attention to the other mechanics of the widget?
I would not use Java, but for the same reason NSherwin would. It's not my forte. But I also think that we are moving beyond the reliance on compilers and full-blown apps for getting things executed on the web. Java will have it's place for the foreseeable future, but we don't need to lean on it (or Flash, for that matter) when our browsers (and developers!) can do the work faster and with less overhead. (Not to mention that this could HELP accessibility and usability. Think mobile phones not needing a special app for viewing Facebook or Twitter!)
All of this changes a bit based on my first question: What do you mean by widget? If you mean an appointment calendar, or a photo frame, or countdown timer (God, I'm boring, sorry), then keep everything I said above in mind. Use php or RoR to generate the code, js via a good framework to make it tick, and ajax to either xml to MySQL to handle interactions beyond event handling.
But if what you want is a widget for visitors to play pac-man, or design their dream home floorplan, or something really math/graphics heavy, I would then bow out to those who know a lot more than I do about Java/Flash. I think the day is coming where I can bang a drum even in those cases, but getting something even close today is not worth the man-hours.
Here is something I am currently struggling with that may help refine your needs...
Let's imagine a widget like the Southwest Airlines Ding! desktop widget, but on the web. It will alert you the moment a good deal comes up. Time is of the essense because there are limited spots. Do you have the browser query the server every half-second to see if there is an update? Do you set up a DB that, on update, sends out a crontask to the server to run a script that updates an xml file that is much easier for the browser to check for filesize changes? And all of this so that the user can here a DING without having to hit refresh (which would probably produce a less-efficient version of the same strain on the server)?
I have a js script that queries the cookie for the active page every half-second so the user get's a warning when they are about to be kicked out. I'm sure there is some event listener that could maybe eliminate the need for looping, but is there an equivalent for when something happens on the server and the browser is just hanging out?
Just my thoughts on widgets and web-apps. Hope it was helpful.