Help coderanch get a
new server
by contributing to the fundraiser

Jason Kosowan

Greenhorn
+ Follow
since Sep 25, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jason Kosowan

Hi All
I have been recently trying to put together a nice normal webapp using Struts and EJBs and I'm totally fed up with Struts. The EJB component works beautifully (especially with the new 2.0 spec) but the Struts is heavily broken as well as very labor intensive and finicky.
Anyway, I've been reading something about the Velocity/Turbine project and am hoping that MAYBE it might solve my problem.
Basically, Struts has no persistence model in mind. To me, this means that, in addition to producing all of the redundant code that EJB requires, I also have to re-re-define all data structures in FormBeans and then re-re-re-define the FormBeans in the struts-config.xml, always right down to the fieldnames and datatype! (That's FOUR times, ladies and gents, in the BEST case scenario). Additionally, I've got to go through the largely redundant work of mapping FormBeans to EJBs and back. It's a godawful task. Even for a few tables, we are talking a MAJOR undertaking. Now I know about Dynaforms, but then you get into the whole "can't (easily) construct them and they can't do anything for you" kind of thing. (i.e. forget about doing custom validation, any method calling on the Beans, etc.)
Additionally, exception handling in Actions is a real mess and I'm not crazy about the way that success/failure on an action is done (i.e. pass the string "SUCCESS" for ok and "FAILURE" for not).
So, I'm thinking about bailing and going to TDK. It's also Model 2 and, since Turbine and Velocity are hand-in-hand, at least they MUST have consolidated their data framework to one object model, right? (I'm SO hoping this is true since it would eliminate my number one gripe.)
Now after that lengthy preamble, here's my question!
Is there anyone out there who has used both Struts and Turbine? Does Turbine give you anything extra that Struts doesn't, ESPECIALLY regarding the backend?
It's not that I don't CARE about the front-end. However, me not being visual, it will look like hell no matter what I use.
Thanks. I'm going to be starting my TDK work tonight and, if you'd like, I'll post my findings. Also, if you have questions, just email me. I'm really working in the dark on ALL of this and having someone for regular javadev correspondence would be superduper.
Take care,
Jason
20 years ago
Well, I can't say that I've used netbeans, but have used Eclipse and also JBuilder. (Gawd help me, I've even TRIED to get into VAJ a couple of years ago) My experience with these 2 just validates my opinion that there are no good java IDEs out there yet.
Don't get me wrong, both are ok but they've got some serious problems.
JBuilder - the biggest problem here is it's debugger. Sure, you can browse an object in the tree, but can you evaluate something like "myobject.toString()" and see the result? No. This is disgraceful - even command-line jdb can do this. Other than this, though, JBuilder is very easy to get up and running in a short time.
Eclipse - The most compilcated IDE that I've used and I've found that it's tough to get started with this one. Bad points first:
* You absolutely need to know how to code up an Ant script. IMHO, Ant is good but it's integration with eclipse is far from automatic, which may be a barrier if you don't know Ant.
* V-E-R-Y S-L-O-W - yes, it's a VERY slow IDE, ESPECIALLY if you change your default editor (e.g. use the Ant editor to edit all XML files, not just build.xml.) Believe it or not, it takes me sometimes 5-10 minutes to open a simple XML file (maybe 100 lines) on a P3 w/256 MB ram. I use this editor because I like syntax-highlighting, but the cost is high.
* I like the automatic compiler, but it does slow down Eclipse even further.
* Project corruption - I've also had the problem of directories that simply didn't disappear. Tried everything, but still they would be there. Had to backup everything, erase the enitre project, and rebuild. Only then could you get what you want
Good points:
* Debugger - it's got one
* Command-completion !!even within the build.xml!! This has got to be the most nifty feature. But, you've gotta ask yourself, how much monkeying do you really do with your build.xml? After mine is written up, it rarely changes, so although nice, it's not so useful.
* Search program - allows you to search through all code for a particular string. (i.e. no more find . -type f | xargs grep "blah blah")
So, end of the day, yes, I'm using Eclipse because my project is very large. Am I thrilled? Not really.
For smaller projects, I never ever use eclipse. Instead, it's just Context (my fave text editor) plus Ant plus command-line jdb. Simple, reliable, and fast.
I have heard that IntelliJ is really nice but it's costly and almost never a corporate standard. Anyone ever use it?
Hi guys
Actually, there are mechanisms built into Java to do this kind of thing.
To stop a running thread, the class that stops the thread must call

But, this alone is not enough. Within the thread, I've successfully used the following in a method that is declared to throw InterruptedException.

Interspersing these calls at appropriate times within the thread (i.e. between critical operations) will give a responsive and safe way to stop and start things.
If you want to see this in action, my little open-source project Spiderfish uses this type of interruption with Swing/JFC.
Spiderfish Project
Hope this helps.
More news - overriding the validation portion of the form confirms that the validation is being automatically called.
But, it also confirms that the super.validate is not returning any ActionErrors, regardless of invalid input!
21 years ago
I'm new to Struts as well but have managed to get a reasonable security setup put together. My first bit of humble advice is this:
*** don't write your own security layer ***
To do this would be more time than it would take you to learn about your application container's security features. Writing your own would also be less secure and less flexible than using the container. (This is not a slam - container security is taken seriously by most vendors and they spend the time to do it "full-on")
Ok, that being said... you must now decide on how you want your username/passwd to be stored. Containers usually give you the option of storage in a file or in a DB. If the usr/pwd are already predefined and unlikely to change, the file option might be easiest. But, if you want to be able to add/delete/change users on the fly from within the app, the JDBC option is most likely the best.
A word about the JDBC option: in this scenario, because the container (and not struts) will be checking usernames, it may be easier to do your connection pooling on the container level as well. Not that I've heard anything bad about the struts connection pool, but it may be more difficult to set up the container to read from an outside pool than from it's own.
A word about hashing: When storing the passwords, you may also want to store the hash of the password rather than the password itself. This ensures that the passwords are unreadable by anyone that is casually browsing the database or security file. Investigate if your container supports this and use it if it does.
Then, just decide what URL patterns / subdirectories you want protected, set them up, and away you go.
I hope this helps.
- JK
21 years ago
Hi again and thanks for the suggestions. I tried the suggestion about putting the action into the validation.xml, however and still no luck. So, then I went even simpler. I switched to a normal validator form to test even if the regular Validation worked. I made sure to extend from ValidatorForm and put in all of the niceties but *No Dice*. I'm completely stumped.

It must be something small that I'm missing here. I'd love to be able to use this framework and thought it would be fairly straightforward, but the integration is astoundingly rough.
If anyone has more ideas, please let me know.
I think my next step is to override the validate in the ValidatorForm and see if it even gets called. If it doesn't then I think I've got a very bad problem.
Maybe it's my container? (I'm running Resin 2.19)
21 years ago
I can't believe how much problem I've been having with the struts validator framework! I can get NOTHING to work and have spent HOURS on this! I've read about 4 online tutorials, went through 3 textbooks and it's still not working.
Any help would be appreciated. Here is my DIRT SIMPLE example that DOESN'T work.... Grrrrrr....
-- struts-config.xml --
<form-bean name="TestForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="email" type="java.lang.String"/>
</form-bean>
.
.
.
<action path="/TestAction"
type="mypack.TestAction"
name="TestForm"
input="/test.jsp">
<forward name="GOOD" path="/thankyou.jsp"/>
</action>

-- validation.xml --
<form name="TestForm">
<field-property name="email" depends="required"/>
</form>
-- my test.jsp --
<%@ include file="/WEB-INF/taglibs.jsp" %>
<HTML><HEAD><TITLE>Test page</TITLE></HEAD>
<BODY>
<H1>test page</H1>
<P>
Errors start
<BR>
<html:errors/>
Errors end
<P>
<html:form action="/TestAction">
Your email: <html:text property="email"/><P>
<html:submit/>
</html:form>
</BODY></HTML>
*************************
Note: the WEB-INF/taglibs.jsp contains taglib declarations for all struts taglibs. (This is the ONE thing that actually works in this project of mine). Also the action class does nothing but return the "GOOD" string. (It SHOULDN'T do anything, right? The validation framework is automatic, right?)
So, I boot my server and ensure that both validation XMLs are loaded. Then go into my input page, just push the submit without filling in the email section to test the validation. I am immediately ushered to the "Thank you for the valid data" screen.
What is wrong here? I've seen about 8 posts via google about people having problems with this, but not one answer. I'm to the point where I now believe that the validation framework is vaporware!
[ July 13, 2003: Message edited by: Jason Kosowan ]
21 years ago
Hi everyone
Just finished presenting this online tutorial that I wrote up on Ant and thought I'd share it and get some thoughts.
It's especially for newbies.
http://www.kosowan.com/devdocs/ant-tutorial/
21 years ago
Ok, now that I've finally registered correctly, hopefully I will be off the sheriff's bad list...
Anyway, I haven't been to this discussion board in awhile, and now I come back only to find that my name is being slandered around the board. I think this is just terrible. What is wrong with you people? I just posted a couple of (what I thought were interesting) things, helped some people out on some technical issues, and now someone is demanding that I apologize to the group? What I'd like to know is "for what?!?!" What did I do?!?
IMHO, the conduct here is worse than anything I've seen in any discussion group before. Those people involved in this should be ashamed. Don't expect me back to these discussion forums anytime soon...
22 years ago