Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

chad michael davis

Author
+ Follow
since Mar 01, 2006
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 chad michael davis

Absolutely!
12 years ago
Arun,

Struts 2 in Action devotes an entire chapter to Spring and Hibernte integration. We even show how to use the Spring support for Hibernate/JPA to make it even easier to get data persistence in your app.
12 years ago
ACtually, STruts 2 uses FreeMarker templates to render its tags. And YES! the book goes through all of this, and even provides some examples of customizing the underlying templates to create your own versions of the UI Component ( forms, input fields, etc. ) tags.
12 years ago
The fileupload interceptor is already in the default stack, which your action inherits automatically since your package extends struts-default.

Actually, by defining that interceptor reference for your action, you are replacing the full default stack with just that single interceptor. Basically, as you have it, you've removed all of the default interceptors and replaced them with one; and it can't do even it's job without the others.

In short, you can fix this just by getting rid of that interceptor reference in your action.

Our book tells all about how to handle interceptor stack configuration
12 years ago
As a Struts 2 developer, I'm more interested in my IDE's support for my servlet container, debugging, etc. Are you familiar with stuff like the Eclipse Tomcat plugins, or similar stuff for your own container of choice?
12 years ago
I would like to say that IMHO Ajax tags aren't really that important, when choosing a framework for AJAX, compared with how well the framework supports exposing your backend to the asynchronous, non-page rendering calls of a rich UI / ajax app. This is very important, and struts 2 supports it with the result type flexibility, which allows you to quickly add JSON or XML to any action. Most importantly, the action doesn't have to be modified from its previous, or alternative, life as servicer of fullpage responses to a classic web application.
12 years ago
Yes, we opted to leave out the JSF stuff, but Struts 2 does have JSF integration support.
12 years ago
If you take advantage of Struts 2 i18n support you can get a very elegant solution as follows.

I can define the following property, that takes advantage of Java's MessageFormat support in properties files ResourceBundles.


item.price={0,number,currency}

Now, I will pull this text resource from my bundle with the struts 2 text tag, passing a parameter that references some data I've prepared in my action.

<s:text name="item.price">
<s aram value="totalCost"/>
</s:text>


The output will be a currencty formatted price.


Is this what you had in mind?
12 years ago
I would definitely recommend against making new stacks for everything. I find it hard to believe that very many actions, or packages of actions, need a different stack than the rest.

There has been some discussion of performance issues related to unused interceptors in stacks, but I think the general consensus is that its not an issue.

We certainly show a conservative use of stack building in Struts 2 in Action. One of the biggest issues is that you will make troubleshooting very difficult the more you toy with the stack.

But this doesn't mean that you shoudl be scared of interceptors. We also encourage the creation of your own interceptors, and we show how to do that by demoing an "application" level authentication mechanism done in a custom interceptor.
12 years ago
struts-default.xml is the built in configuration file that defines all of the built-in components that come with Struts 2, out of the box. I.e., this declares things like the default stack of interceptors.

The line you see is just the log statement of the Struts 2 filter running its config set up. I doubt this file is the cause of the problem . . .
12 years ago
I didn't mean to suggest that Matt Raible's comparison was on the helloworld level. I just mean that it you probably need first hand experience to make the decision, if the decision is up to you, on which framework will better suit your needs.

I guess I just don't believe that there's a hands down, objective winner. It's such a complicated matter, and that's not even considering stuff like corporate investments in technology, at the developer and codebase level. I wouldn't want to be the guy having to decided this kind of thing for a big company.
12 years ago
Actually, the handling of type conversion error values might provide an interesting parallal. When type conversion fails, and the values can't even be set on the model object, they are still preserved on the ValueStack so that they can be written back to the form fields.

It makes sense that non-validated data shouldn't actually be set to domain objects. I think its a conflict of use space, where a single object is serving two roles: 1) the domain model object and 2) the target of Struts 2 data transfer

BTW, your link to the previous discussion didn't work, can you repost that?
12 years ago
Interesting. Why do you think it's a framework problem? Why couldn't it be viewed as a problem with the common OSIV type implementation of persistence?

I've been thinking about this problem and wondering whether there couldn't some sort of rollback of property values when validation fails.

Good question.
12 years ago
I'll stick to the Ajax stuff . . .

The Ajax tags are still in development and a bit of state of flux. I recommend keeping an eye on them.

In general, the real bonus of Struts 2 for Ajax folks is the flexibility of the result type. In the book, we provide an example of writing your own custom result type that returns the result from any action in the form of JSON. This makes integrating your backend with your rich ui very easy and flexibile.
12 years ago
The spring integration portion of the book shows you how to set up the spring plugin, which augments the frameworks internal OBjectFactory. This allows Spring to intervene and manage the creation of all of the framework components like actions, interceptors, etc. For examples, we specifically show how to use Spring to auto-wire and to manually inject things such as actions and interceptors.

I think this is enough so that you can apply your own spring knowledge to full effect.
12 years ago