stanlick wrote:
The logic considers the action name without regard to the package the
action
is contained within.
I'm confused by this also. I thought an example implied either a real-world
or contrived scenario where the problem in question manifests itself.
--
View this message in
Hi all,
I've been spending time with Struts 2.1.6, and the
NamedVariablePatternMatcher, and I've come across a potential issue.
The issue comes into play when defining a class such as this :
@Namespace(/content/{year}/{month})
public class ContentAction extends ActionSupport {
private
I believe this was a security fix, as there was an issue where ognl
expressions could be used to do something drastic to the application server
( like System.exit ).
I believe the expectation is that you can get around it by creating your own
customized tld or something like :
c:set
you could do this
c:set var=req value=${pageContext.request}/
s:property value=\%{ attr['req'].contextPath }/
s:property value=\%{ attr['req'].pathInfo }/
Basically, stuff the object into the pageContext somehow and then reference
it again via ognl.
It's a pain, but a very slight one.
-a
on the jstl/el expression
language.
-a
Manuel Correa wrote:
page s:property value=%{#request.request.contextPath}/
Didn't work!
Have to be a way to active the EL in the Attributes..
Manuel Correa.
-Original Message-
From: cilquirm [mailto:[EMAIL PROTECTED]
Sent
class:karakas.struts.RicoTextProvider - bean -
/web/WEB-INF/classes/struts.xml:10:109
Caused by: Bean type interface com.opensymphony.xwork2.TextProvider with
the name xwork1 has already been loaded by [unknown location] - bean -
file:/D:/projects/Karakas1.1/build/web/WEB-INF/classes/struts.xml:10:109
cilquirm wrote
A failed type conversion will incur a field error as well.
wild_oscar wrote:
newton.dave wrote:
--- wild_oscar [EMAIL PROTECTED] wrote:
In a form I have a parameter passed like:
s:hidden name=oldSop value=%{sop}/
where sop is of class I created.
When I execute the action
you can redefine it in your struts.xml, much like how you would specify the
object factory to override the default object factory .
-a
Igor Vlasov wrote:
Hello.
I want to change some information in struts-default.xml.
I can move it to classes directoty and do any change:-)
Is
You can, if you grab the ValueStck and traverse up it till you get to your
previous action.
Igor Vlasov wrote:
I have action one and it calls action two throw:
result name=success type=chain two/result
I can use ChainingInterceptor to copy properties of one action to two
Sorry to hijack this thread, because I fully agree with Wes that this is
good stuff to put into a wiki.
It's a little trickier with the apache wiki because you need to sign and
send over the CLA ( not terribly hard, but sometimes may not be possible. )
Any thought given to using a secondary
of engaging people to
add and modify stuff. Getting someone else to maybe do it doesn't seem like
a form of engagement.
newton.dave wrote:
--- cilquirm [EMAIL PROTECTED] wrote:
Any thought given to using a secondary wiki ( like
Wetpaint or one of the other myriad of services that
come up when
I use Zero Conf and codebehind a lot, and I think they're both incredibly
useful. especially in this newer world of convention over configuration,
etc... When I have a package hierarchy all set up, i don't feel the need to
muck with struts.xml, because I can get directly down to coding.
There's nothing preventing you from adding back commons-beanutils or OSCore (
http://www.opensymphony.com/oscore/ ) to get back to that level of
functionality.
I'm not 100% sure why this mechanism is necessary. If you name your getter
on your TestBean appropriately, S2 should take care of it.
You can throw an exception , which you can specify in your
@Transactional( rollbackFor = )
to have it rollback.
jon_french wrote:
Yes. But I am using Spring managed transactions that in my understanding
are outside of the struts Interceptor stack.
My DAO's are annotated with the
Nope, since IAs and sitemaps are very site specific.
Java does, tho. It's called java.util.Stack ( or at your leisure,
commons-collections has ArrayStack )
:-)
-a
stanlick wrote:
Can you tell me if Struts 2 has a facility for breadcrumbs?
On 9/25/07, Antonio Petrelli [EMAIL
Are enums type-converted automatically now?
I recall early on I had to specify
http://struts.apache.org/2.0.9/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html
Have you tried specifying that?
with
Element_selectedNutrients =
EnumTypeConverter
cilquirm wrote:
Are enums type-converted automatically now?
I recall early on I had to specify
http://struts.apache.org/2.0.9/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html
Have you tried specifying
in XWork2?
cilquirm wrote:
Indeed, the problem is that EnumTypeConverter, as provided by Struts2
only works for single values.
Can you make selectedNutrients a List?
If so, you might be able to use the EnumTypeConverter from the showcase
app, or roll your own based off it, which isn't
You can also map each method to a name in your struts.xml by using the method
attribute of the action tag.
action name=test class=mypackage.MyAction method=test/
Ganebnyi Genadii wrote:
Requesting action like /web-path/someAction!someMethod.action, calls
SomeAction.doSomeMethod().
I'm not sure I follow this 100%.
Are you saying that a single null propery being passed into the setter of
your model caused a whole new model object to be created?
So you have : firstName, lastName, and address1
address1 was read-only ( disabled or whatever you want to call it ).
your
I'm not sure I follow how validation is more flexible when using annotations
vs. xml files.
Aliases are how you tell xwork that this method is the one to be executed,
so there's a 1-to-1 mapping between aliases and methods.
File based validation is, in a sense, more flexible, because you can
somewhat hackish, but you can accomplish this by using expressions :
#params['attrib'] != null ? attrib in ('a','list','of','values')
(this is just an example stating that you can check for the existence of the
variable in the parameter and then execute an expression like you normally
would )
I'm pretty sure that making FilterDispatcher a Filter was a design decision
so converting it to a servletdispatcher may not be as easy or as
straightforward as one might think.
If memory serves ( and these days, that's not guaranteed ), it actually used
to be a filter/servlet combination before
:
validators
field name=myInputFieldName
field-validator type=requiredstring
true
message key=errors.required/
/field-validator
/field
...
cilquirm [EMAIL PROTECTED]
17/09/2007 16:50
Veuillez répondre à
Struts
I don't believe OGNL supports concatenation of lists, but such functionality
could be achieved using chained subexpressions :
( ticketStates.add(0,new MyObject(-1,All)), ticketStates )
which would insert the new object into the head of the list, and then return
the ticketStates object as the
Al Sutton-4 wrote:
Hi Richard,
Thanks for the pointer.
I'm using 2 actions because my current belief is that using a single
action
would cause problems with result names because you can't define separate
SUCCESS results for the form prep and the form submission if you only have
one
Al Sutton-4 wrote:
Ok, Looks like the first part is confusion in terminology. I took Action
to
mean an action as defined in struts.xml, but I now see Richard meant a
single class used to declare two actions.
Your solution to the second part doesn't seem right to me. My
understanding
In my experience, just having OSIV doesn't automatically imply that you
expect all your data to be retrieved ad-hoc. (maybe the users do :)
OSIV doesn't prevent the user from using eager fetching when necessary or
useful ( and my experience delays it until your application is working and
the way to construct a map in ognl is
%{ key : value , key : vale }
http://www.opensymphony.com/ognl/html/LanguageGuide/collectionConstruction.html#mapConstruction
hth,
-a
Hartrich, James CTR USTRANSCOM J6 wrote:
I'm iterating a collection (keys) from s:action to get corresponding
I think you have to 'know' somebody to get it incubated. i.e. Just because
you're offering, doesn't mean they'll bite. (And I don't mean that in a bad
way, either. )
Check out the incubation docs for more info :
http://incubator.apache.org/incubation/Incubation_Policy.html
Barring that,
That's a mouthful.
OGNL does have an 'in' operator
customer.creditCards[0].type in [ 'AMERICAN_EXPRESS', 'VISA', 'DISCOVER' ,
'MASTERCARD']
note that you don't have to do toString() if type is already a string ;
ognl's equality operator ( == ) already uses equals.
If it's not of type String,
By the looks of it, your classpath is messed up.
Is the hibernate3 jar in the right place?
I can't think of any other reason it wouldn't be able to find
org.hibernate.MappingNotFoundException
LucaLuca wrote:
Hi,
I've tried to make some changes to make it work..But nothing!. These are
Frank, would you care to give the same tests a shot with ognl 2.7 and
javassist in the mix.
Although none of this is purely scientific, at least evaluations on that
regard give us some level of subjective information.
The ognl 2.7 and javassist jar are available via the tapestry-4.2-libs
for my sake, i hope it's still 1.5.
i'm not allowed to go near 1.6 because of some obscure bug in some oracle
driver somewhere.
Ted Husted wrote:
Are we targeting 1.6 now, or is the S2 target platform still 1.5?
-T.
On 7/12/07, James Holmes [EMAIL PROTECTED] wrote:
Perfect! This is
It's relatively easy.
You want the WTP ( unless you're using some customized version like
MyEclipse, at which point, I can't help ).
a) Create a Dynamic Web Project.
b) Set up your Server Runtime (1) (2)
c) Drop your jars into WebResources/WEB-INF/lib (3)(4)
4) write up your struts.xml :
I've found that static html pages are blazing fast, especially those that
don't involve stylesheets, images, or javascript includes. :-)
Seriously, though, I don't think there's any disagreement that ognl ( or any
runtime expression language ) adds a certain amount of overhead, but I've
never
I think you may be confusing Struts2 (S2) interceptors with Spring
Interceptors.
The two are not the same.
S2 interceptors provide some aop-like functionality by allowing code to
modify request processing in some fashion; however it's not truly based
around an aop standard ( i.e. aopallliance )
the easiest solution would be to s:set the property name you want to
reference with a different name
s:set value=myprop name=mynewname/
and then access it in your loop under the new name.
s:iterator ...
s:property value=#mynewname/
/s:iterator
stanlick wrote:
There is no searching up
transaction boundaries.
Ask away if you have particular questions :-)
hth,
-a
panpan wrote:
Thank you cilquirm. I think i'm a little bit confused and the filter is
the one I needed.
There is one thing which is unclear to me. If I only apply the filter to
the new developed struts2 action
Pratt wrote:
Seems like you should be able to say
s:property value=#action.myattr/
But since there's no getAction in the ActionContext, I doubt that will
work. Maybe it should be added?
(*Chris*)
On 7/9/07, cilquirm [EMAIL PROTECTED] wrote:
the easiest solution would be to s:set
panpan wrote:
The session is open, why do I need to reattach them?
You wouldn't need to if you loaded and discarded your objects in a single
request, but let's say you have objects that lived around longer than a
single request ( i.e., a User object in your http session ). You might
The session object is wrapped by a SessionMap, so every time you do a put or
remove, the appropriate underlying method on the session is called.
So, in a nutshell, no, nothing to worry about.
Like most of struts2, it just works :-)
-a
Hoying, Ken-2 wrote:
I am currently utilizing the
You should be able to do
s:set name=successMessage value=null scope=session/
or (I'm assuming you have access to the jstl) , you can always do
c:remove var=successMessage scope=session/
hth,
-a
meeboo wrote:
Hey all
How can I achieve something like this:
Do you have struts.devMode = true?
I had the same problem and I was forced to change struts.devMode = false
I believe this is a change from 2.0.6 ( and in some regards, a worse one at
that ).
I'm still investigating it, but please try turning devMode off and seeing if
it helps.
Scott
I should correct myself. My problem may not be related, since it was due to
the CookieInterceptor's handling of setValue.
Can you post your pojo and your query string?
cilquirm wrote:
Do you have struts.devMode = true?
I had the same problem and I was forced to change struts.devMode
This is most probably not related to Struts.
I can't claim to know the intrinsics of your setup but it looks like you're
missing some jars need for JSF.
It might be that you're running an older version of the J2EE stack.
javax.el.ExpressionFactory comes with J2EE 5, and is part of JSF 1.2
guys on this forum.
The thing is that I am not using intentionally the JSF framewrok. I just
added an interceptor to the application. What is the problem here ?
cilquirm wrote:
This is most probably not related to Struts.
I can't claim to know the intrinsics of your setup but it looks
Just FYI, Nabble does provide RSS feeds on a per-list/forum level.
I Live-bookmark http://www.nabble.com/Struts---User-f206.html
Frank W. Zammetti wrote:
I think the thought behind not splitting the lists to this point is that
Apache experience has been that it tends to divide a
I don't believe this can be cleanly handled with just the web 2.4 spec and
struts2.
Some container, like Resin, allow for url-patterns to be regexes, which
would help in this scenario.
meeboo wrote:
The problem is that I have a lot of URL:s which look like /user/username,
movie/movieTitle
Try declaring a boolean setter in your Action with the checkbox name.
i.e.
setCheckboxName( boolean val ) { this.checkboxName = val ; }
and using that instead.
I'm not sure why you're trying to get the value from the
ActionContext.getParameters(). That will return the raw, globbed values
it is possible, if you extend and modify whatever theme you're using.
Then you can put that code wherever you want it to show up right inside the
freemarker template that renders it.
http://struts.apache.org/2.x/docs/extending-themes.html
hth,
-a
Skip Hollowell wrote:
Trying again, due to
/design.css; - good enough for me at the
moment.
cilquirm wrote:
I don't believe this can be cleanly handled with just the web 2.4 spec
and struts2.
Some container, like Resin, allow for url-patterns to be regexes, which
would help in this scenario.
meeboo wrote:
The problem
Struts 2 tags support pretty much all the attributes that their html
counterparts do.
I haven't used NewCal ( seen it, but not used it )
but you can try something like this :
s:textfield id=myfield key=p.datePaid/
javascript:NewCal('myfield','ddmmm',true,24) images/cal.gif
Skip
You actually can do that with the default mapper, using wildcarding.
Here's an example of what we do :
action name=view/*
class=com.thestreet.cms.web.actions.story.ViewAction
param name=id{1}/param
/action
The only trick is that you have to remember to suffix your url appropriately
You actually can do that with the default mapper, using wildcarding.
Here's an example of what we do :
action name=view/*
class=com.thestreet.cms.web.actions.story.ViewAction
param name=id{1}/param
/action
The only trick is that you have to remember to suffix your url appropriately
You actually can do that with the default mapper, using wildcarding.
Here's an example of what we do :
action name=view/*
class=com.thestreet.cms.web.actions.story.ViewAction
param name=id{1}/param
/action
The only trick is that you have to remember to suffix your url appropriately
The second way, %{test['AnyString'].att} or even, explicitly,
%{test['AnyString'].getAtt()} should both work.
I know it might sound dumb, but is there a value to att? ( using that class
as an example, there's no way to set it :-)
-a
Felipe Rodrigues wrote:
Hi guys,
I have this case
Hi,
Does
s:iterator value=#request['email'] id=email
...
/s:iterator
not work for you?
Will Berger wrote:
How does one in struts 2 process a list of req parameters using ognl?
In jsp, this gets the job done.
%
String emailList[] = request.getParameterValues(email));
Dave Newton-4 wrote:
Spend the $50; good grief.
Having been down this road, I would venture with the Don't bother. side
of the argument
In my opinion, while the price is fantastic, you're generally stuck with
versions that lag behind their completely free implementations ( i.e. the
I think the answer is a 2 part solution, but you're on the right track.
1) Create the interceptor that returns Action.LOGIN ( or whatever it is when
the user isn't authenticated ).
2) set up your login page in your global results type. See this page for
more information :
There are a number of tools in the Eclipse space that can do this ( i.e.
they run as Eclipse plugins/features and using the underlying GEF framework
).
One that I can think of off the top of my head is StrutsIDE :
http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=StrutsIDE
Exadel
Create a setter with the same name as your param.
ex :
for :
action name=blah class=MyAction
param name=myValueThis value/param
/action
in MyAction :
public class MyAction implements Action {
private String myValue;
public void setMyValue( String value) { this.myValue = value; }
}
If your actions occur in sequence, (
i.e. submit to an action - display action
),
it's possible to use action chaining to share objects.
http://struts.apache.org/2.x/docs/action-chaining.html
Roger Varley wrote:
Hi
I need to share an object between two actions. As I'm familiar
I don't know if this helps, but when I validate a list or array , i use
OGNL's selection/projection facility :
i.e. :
customers.{ ? #this.age gt 0 and #this.username neq null }.size() eq
customers.size
creates a list of all customers whose age is greater than zero and who have
a username
why can't you add parameters in chain?
In your action, can't you :
1) implement ParameterAware
2) set a parameter value in the map that's passed in
3) chain to your action
4) have the value be set in your chained action, via the params interceptor
-a
Laurie Harper wrote:
Mike
I do.
It looks vicious, but is pretty harmless.
You could wipe it out of your logs by setting the class that throws it to
only log ERROR and greater.
Piero Sartini-3 wrote:
Am Dienstag, 27. Februar 2007 schrieb cilquirm:
I see errors like that on occasion ( mine is with the JSONResult type
I do it like so :
Map contextMap = ActionContext.getContext().getContextMap();
ApplicationContext applicationContext = (ApplicationContext) ((Map)
contextMap
That example is using the null property handling feature of the XW
type-conversion system :
http://struts.apache.org/2.x/docs/type-conversion.html
Basically, when xw/ognl sees ( evaluates ) person.firstName, it calls
getPerson() , which returns null.
XW goes to work and creates an empty
Technically, this isn't necessary when you have the struts-spring-plugin.jar
in your WEB-INF/lib
since it's already specified by the struts-plugin.xml file
I think, however, seeing a more complete stack trace for the CNFE would be
helpful since I have 2.0.6 with the spring plugin just fine.
I see errors like that on occasion ( mine is with the JSONResult type and the
location property ), but they've always been warnings.
Is yours logged at the ERROR level?
Piero Sartini-3 wrote:
upgraded to 2.0.6 - now the error below is thrown when accessing an Action
with validators.
much what I've send you.
On 2/27/07, cilquirm [EMAIL PROTECTED] wrote:
Technically, this isn't necessary when you have the
struts-spring-plugin.jar
in your WEB-INF/lib
since it's already specified by the struts-plugin.xml file
I think, however, seeing a more complete stack trace
in your resulting page
you can set
@page contentType = 'application/x-java-jnlp-file'
and return the body of your jnlp file ( possibly even read via c:import or
some such mechanism )
Maya menon wrote:
Have anyone used java web start[JNLP files] with struts ?
I have a project
This is so odd, yet I'm surprised no one's come across this.
This is S2 built off the 2_0_X branch ( no modifications, straight clean
build ), running under Java 1.5 in both resin and tomcat.
Given a snippet like so :
s:action name=listAllAuthors namespace=/general
id=authorsAction/s:action
I believe you can use validation annotation to specify validation routines at
the method level.
ros wrote:
Hi!
How to configure struts2 validation for only one method in action?
Thanks.
--
View this message in context:
The error seems self-explanatory.
By specifying the queryReportBeanName inside the result/ tag, you're
actually setting the value on the redirect-action object ( known also by
it's java name org.apache.struts2.dispatcher.ServletActionRedirectResult ).
if you want to set a static param on your
not used 'redirect-action' with extra parameters like below, but I have
done so using 'redirect' ( and the former is extended from the latter ) with
success.
-a
Dave Newton-4 wrote:
--- cilquirm [EMAIL PROTECTED] wrote:
By specifying the queryReportBeanName inside the
result/ tag, you're actually
From my experience, it is possible to run Struts1 and Struts2 side by side
As far as I've seen and worked with, other than keeping the org.apache
start of the package name, the namespaces and class names are different.
Bruno Melloni-2 wrote:
Are all the package.class names different
your persistence.xml must be in META-INF directory in the classpath ( so
basically, it needs to end up either in your jars in WEB-INF/lib or in your
WEB-INF/classes directory )
shahab wrote:
Hi:
I have persistence.xml under META-INF
(both WEB-INF and META-INF are under
Just FYI,
I think this lesson was less about OGNL per se, and more about
Java,Servlets, and the Parameter map.
#parameters.addrType is of type String[], because that's how it's collated
( since you can have multiple values to a single name.. )
hth,
-a
Wesley Wannemacher wrote:
Okay, I'm
I don't think this will work as you expect it to for 2 reasons :
1) prepare comes before validate ( at least in all the interceptor stacks
that i saw, obviously you're free to change the order )
2) validation, at least in my perusal of the source, doesn't short circuit
the interceptor stack
Hi, I think I noticed an NPE in Restful2, which is set as my default action
mapper. I'd like to resolve it but I'm not sure my logic on the matter is
correct and hopefully someone on the list can set me straight :
The error :
java.lang.NullPointerException
I don't know particularly about the s:iterator, but since you said you're
using JSP, you can access the model via the jstl tags just as easily :
c:forEach items=${listOfBooks} var=book
${book.author}
/c:forEach
though, looking at your code again, I suspect it's because your getter is
class
scratch my original comment ( though the part regarding using the jstl is
still valid. )
the problem for you is that since listOfBooks is not in the valuestack
directly, you would have to reference it via the request object, like so
s:iterator value=%{#request.listOfBooks}
...
walidito
I've created
https://issues.apache.org/struts/browse/WW-1648
and attached a patch.
cilquirm wrote:
Hi, I think I noticed an NPE in Restful2, which is set as my default
action mapper. I'd like to resolve it but I'm not sure my logic on the
matter is correct and hopefully someone
Dariusz Wojtas wrote:
Want to have a bean separate from the action and just reference it?
Define your bean (whatever you want) and just declare it as a variable
on your action.
Nothing more.
Add getter and setter.
class MyAction ... {
private MyBeanClass myBean;
}
in your
According to http://struts.apache.org/2.x/docs/validation-annotation.html
you can specify annotations at the method level.
André Faria-3 wrote:
Hi People!!!
Is there a way to use Validation Annotations only for a method or always
for the action...
Example, if I have a action
86 matches
Mail list logo