I recently posted a question here regarding using tags that refer to a List
or an array structure in the action class, such as is depicted below.
I was told that I should be using indexed tags. Googling for that
specific phrase is not providing me with what that is and no joy in finding
it in the
My questions are: Is there a better place to discuss this? Could this ever
be enhanced?
The issue:
I'd love to see more consistency in the way we must access indexed values
when iterating. Consider the example below and note that there are 3
distinct ways in which I must access the index value. I
...@gmail.com 6/27/2013 5:19 PM
On Thu, Jun 27, 2013 at 4:38 PM, Eric Lentz ericle...@outfastsource.com
wrote:
s:textfield name=foos[%{#stat.index}].aString
value=%{foos[#stat.index].aString} /
Here you're doing to explicitly different things:
1. Provide a name (a string
Requirement 4 seems a little (unnecessarily?) restrictive. You obviously
need to store the information somewhere. Why not the session?
If not in the session or a cache, then the database would be the next
likely candidate, in my opinion. You'll have to manage it by clearing
information after you
I'm approving of Struts 2 and encourage its use, but I have 1 main
complaint: OGNL. Here's an example.
Context:
s:iterator var=reviewer // value is a List of a domain object
#reviewer.reviewerStatus // equals R
s:set var=isAdmin value=true /
When I do this:
s:if
Got it!
s:if test='#reviewer.reviewerStatus == R #isAdmin'
Just needed the # on isAdmin. Sigh.
On Tue, Feb 26, 2013 at 10:36 AM, Eric Lentz ericle...@outfastsource.comwrote:
I'm approving of Struts 2 and encourage its use, but I have 1 main
complaint: OGNL. Here's an example.
Context
You can specify an interceptor-ref per action. Your file upload could point
to a different interceptor stack.
If interceptor is the only option can anyone tell which will be the safest
way to achieve this without disturbing other struts default filter like
fileUpload.
It appears that the relevant portion of your code example is this:
li id=user-s:property value=#user.id/-${id}
#user.id gives you the id, right? Do you want it twice?
You also have s:iterator value=#request.users var=user
Did you put request into the context? The typical pattern would be to
I have
ListBaseObject foo
The list is of type BaseObjectImpl
BaseObject has fields:
String a
String b
BaseObjectImpl has fields:
String c
String d
Now I'm in a JSP and want to iterate foo (using s:iterator), accessing
fields c and d (inside iterator using s:property, for example). How? As
far
)
at ognl.ASTProperty.getValueBody(ASTProperty.java:118)
...etc.
Any ideas on solving that?
- Eric
On Mon, Dec 3, 2012 at 11:19 AM, Eric Lentz ericle...@outfastsource.comwrote:
I have
ListBaseObject foo
The list is of type BaseObjectImpl
BaseObject has fields:
String a
String b
BaseObjectImpl has fields
Inside of an interceptor, I'd like to add a value onto the the ValueStack.
What is the best way to do this?
I tried this:
invocation.getStack().set(myValueStackName, theValueIwantForThisName);
But that pushes that value to the top of the stack, pushing my action class
down which becomes
Maurizio, tried your way and no joy. Looks like I'll go with Łukasz' way.
Thanks everyone for your consideration and help!
On Fri, Nov 30, 2012 at 1:31 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:
2012/11/30 Eric Lentz ericle...@outfastsource.com:
Inside of an interceptor, I'd like to add
as
context, not stack variables. So instead of using %{myvar} you have to use
%{#myvar).
(*Chris*)
On Fri, Nov 30, 2012 at 10:42 AM, Eric Lentz ericle...@outfastsource.com
wrote:
Maurizio, tried your way and no joy. Looks like I'll go with Łukasz' way.
Thanks everyone for your
This was recently discussed. You may want to review that thread [1] and
then post any follow-up questions you may have.
[1] http://markmail.org/thread/znyl2ervtnlbb5tn
Did you turn on logging? What is the caught exception?
On Wed, Mar 28, 2012 at 11:01 AM, Rout, Biswajit biswajit.r...@hp.comwrote:
Hi,
I am running Struts 2.3.1.2 and Spring 3.1.1 integration in wls 10.3.4
server. However the validation framework is not working.
Please find the log and the
Looks like it will! How did I manage to miss that? It was right there on
the same page I referred to! Thanks Paweł!
On Fri, Mar 23, 2012 at 4:20 PM, Paweł Wielgus poulw...@gmail.com wrote:
Hi Eric,
maybe this will help:
default-action-ref name=cover/default-action-ref
Best regards,
Anyone know of a way, in Struts 2, to assign an action that matches on
anything in the URL, including slashes? This would be a catch-all, if no
other action specification is more specific.
I configured:
constant name=struts.enable.SlashesInActionNames value=true /
constant
Would it be this forum or somewhere else that I would suggest an upgrade to
which version of XStream Struts 2 uses? I recently started using it for
development not related to Struts 2, and found that the version being used
is 1.2.2, which was released in May of 2007 [1][2]. I upgraded to 1.4.2,
As i have read, struts only works with autowired context, dont know why
but it's ok.
I'm not able to take time to read and understand your whole question, but
this premise, upon which your question appears to be built, is incorrect.
I use Spring and Struts 2 together, all of the time, and I
Has anyone developed Wizard in Struts 2 without using Spring webflow
plugin.
I have done it with and without jQuery, but find that the jQuery form
wizard plug-in [1] is by far the easiest. In short, you create a div each
to represent each step and add class=step to the div, and you're pretty
Not setting the Content-disposition is header, makes the firefox to
prompt for the download but it uses the action for filename ie
Ticket.action. Has anyone faced a similar issue or can provide a hint on
how to fix the issue
Yep, saw this problem just this week.
I ran the request through
I was working with no issue until a month ago for over a year and
suddenly it has stopped working
I get that. Best thing to do would be to view the headers from a client
that can do so. There are plug-ins in Firefox that will allow that I
believe. I think you'll find that something is amiss
When you use a value from the set tag you'll need to prefix with the '#'
as per the documentation [1]
I've definitely used equals in the past and know it works (although not in
the property tag like you are, but should be the same as in s:if; OGNL
either way)
Something like this might work:
abstract the data call and its source
Not a Struts question, but an easy answer, so here you go:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
Use a Data Access Object (DAO) to abstract and encapsulate all access to
the data source. The DAO manages the
How about an object factory?
Interface - UserAuth
Implementation - LdapAuth implements UserAuth
Implementation - SqlAuth implements UserAuth
Factory (pseudo code):
if(ldap) {
return(new LdapAuth);
}
else if(sql) {
reutrn(new SqlAuth);
}
etc.
More pseudo code (this is inside your
1) Is it technically possible?
Yes
2) If yes, what are the changes needs to be done for this regard?
Add the Struts 2 jars and add a filter to web.xml for .action like you
would do for a stand-alone Struts 2 web app.
3) Is there any documentation available explaining such implementation
or
Make sure that devMode is false. The behavior is a bit different if in
devMode.
1) Why do not struts passes exception to container by default? Could I
configure it to do so?
I don't have time to answer all of your questions well, but you may want
to look here:
http://struts.apache.org/2.2.1/docs/httpheader-result.html
That result type will permit the sending of any code
Is there any other alternative way for this
Break the message up?
If your message is My device color is div style=font-weight:
boldRED/div. then write something like this:
s:text name=device.preamblenbsp;div style=font-weight: bold
s:text name=device.red/div.
where your properties file
any current framework can easily handle such a request
I agree. Maybe it would be helpful for the OP to let us in on what other
framework is being considered by way of comparison so the OP can tap into
the wealth of knowledge on this forum for real arguments to take back to
the opposition.
Could you form your e-mail into a question? What are you trying to
accomplish? Do you want the user to be able to download two documents at
the same time? Do you want links to the documents? What didn't work?
From:
Nick Broadhurst hou1...@gmail.com
To:
Struts Users Mailing List
I have following code with drop-list name agencyName. But
event.change() attached to this object never called.
Make sure that the rendered form is actually creating a HTML object with
an ID of agencyName. That's usually the problem that I encounter - using
the wrong name. Also, make sure that
There is no error at console but can run the script in console itself.
Any suggestion?
Are you saying that you can verify that the script is executing? For
example, if you alert, breakpoint or print to console before the
installation of the change event, do you get the expected feedback from
Yes script runs fine.
I would suggest making it as simple as possible. For example, take your
rendered form and make a html file out it and take your script and the
jQuery framework and place them all on a file system and attempt to get
that working (comment the ajax part out). If that works,
In an interceptor I have a need to store a value in the session. I can see
a session map that I find in the invocation's object graph that is
available in the interceptor, but storing back to the map has no effect.
Is there a Struts 2 way to get/set the session within an interceptor or
do I
I'm using the wildcard method in my configuration
action name=foo-* class=FooAction method={1}
result name=successpages/foo.jsp/result ...
and I want validation to fire only upon the call to the method that
performs the save/update. No problem with the XML file as the name takes
care
I'm not sure it's exactly what you're looking for, but IIRC there should
be
a convention for the validate method, such that you can call, for
example, a
method validateSave, expecting that it's fired contextually with the
save
action
Maurizio Cucchiara
Oh yeah! I remember coming across
Exploded war on JBoss. The xml file is edited directly and the changes
are not picked up.Do you have to redeploy each time for the changes
to
be picked up?
I'm on JBoss 5 and I have to redeploy as well for struts.xml changes to be
picked up (and class changes too - yuck!)
all samples of the displaytag library that I have come across ,
involve storing the entire resultset from the query in the session
Really? I use displaytag all the time through the equivalent of request
scope. Just pass it a list in the same way you would use a Struts2 select
list
I'm using Struts 2.2.1.
I have a use case whereby form fields are generated dynamically and some
of them are select lists. Since it is a database driven list of fields,
the labels presented for the user are also used as keys for the map that
the form posts back to. Using alternate keys is not
My first guess would be that OGNL is trying to evaluate it, although
since it's a string, not sure that makes any sense.
I don't know how your DB is laid out or how what sounds like ad-hoc
structures are being created, but is a text ID really the only thing
you have available?
Dave
Do we call this a bug?
Probably, but I don't if it's an S2 or OGNL issue.
Dave
com.opensymphony.xwork2.interceptor.ParametersInterceptor
private String acceptedParamNames = [a-zA-Z0-9\\.\\]\\[\\(\\)_'\\s]+;
private Pattern acceptedPattern = Pattern.compile(acceptedParamNames);
...
Do we call this a bug?
Probably, but I don't if it's an S2 or OGNL issue.
Dave
Per my previous post, it appears to be coming from the
com.opensymphony.xwork2 package. This is supported through Apache now? Do
we post this to S2's JIRA?
Oh, can't you just set the parameter then?
Dave
Um, I don't know. What do you mean? I thought that's what I did when I
specified name='foo[Interior/Exterior]'
Um, I don't know. What do you mean? I thought that's what I did when I
specified name='foo[Interior/Exterior]'
interceptor-ref name=params/
param name=paramNames../param
/interceptor-ref
Regards
--
Łukasz
Do you mean acceptedParamNames? (
IMO coupling field labels to semantic constructs is a Bad Idea
You make good points as usual. This particular app. is poised to become
international, so perhaps a different approach has come of age? I'm forced
in that direction anyway. As with most companies I've worked at (I'm
contracting
Dave's probably right about a missing abstraction.
Dave does tend to be right, but here's another idea entirely. Accept the
deployment of the whole application and configure the application as a
cluster, if possible. The cluster could even be on the same machine, so
you don't necessarily need
That's a JSP question, not Struts. Did you try Google?
http://lmgtfy.com/?q=turn+off+form+autocomplete
More over in my jsp i m not seeing autocomplete off attribute even
when i use normal html input type/ tag.
Everyone is telling you that it is a browser render / HTML tag issue.
Logically, it would seem that way as well. The browser is storing the text
that people type in the field, no? Do you
Are you currently using struts2? If so then open ur jsp and type
attribute autocomplete in textfield or form element and see if it
supports or not.
Yes, I am using Struts 2. I did as you instructed. I do not see anything
related to autocomplete. I'm not sure what you were aiming for in asking
1) Can we test it with a struts integration test?
2) How can we mock the time span (ie, we obviously don't want to wait 5
minutes for the test to finish...).
Are you testing what happens when a session is no longer a session?
Invalidate the session in your test:
*Background:
In a different thread, the following was discussed:
On Thu, May 19, 2011 at 2:22 PM, Eric Lentz wrote:
I'm curious. If you are using ModelDriven, then why do you load your
model
in prepare()? Why not in getModel?
That'd mean you'd need the did I already load the model? code
Getting is not always the same thing as instantiating and/Or
initializing.
That's an *excellent* point! Well said. It would be great, IMO, to call
that out in the documentation and expand on what that means. What's the
process for doing that?
So when this error condition is met and the user redirected back to the
INPUT form; the
field where they had entered xyz is now the original default
initialized value.
Can't you check the action error and not refresh the model when there is
an error?
happened; the model has already been prepared by the prepare() method.
-Original Message-
From: Eric Lentz [mailto:eric.le...@sherwin.com]
Sent: Thursday, May 19, 2011 11:58 AM
To: Struts Users Mailing List
Subject: Re: Struts2 Validation w/ModelDriven
So when this error condition
How can i resolve this problem.
It isn't a problem. Its part of the URI standard:
http://tools.ietf.org/html/rfc3986#section-2.2
# = Hexadecimal 23 in the ascii chart.
topicId%23191 is fine because it is equal to topicId#191
It will be correctly decoded when sent to the server.
I'll take any suggestions to get this working.
Your code snippet lacks important details that would help me answer your
question. Use pastebin or a like service and include a minimal running
example and then perhaps I can help.
The problem is getting from startInformation.jsp begin button to
questions with the formid.
When you hit begin from startInformation.jsp, you are submitting a form to
beginQuestions which is acting on actions.survey.Listing.
startInformation.jsp has a hidden field of form_id:
input
I have one display-tag in my jsp page. I got the contents of the
display tag through ajax response.
I need to set the display tag from that response using jquery. Please
any
one help me in this.
That's not a Struts question.
Ask your question on stackoverflow.com with a jquery and
By clicking the link will display respective page that was developed
with JSF Facelets technology.
I am facing problem in integrating struts with JSF.
Could anyone let me know step by step procedure for integrating Struts
1.1
with JSF 2.0?
You don't say what your problem is.
As far as
String[] names;
// OR
ArrayList names;
}
i want to validate RequiredStringValidator validator on these names.
I don't think the standard validations deal with arrays. Probably your
best bet is to override validate() and validate on your own. See:
I don't use ModelDriven myself, but as I understand it, it places the
Model
Object at the top of the Value Stack, which would make userid be a
reference
to an attribute in the Model Object, not in the Action. When you use
user.userid, it's because it's trying to find the user attribute in
- Struts instantiates the User object (in my case) by default.
- ModelDriven places the object I choose at the top of the stack.
- Because my object is at the top of the stack, it gets selected instead
of the object that Struts creates by default.
I think I answered my own questions here
My solution looks like this:
public Foo getModel() {
foo = (Foo) session.get(Foo);
if (foo == null) {
foo = new Foo();
session.put(Foo, foo);
}
return (foo);
}
Then,
- Struts 2.2.1
- Tomcat 6.0
- JDK 1.5.0_22
- Code example of the problem: http://pastebin.com/eyyJaBg4
- Description:
I have two fields in my action class: user and userId. The user variable
is of type User, which also contains a userId. In both cases userId is of
type String.
While
I am asking because it seems that validation is only allowed for one
set of properties. This indicates I should create two actions
Validation can go down to the method level and you can validate what you
desire for that method call. Just name the .xml file (if using that
approach) with the
I'm working on a legacy system that is built on jsp. In one of the jsps
I need to include a velocity template. The template does not require
access to any dynamic data.
Struts lets you use Velocity instead of JSPs as an option. Using JSPs
*and* Velocity isn't an out-of-the-box type of
Before the email requirement, the information was stored in a jsp and
included where necessary using tiles. The complexity of compiling a jsp
and returning the resulting html is simply an inadequate solution.
I would explore using Velocity. Struts will display a Velocity page or you
can shove
@Dave
The page displays the list--how could you not need it?
Right, during display I need it. During *SAVE* I do not need it. During
the save is when Struts is demanding it (incorrectly I feel).
@stanlick
Do you by chance need a @SkipValidation on a method(s) in your action?
How have you
If there's a validation error, the input page will be displayed.
If the input page is being displayed, the JSP references the list.
If the JSP references the list, it's needed.
If the JSP page isn't being displayed, you cannot get the error
message your getting.
I totally agree with your
It's not going to execute the JSP unless there's a reason to.
Something's sending it back to the JSP. Rendering the JSP is the last
thing it does during action execution, after type conversion, after
validation. It's not going to execute the JSP that requires the list
unless there's an execution
Create and post an SSCCE demonstrating the perceived issue, here or
preferably on a pastebin-like service.
I assume an SSCCE is a JIRA report for Struts2? I started one but am
waiting to hit submit in case you have something else in mind.
Is this what you have in mind for pasttebin:
And I assume the zipcode thing is just for test
purposes, since zipcodes aren't numeric
This is someone's code I downloaded from the Internet for play. The real
application is not a SSCCE, but exhibits the same symptoms.
I'm now buying what you're selling. I did have a misunderstanding about
when the JSP is called relative to validation. I once was blind, but now I
see. Thanks for clearing that up. I now see how to make the application
work correctly.
BTW, I do know about redirectAction, and use it normally. I
prepare method is set to execute BEFORE the params from your form are
read and processed into your action class
So prepare() is my *dumb* friend. Thanks for the tip!
Struts 2.2.1
I have a page with a list:
s:select name=user.gender headerKey= headerValue=Select
Gender
listKey=code listValue=description list=genderList
/
and I populate genderList when I display the page.
If I add a validation file, validating anything, not even
I second Chris's suggestion to initialize the list when you need it.
Cool getting feedback from you guys.
I'm not sure if you meant it this way, but my point is that I don't *need*
the list - or at least I shouldn't need it IMO.
As a user, I hit the submit button on a form that has a select
since I don't use that XML Validation stuff.
What do you use?
I'd look for class loading issues. Maybe you have a couple jars with
quartz? Maybe an incompatible version combination?
org.springframework.beans.factory.CannotLoadBeanClassException:
Error loading class
[org.springframework.scheduling.quartz.JobDetailBean]
nested exception is
79 matches
Mail list logo