Frederic Daoud

author
+ Follow
since May 22, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Frederic Daoud

Matteo Di Furia wrote:
1) I'm using iBatis at office, so I know how to use it, but I've also read that Hibernate is more powerfull and more complete than iBatis. But, on the other hand, I don't know Hibernate, so I'd like to read your opinion about it, to understand if I might be better to study it or if I should avoid it.



If you are already using iBatis, I don't see why you'd need to switch to Hibernate, especially if your SQL is good and if you have several complex, well-designed SQL queries and so on. On the other hand, if you have a ton of SQL "boilerplate" that is just mapping between Java properties and SQL table columns (which really should not be the case if you are using iBatis properly, or rather, MyBatis), then perhaps switching to Hibernate would reduce this boilerplate code.

Matteo Di Furia wrote:
2) I also use Spring + WebFlow + Tiles at office, but reading the Stripes documentation it seems to me you can do with it what we do with the combination of 3 different frameworks. So, what do you think about it ? Which is better in your opinion (I know that "better" has little to no sense when comparing different frameworks, just leave your two cents about this argument).



Indeed, you can achieve with Stripes what you are doing with SpringMVC+WebFlow+Tiles, with less code and less configuration. Stripes is easy to learn and use, and gives you a lot of bang for your development effort buck.

Hope that helps. Wish you good success with your project.
While I agree with Bear that large monolithic frameworks can get in your way more than they help you, and I certainly share his feelings towards JSF (I hate it with a passion), I wouldn't want to develop a web application with just Servlets and JSPs.

You start out nice and simple, but then, what happens when you need to support file uploading? That isn't a simple issue. Maybe you pull in a library like commons-* and you're all set. Then you need (other common feature) and you pull in (other lightweight library that neatly solves the problem). So really, you are building up your own custom "framework" as a combination of libraries.

Nothing wrong with that. I find that Stripes solves those kinds of common issues without being large and monolithic, and without getting in my way.

Bear, I suspect that you've built up a set of libraries, helper classes, and so on, along the way, so that you can quickly solve these kinds of common issues. I'm sure you don't start from scratch.

So, either way, I'm all for lightweight solutions, but just Servlets and JSPs and nothing else doesn't cut it in my opinion, sooner or later you'll need to add a feature and using a tried-tested-and-true solution will be faster than writing everything from scratch yourself.

My 2 Canadian cents.

Cheers,
Freddy
http://www.stripesbook.com
http://www.fdaoud.com/clickbook

Subhadip Chatterjee wrote:
Now if I try the URL "/search" from the browser, it's mapping SubClassOfXYZ, and invokes the inherited @DefaultHandler in it. So, from the browser it seems as if Base class is getting invoked.



What is actually happening is that the subclass is being instantiated. An event handler from the parent class can still be invoked, just like regular object-oriented programming.

Subhadip Chatterjee wrote:
The only problem is if there are more than one sub-class, then to invoke the URL of base (though an abstract), I've to keep one of subclass's @UrlBinding as the above example. Let me know what do you feel about this approach (though not much logical in my opinion).



I think you should put the common code in your base class, but no URL binding on the base class, only in concrete subclasses.
When you invoke a URL, Stripes tries to create an instance of the corresponding action bean.

But as you said BaseXYZActionBean is abstract, so by definition, it cannot be instantiated.

So you either have to make the base not abstract, or move the URL binding to a concrete subclass of the base.

Hope that helps.
Hi Alexander,

Normally I would say that if the form does not modify the database, use a forward. For example, the form contains criteria to query (read-only) the database.

On the other hand, if you are writing to the database, you should use a redirect. In that case, it's easier to forward from "pageOneActionBean" to "logicActionBean" and then redirect from "logicActionBean" to a read-only action that displays the result.

Hope that helps.
Ger, could you paste the Product class and the rest of your action bean? It will be easier to try and determine why it's not working.
Well, you said this was data to display in the original JSP, so in that case, sure you can, with ${actionBean.info}.
Hi Gerard,

Just add the "edit" action to the list of startEvents in the @Wizard annotation:



Cheers,
You can just use a getter method in your action bean:



Hope that helps.

Cheers,

Nathan Pruett wrote:I haven't used Stripes (yet...) - but for other web application frameworks what I've done is write a html page that redirects to my "real" start page that is rendered through the framework, or make the page HTML only with links/actions pointing to URLs mapped to actions/controllers within the framework.



+1

I find that this is the best way to go. A very simple index.html file with a meta tag that redirects to your initial URL. With index.html as your welcome file, it will work and it is very clear for others to follow.

You can get Hello.action as a welcome file to work, but you need an empty file with that name to "fool" the servlet container. Personally, I don't like this method, because it does not work with all servlet containers, and it is less clear what is going on. Others may come across the empty file and wonder what it is doing there - maybe even delete it, and your welcome page stops working.

Do yourself a favor and just use the simple index.html file that redirects to your initial URL. You can use this method with any web framework.

Vadim Vararu wrote:I can't understand what's wrong. I put default properties file in one of source packages of the application!



Actually, the StripesResources.properties file belongs on the classpath of the application: WEB-INF/classes.
Hi Gabriele,

I finally found the problem: the link to edit the News item targets NewsListActionBean, but it should target NewsEditActionBean since this is the bean used in news_edit.jsp, in the <s:form beanclass=""> tag. Otherwise, Stripes does not find the News object, and that is why the form was always blank.

Here is the code to be changed:

news_list.jsp:



NewsEditActionBean.java:



The news_edit.jsp does not need any changes, and now displays a prepopulated form.

Cheers,

Gregg Bolinger wrote:So here is what I noticed. The edit method doesn't do anything but forward to a view. My first question is, does the type converter that Stripersist creates automatically populate the object from the database or should that be done in the edit method of the action bean?



If the class is annotated with JPA annotations (@Entity, @Id), the Stripersist type converter automatically populates the object.

I was going to ask Gabriele to post the code for the News class, but I figured that it was properly annotated since the update does work and the correct changes are made to the database.