matihost wrote:
I've got an object that I expose to my view via getModel. That object
has a typical public static final constant...
public static final String firstName_KEY = firstName;
Note that I purposefully don't provide a static getter (I don't want to
have to write getters for all
You might take a look at your XML-parsing libs. It's been awhile since
i made the switch but some dim memory makes me think that either the
transition from Tomcat 4 to 5 or java 4 to 5 either added, removed or
changed some of the built-in xml parsers.
Sorry to be so vague, it's been awhile
I've got an object that I expose to my view via getModel. That object
has a typical public static final constant...
public static final String firstName_KEY = firstName;
Note that I purposefully don't provide a static getter (I don't want to
have to write getters for all my constants).
A agree that you're going to have to bind something to the Exception in
order to do I18N resolution. And I agree that creating that binding sucks.
If you don't want to ditch getLocalizedMessage you could AOP it. Have
your getLocalizedMessage() method wrapped with some advice that swaps in
Joe Yuen wrote:
I have an application that currently is implemented using struts
1.2.8 + spring 1.2.8 + hibernate. What would be the advantages to migrate this
to a struts 2 + hibernate solution?
Er, huh?
In my experience it's *spring* that sits at the core of an app. That's
the thing
Joe Yuen wrote:
Well, that's kind of the essence of the question. What would you
loose if you did? It seems to me that there is quite a bit over
overlap to Struts2 and Spring.
I guess it depends on the app. In most spring apps I've worked with
losing Spring is sort of like losing the hub of
Rick Reumann wrote:
On Dec 20, 2007 10:54 AM, Martin Gainty [EMAIL PROTECTED] wrote:
JavaDoc mentions that shallow serialization will take place with the
include
being arbiter of which collection classes
may be serialized..
hibernate has a similar situation where lazy_init=true but I can
Jeremy JGR. Grumbach wrote:
Thanks also for the answer,
I'm using Velocity so no problem with the null values.
And yes that's a way to manage exceptions, but I as said in my previous
post, I was looking for something more generic, without specific code in
all my actions.
If you want a
This post is going to make a few assumptions:
1) You're using S2 and Spring
2) You're using Spring's OSIV filter (as opposed to Hibernate's)
3) You're using Spring's Hibernate DAO framework
4) You're using a Spring-configured transaction manager
5) You're declaring transaction boundaries and
Jeremy JGR. Grumbach wrote:
Let's take the following scenario: we have a database which manage car
models (for example Dogde Viper). The column name of the car model
table must be unique.
The user wants to add a car model in the database, thus he has an add
screen containing all the fields of
To follow up on my previous post, here's some code from a showForm
action that does exactly what I described...
public void prepare() {
if(session.get(SignUpFormBean.SESSION_KEY) == null) {
// they're here for the first time. do nothing (leave the
signUpFormBean model
I made the mistake of using the validationErrors map in my Freemarker
page...
td${(validationErrors[postalAddress.firstName]) !}/td
I did this reflexively without thinking and it worked. For awhile.
Then it broke. In very strange ways.
The problem I'm having with it is that if I add a
successfully use
required type now?
Gary Affonso wrote:
xniit2003 wrote:
Have anybody successfully used required validator.
Yes.
One thing to note about validation is that it *won't* automatically
short-circuit if you're not using the workflow interceptor. Without
that interceptor validation can
I got bit yesterday by the getModel double-call bug (wherein the
ModelDriven interceptor calls getModel twice).
Some googling revealed that a patch has been submitted to the Xwork folks.
Does anybody know what the status of a rollout/release containing this
patch might be?
I'm coding around
Wes Wannemacher wrote:
It was patched for XWork 2.1, which will coincide with the Struts 2.1 release.
Exactly what I wanted to know. Thanks!
- Gary
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Dave Newton wrote:
That depends on what happens in your getModel() call... if it doesn't matter
that it's called twice then there aren't any issues.
Let me add that the code for the ModelDrivenInterceptor is near-trivial.
It would be easy to copy-and-paste it into a custom interceptor, fix
Dave Newton wrote:
That depends on what happens in your getModel() call... if it doesn't matter
that it's called twice then there aren't any issues.
One of my getModel() methods is sensitive to multiple calls so my
solution was to code around the bug:
private boolean isFirstGetModelCall =
Wes Wannemacher wrote:
In the past, the solution was to do the work using the prepareable
interface then just returning the reference to your model. I could be
remembering incorrectly, but I would avoid doing any work in a getter.
Any reason you'd avoid it beyond the double-call bug?
I've
SmokeTheSun wrote:
Hi,
Iam working in Struts1.2 application development. In that i want to
restrict
direct access(through URL) for jsp pages or by calling .do action.
Specifically unauthenticated user must not access any pages.
ACEGI is the current gold-standard for implementing
Joachim Ansorg wrote:
Hi all,
I have two actions (action1 and action2) which both call a third action.
How can I do the mapping of the third action so that the calling action
is called again (i.e. action1 or action2)?
Before action1 or action2 finishes, store its name in one of the scopes
xniit2003 wrote:
Have anybody successfully used required validator.
Yes.
One thing to note about validation is that it *won't* automatically
short-circuit if you're not using the workflow interceptor. Without
that interceptor validation can fail and your action's execute method
will still
xniit2003 wrote:
Hi,
I am new in struts2.
In my action class I declared some global fields and one execute method.This
class extends another class, which extends Actionsupport class. Now my
execute method is getting processed twice.
From this execute method, execution goes to some other
George Dadulescu wrote:
Hi.
Is there any possibility to get the list of all the action names defined in
struts.xml ?
It's in the RunTimeConfiguration. Something like...
RuntimeConfiguration runtimeConfiguration =
ConfigurationManager.getConfiguration().getRuntimeConfiguration();
Pablo Vázquez Blázquez wrote:
Hello,
How can I red my application name and the actions' extension?
For example: http://localhost:8080/scheduler-admintool-1.0/Workspace.do
I'd need a code to get scheduler-admintool-1.0 and do from the context.
The first part (scheduler-admintool-1.0) should
clustering approach that works.
REST is cool, but I don't know how we'd use pure REST to write, say,
an online banking system. :)
-- HTH, Ted
http://www.husted.com/ted/blog/
On Nov 29, 2007 12:22 AM, Jeromy Evans [EMAIL PROTECTED] wrote:
Gary Affonso wrote:
What's wrong with the session?
There's
, defined in xwork.xml).
That's not applicable to what you want, but hopefully the above points
you in the right direction.
Oh, and this is code running under WebWork (2.x), might be a bit
different under S2.
Good Luck,
- Gary
Gary Affonso wrote:
Pablo Vázquez Blázquez wrote:
Hello,
How can I
Dave Newton wrote:
Why do you want it?
That's a good question for Dave to be asking.
Even though you now know how to get it, are you really sure you want it?
The framework shields you from this data for a reason. :-)
- Gary
Tom Schneider wrote:
Both of those plugins, by default, would need the session to keep track of
the state.
Oh, duh. I didn't see that he wanted to avoid the session.
What is up with that BTW? There seem to be quite a few posts lately
from people wanting to do stuff and avoid the http
MassimoH wrote:
How do I do something like this:
public class CustomFreemarkerManager extends FreemarkerManager {
@Override
protected BeansWrapper getObjectWrapper() {
BeansWrapper beansWrapperInstance = super.getObjectWrapper();
// !!! This
Unnikrishnan wrote:
Hi
I am new to Struts 2. I would like to know how to retrieve last inserted id.
I have page called welcome where I have 3 fields (name, telephone, email)
my execute method is as follows.
public String execute() throws Exception {
CustomerFacadeLocal
Leonidas Papadakis wrote:
Greetings to all,
i have the following scenario. I want to deploy 5 apps that have exactly
the same classes (in jars). Only db access, static files and property
files change. In short all WEB-INF/lib jar files are the same. So the
question is : option1) If i put the
Leonidas Papadakis wrote:
Also if apart from the dependency libraries, if you gather all your
classes in a jar file isn't it easier to overwrite one file so that all
apps will receive the update at once ?
In our case we rarely want each instance to be updated at the same time.
We're
My suggestion would be to checkout the scope plug-in or WebFlow and the
WebFlow plug-in.
- Gary
Radha Krishna wrote:
Hi,
I have a wizard like screen where i need to pass the selected values (2 text box) at first page to last page,last page to again first page.
Can anyone tell me the
sagarlotiya wrote:
Hi,
not going through the action means that, directly set on Model bean
without going through action.
I don't think you want to avoid going through the action. You may not
want the property to be a direct property of the action (and instead
have it be a property of the
GF wrote:
Hello,
maybe someone of you have any good link about a non-trivial custom
made interceptor
My suggestion would be to download the source and take a look at the
code for some of the built-in interceptors.
I think there were some server side articles/tutorials for webwork
Anton Pussep wrote:
value=%{'/jsp/'+#parameters.file[0]}
I thought I tried that one out already, but apparently I remembered
wrong, since it really works, which is great!
Anyway, for my part this is very inconvenient. Also I don't know a way
to pass an array to request parameters. Thus IMHO
Mark Steyn wrote:
Thanks for your help Gary. I got to the bottom of the problem, or at
least got around it in the end.
After Struts created objects based on the submitted form values, I was
using the ids of those objects to create corresponding objects
instantiated with values from a database.
You've got the interceptor setup order correct. You haven't really
provided enough info to really identify another other problems (we'd
need to see the form fields, the action, and the object being exposed
and hydrated in the action.)
But here are some things you can try...
1) turn on
Looks to me like the return value of parameters.file is *not* a String.
It's a an *array* of strings. And a toString() on an Array of strings
looks exactly like what you're seeing:
[Ljava.lang.String;...
(the prefixed [ is the clue that it's a string *array*).
If the file parameter has
Zhang, Larry (L.) wrote:
Say I have page1 (form1) and page2 (form2), on page1 I have a hyper
link. When I click on the hyperlink, it will call another action (let's
say action2) which is associated to form2 in the struts-config.xml. My
question is that how to make form1 data available in
Ted Husted wrote:
I know the JPA is growing in popularlity among Struts developers. I
was wondering if there are certain Struts 2 features that people where
finding useful in using JPA or Hibernate 3
For us it's Hibernate 3 still. We'll be moving to JPA in the code (with
Hibernate as the
Thilo Ettelt wrote:
I'm sorry I didn't make it clear enough. I do not want to access the
parameters. I would like to access all attributes of a request (i.e.
remote host, request uri, headers, etc) and I thought Struts2 would wrap
that up in a servlet independent map so I don't have to depend
Dave Newton wrote:
The action that *processes* the form submission may
extend ActionSupport.
Yup. Note that it's commonly not just form processing actions that
extend ActionSupport, it's often all actions.
Dave knows that, of course, but I didn't want the emphasis on
*processes* above to
Dave Newton wrote:
--- Mike Duffy [EMAIL PROTECTED] wrote:
Does anyone have a great solution for a validator
that will prevent users from entering malicious SQL
into form entry text fields?
I'm not sure that belongs in a validator; unless you
never need to allow the use of a single quote. It
Minghui Yu wrote:
Hi there,
I am new to Struts (version 1.2.7). I am developing a small app to
learn Struts. Could
you please give me some suggestions?
Respectfully, my first suggestion would be to use Struts 2. If you're
just getting started and you need to climb a learning-curve anyway,
Thilo Ettelt wrote:
Yes, I know :) But I don't want to depend on HttpServletRequest. I would
like to have the Request*Map*. Unfortunetely from looking at the code I
only found out how to contruct a RequestMap from a HttpServletRequest.
Omkar showed you how to get to the invocationContext().
msg2ajay wrote:
hello friends,
I am developing a struts+hibernate application which
contains a login page. I am not sure of which tools or API's to use for
logn
Authentication and encription.
Can any bady suggest me which is best for login Authentication and what way
Gary Affonso wrote:
I just checked the source for ActionSupport's addFieldError (which
delegates to ValidationAwareSupport's addFieldError).
It does do a null check on the internal FieldErrors and will initialize
the map before adding a fieldError, if necessary. So, yes, the internal
Ted Husted wrote:
Submit a patch :)
I thought about it. But then I thought that I'm not feeling qualified
to add generics support to a public API (and a heavily used one, at that).
I'm pretty good at being a *user* of generic classes but I confess that
creating generic classes/methods
I've got two questions, here's the summary:
I'm doing validation in my domain objects. They kick back a map..
public class DomainObject {
public MapString, String validate() {...}
}
In my action's validate method, I just delegate to the domain object's
validate() method. Something
by replacing
it with my own.
Now, if only the internal FieldErrors map was genericised. One of two
isn't bad, though. :-)
- Gary
Gary Affonso wrote:
I've got two questions, here's the summary:
I'm doing validation in my domain objects. They kick back a map..
public class DomainObject
So your container heirarchy is...
Report
- contains a Vector of ReportRow (called headerRow)
- contains a Vector of ReportCell (called dataColumn)
Shouldn't this just be a matter of a couple of nested loops? Something
like...
s:iterator value=report.getHeaderRow()
s:iterator
Justin Frost wrote:
s:iterator value=report.headerRow
s:iterator value=dataColumns
th
s:property value=value/
/th
Dale Newfield wrote:
So it is clearly indicated that redirectAction is recommended over
redirect, but I neither understand why, nor quite what it is that this
result type does...
If so, the new request needs to have the same URL (which must be encoded)
no matter which result type generated
Ted Husted wrote:
On Nov 6, 2007 8:10 PM, Gary Affonso [EMAIL PROTECTED] wrote:
For some reason folks new to s2 seem to get it backwards and want to
stuff a bunch of Action methods into a single Action class.
It's probably because the standard S2/WW validation workflow implies
that an Action
Gunnar Hillert wrote:
Thanks for your helpful post!
You bet.
Interestingly, this also works with redirect
actions. Since I have not seen any examples anywhere out there, I thought I
also post an example for them:
result name=success type=redirectAction
Gary Affonso wrote:
Your redirect needs to look something like...
result name=success type=redirect
param name=location
myAction.action${foo ? '?foo=' + foo : ''}
/param
/result
Note that I'm pretty sure your OGNL lookups are not going to get
url-escaped.
I looked at the code
TANG Xigen wrote:
Thank you very much for you reply!
but i try remove interceptor-ref from action , s2 still do not
bind my beans.
also, i have no idea about the concept of defaultStack,could you
explain to me more or where i can get some help pages about it?
For interceptor docs,
You can preserve errors and messages from one action to another, across
a redirect, with the MessageStoreInterceptor. See here:
http://struts.apache.org/2.x/docs/message-store-interceptor.html
This lets you avoid chaining which, of course, is usually evil. :-)
- Gary
jjgould wrote:
Ted,
Dave Newton wrote:
--- Gary Affonso [EMAIL PROTECTED] wrote:
Look at the Dynamic Method Invocation section,
1/2-2/3 of the way down.
Well, that explains it. The wildcard feature seems
to come from s1 (which I never used) and the
dynamic method invocation feature wasn't
very well
Dave Newton wrote:
Curiously, action!input is not a part of the
framework I'm familiarwith. Can you point me
to some docs that describe it?
http://struts.apache.org/2.x/docs/action-configuration.html
Look at the Dynamic Method Invocation section,
1/2-2/3 of the way down.
Well, that
Did you checkout the namespace setting of your package?
- Gary
Jake Robb wrote:
I have an action called MainMenu. It's defined as follows:
action name=MainMenu class=mainMenuAction
result name=success type=tilesmainMenu/result
/action
(I'm using the Spring plugin
I think you already know this, but in case you don't... When you
specify the action to redirect to, you have access to the OGNL stack.
So your redirect may look something like this..
result name=successtype=redirect
myAction.action?param=${paramValue}
/result
I think what you're asking is,
James Carr wrote:
Hi All,
I'm using struts 2 for a small web app that has an action attribute
that needs to maintain state. Currently I'm using sessions but I would
like to reconfigure my application to use something besides sessions,
perhaps something like viewState in .NET that would be
Ted Husted wrote:
Of course, if you use one-action-method per Action-class, then all the
annotations work just fine.
+1 on one-action-method per Action class.
My personal opinion (after nearly 5 years of heavy WebWork/s2 use) is
that this is the best-practice and that multiple action methods
Maybe this is obvious, but why not just break this into two different
action classes? Then you get easy control of where you map the INPUT
result code generated when the DefaultWorkflowInterceptor detects a
validation error.
- Gary
Manuel Correa wrote:
I found this:
interceptor-ref
) right this time. :-)
- Gary
Gary Affonso wrote:
I think you already know this, but in case you don't... When you
specify the action to redirect to, you have access to the OGNL stack.
So your redirect may look something like this..
result name=successtype=redirect
myAction.action?param
Ashish Kulkarni wrote:
Hi
I have to write a thread in web application which will check some values in
database, and then perform some function depending on the values.
There wont be any user input and this thread should be called after like 10
minutes, also i want to have a jsp page from where
Dave Newton wrote:
Interceptor or Acegi.
+1 on Acegi.
We've been doing auth by hand for years, I think we've used just about
every technique over time (writing servlet filters, writing WebWork
interceptors, doing checks in the Action's exec method, using
container-security, etc).
But
Tom Schneider wrote:
With Acegi, are you using an interceptor or is there a different way to
enforce security?
Acegi sets up it's own Servlet Filter to monitor incoming url requests.
This filter is typically the first in the filter chain, Acegi gets a
shot at processing the url before
[EMAIL PROTECTED] wrote:
Can anyone tell me how to do conditional validation in struts 2?
In one form I want validations for a particular category (say Category XYZ) only if
the candidate in that. If he is NOT Category XYZ then by checking a checkbox he
should be able to skip the validations
In our previous WebWork app we were not using ModelDriven and just
relying on OGNL assignment...
* We ensure our action provides a getter for the domain object
private Account account;
public Account getAccount();
* We ensure html fieldnames include both the domain object name and the
Jon Wilmoth wrote:
Besides the simplified view references, I've used the level of
indirection to allow for a dynamic model on a single action class
that implements a number of related actions. In my case the action
configuration sets a static property that defines the model property.
The
Dave Newton wrote:
--- Gary Affonso [EMAIL PROTECTED] wrote:
And that does it. Direct model injection. Easy.
Technically, no, it's indirected by one level.
*All* ModelDriven does is push the model on to the
stack so it's available at the top level. AFAIK
there's no compelling reason to do
Tom Schneider wrote:
This is essentially what we're doing as well, but it is far from an ideal
situation. The issue I've seen is that you can't easily use the validators
from the xml in the validate() method. Another disadvantage is that
validation is in 2 different places. Also, some of our
Wes Wannemacher wrote:
You can escape the # character so that UEL will not be invoked. In
fact, this is necessary for anonymous OGNL list creation
i.e. - https://issues.apache.org/struts/browse/WW-2213
Good to know, thanks Wes.
- Gary
Dave Newton wrote:
http://struts.apache.org/2.x/docs/can-we-use-jstl-with-the-framework.html
Yah, I saw that. But I also saw this...
http://struts.apache.org/2.x/docs/exposing-framework-objects-to-jstl-with-a-jstl-and-displaytag-example.html
...which, if I'm hearing you correctly, is
I need some clarification on what is happening when I mix naked EL
expressions with Struts tags in a JSP page.
To put this in context, lets say I have an action that makes a product
object available to the view via a getter (in the action). In the JSP
view I can do this:
${product.name}
78 matches
Mail list logo