without the
use of JavaScript?
On Sun, Mar 1, 2009 at 8:52 AM, Dave Newton newton.d...@yahoo.com wrote:
Zarar Siddiqi wrote:
s:submit/ submits a s:form/. If you want your two submit buttons
to call two different actions, you'll need two different forms.
s:submit can submit to different actions
s:submit/ submits a s:form/. If you want your two submit buttons
to call two different actions, you'll need two different forms.
If you can't do that then you could have an onclick handler for both
the submit buttons and depending on which one the user clicks, you can
change the action value of
If your actions are extending ActionSupport than you can go like so:
public String intercept(ActionInvocation invocation) throws Exception {
String message = ((ActionSupport)
invocation.getAction()).getText(resource.key)
...
}
Zarar
On Thu, Feb 26, 2009 at 12:23 PM, Security
I can't believe I haven't run into this issue before but I just noticed that
you can't use JSP 2.0 syntax inside a Sitemesh decorator.
My Sitemesh config is exactly like as described here:
http://struts.apache.org/2.x/docs/sitemesh-plugin.html
The only difference is that I'm using PageFilter
Well, you could just use the pageContext variable to get the query string
like so:
${pageContext.request.queryString}
Zarar
strutstwouser wrote:
Hi,
I need to access certain url parameters and pass them on as the query
string
to an iframe within the jsp
So, if the incoming url is
A much easier way to do this would be to apply a CSS style like this:
div.wwgrp br {
display: none;
}
See this old blog post:
http://arsenalist.com/2007/04/11/struts-2-form-control-templates/
On Dec 5, 2007 9:14 AM, Angel Gruev [EMAIL PROTECTED] wrote:
Thank you both for the quick
Make sure that you have a property called struts.custom.i18n.resources
defined in struts.properties which refers to the resource bundles that
you're using. For example:
struts.custom.i18n.resources=resource1,resource2
The above would look for resource bundles called resource1.properties
and
Problems that I see:
1. Spring bean is defined as helloWorld but referred to as
HelloWorld in Struts config (case is incorrect).
2. You're saying that your action class is under src/action so I would
think the fully qualified name of the class might be
action.HelloWorldAction but that's now how
Try putting the redirect=true on the global forward instead of the
action forward like this:
global-forwards
forward name=welcome path=/login.do redirect=true/
/global-forwards
action path=/login
type=com.cingular.cscape.cmps.struts.action.SignOnAction validate=false
forward name=success
Looks like you need a dose of ServletActionContext:
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/ServletActionContext.html
Zarar
On 10/11/07, Adam Hardy [EMAIL PROTECTED] wrote:
I'm writing a few static methods to use as taglib functions in my JSPs, in
particular
I thought you could only specify properties files for action beans,
not model ones. So in your case try specifying
PersonneFilterAction.properties
Zarar
On 10/8/07, pilou [EMAIL PROTECTED] wrote:
hi
I noticed that the property bundles named with the Model Bean class name
does not seem to
Well, a couple things pop into one's mind:
1. Why are you using the @SkipValidation on the execute() method, this
is telling Struts NOT to validate calls to this action.
2. Your action is called teste.do which is a little fishy because
usually the extension (.do) doesn't need to be specified in
I load it using the following:
#assign s=JspTaglibs[/struts-tags]
You'll also need to load the JspSupportServlet:
servlet
servlet-nameJspSupportServlet/servlet-name
servlet-classorg.apache.struts2.views.JspSupportServlet
/servlet-class
Yeah, you're going to have to load them every time. You could store
the collections in session or application scope if that's feasible but
other than that you don't really have a choice. Alternately, I think
the cleanest way of doing this might be to make an Ajax call to load
the third selection
I think the Zero Configuration idea is a nice idea but the
implementation is far from sufficient and will probably get better
over time (hopefully). The problem mainly is with the limit of
annotations. There are things that can be represented in struts.xml
that have no chance of being
Prototype/Scriptaculous for the Ajaxy features, I
don't see anything wrong with that. Besides, Prototype is
lightweight, easy-to-use, tested and has excellent documentation,
hence the suggestion.
Zarar
On 9/29/07, Oleg Mikheev [EMAIL PROTECTED] wrote:
Zarar Siddiqi wrote:
I really recommend using
If you're using Spring you could define your action bean as a
singleton and that would do the trick since the same instance would
always be reused. Note that this is pretty crazy in most cases,
you're probably better off storing our objects in session scope like
Chris suggested.
Zarar
On
It's been a while since I've used Struts 1.x but did you try using
c:set to set a variable and them dump it in cssStyle using ${}
syntax? If not that, you could always add the CSS class to the input
field using JavaScript.
Zarar
On 9/28/07, prem_gadgetquest [EMAIL PROTECTED] wrote:
I have
Am I crazy or is Jennie using Struts 1.x and Mark just proposed a
solution for 2.x?
Jennie, your web.xml servler-mapping is overriding each other, you're
first saying you want /*/*.jsp sent to action but then you're saying
you want *.do's sent to action? I'm not too sure if that's valid.
Have you
I really recommend using something like Prototype to do your Ajax
stuff. There's no need to reinvent the wheel and introduce countless
bugs in the process, Prototype is tested for all relevant browsers and
it'll take you 10 minutes to do what you're trying to do if you use
it:
Did you know you have all the variables declared in this class as
public static final at your disposal:
http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_0_9/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java?revision=558805view=markup
They include stackand ognl.
Zarar
I'm not sure what you want to do with the FreemarkerManager instance
but if you're looking to do things like build results
programmatically, my posting where I answered my own question on the
Freemarker User list might be helpful:
http://www.nabble.com/forum/ViewPost.jtp?post=12740736framed=y
If
Freemarker variables using
the $ or # syntax, you should probably do an if check like this:
# if myActionProperty.subProperty?exists
${myActionProperty.subProperty}
/#if
I know, it's a bit of a pain.
Zarar Siddiqi
On 9/6/07, Kenton [EMAIL PROTECTED] wrote:
I'm a newbie trying learn how to use
s:submit theme=simple value=%{getText('category.edit.cancelButton')}/
Zarar
On 9/6/07, Adam Hardy [EMAIL PROTECTED] wrote:
I am using struts tags for the first time in a JSP with S2 and I haven't found
what I'm looking for so I guess it's not available, but could I just check for
certain?
Try this guy:
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/ServletActionContext.html
stanlick wrote:
I have an action that determines the requester IP address. The action
implements ServletRequestAware, but I don't like it being all tangled up
in the Servlet
The struts.configuration.files property in struts.properties at the
root of your classpath can specify struts configuration files using a
comma separated list, by default this property is set to:
struts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
You can change it if you
in ActionProxy.
Now I can load the collections base on method and result type :)
Thanks for your help.
Regards,
Boon Leng
Zarar Siddiqi wrote:
You could implement Preparable and load countryOptions in the prepare()
method.
http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony
If you're using Spring, it's probably a great idea to use Acegi
Security to handle authentication/authorization. I can't think of
anything it can't do.
http://www.acegisecurity.org/
There's also Berkano which doesn't do nearly as much as Acegi but can
handle most general AA problems:
Struts isn't catching this exception because you're throwing it in a
JSP page which is being accessed outside the Struts servlet (directly
via a URL).
Try throwing the exception in a Struts action and see what happens.
But even if you do that you'll run into a problem with the current
setup.
Specify your validation rules in a file called
MyActionClass-myAction-validation.xml where MyActionClass is the
action class and myAction is the name of the action being executed.
So your struts.xml would look something like:
action name=myAction class=MyActionClass method=myMethod.../action
Why can't you access the HttpServletRequest object using
ServletActionContext.getRequest() and then just use the getParameter()
method to get the request parameters?
If you're getting a ClassCastException it's because you're casting
something that isn't a String to a String. Find out what the
Well, if your Action class implements TextProvider (as does
ActionSupport), then you can resolve keys any way you'd like. As for
plugging/altering the existing lookup that is used by ActionSupport,
it really isn't possible right now, and I've love to see a patch
making that more flexible...
The same way you would get a textfields. If your select box can allow
for multiple selections, declare a String[] array in your action class
and the selected values will map to it. Don't forget the getter and
setters.
Zarar
On 8/3/07, Session A Mwamufiya [EMAIL PROTECTED] wrote:
Hi again,
That magic starts happening in
http://struts.apache.org/2.0.8/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/ParametersInterceptor.html
ParametersInterceptor . Take a look at the javadocs and source to see how
its done. You could then extend the class or write a new interceptor which
This is more a displaytag question than a Struts one really but make sure
you have the IText jar in your classpath and that you've setup your
displaytag filter correctly (which should be the case since your other
exports are working)
Zarar
abhi_kaul wrote:
Hi!
I am using display table as
You might want to post your JSP code. But I thinks specifying the
'template' and 'theme' attributes of your JSP tag should do the trick. I
blogged about this a while back:
http://arsenalist.com/2007/04/11/struts-2-form-control-templates/
Also make sure that when you extract your
The only mysterious part here is figuring out why you would want to use ! in
your action name. The default behavior of Struts 2 is for the URL
http://localhost:8080/actionName!myMethod.action to actually execute
myMethod instead of execute() when the action is called so you don't need to
make
That'll work but if you want to use one line to get it, use this:
http://www.springframework.org/docs/api/org/springframework/web/context/support/WebApplicationContextUtils.html#getRequiredWebApplicationContext(javax.servlet.ServletContext)
If you're just trying to get the context path, you can just use
${pageContext.request.contextPath}. That way you can just write:
link rel=stylesheet type=text/css
href=${pageContext.request.contextPath}/css/myStyles.css /
If you're using Freemarker, its even easier, just use ${base} like this:
I've just added a few links to the Wiki that show how to deal with some
common issues when using Struts.
Unit Testing
http://arsenalist.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/
Validation
http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/
Zero
It sounds to me like your Action class might be configured as a singleton.
If that's the case the action class' constructor would only be called once
on startup. Make sure you have singleton=false in your Spring config for
the action class. The default value for singleton is true.
stanlick
Have you tried storing it in a variable using using c:set and having
escapeXml=false and then putting that variable inside the value attribute
of the html:text tag?
- Original Message -
From: lk [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Thursday, July 21, 2005 12:40 PM
The trouble is that you're not saying much.
- Original Message -
From: Mariano Petrakovsky [EMAIL PROTECTED]
To: Lista de correo de Struts user@struts.apache.org
Sent: Monday, July 11, 2005 2:26 PM
Subject: I can't initialize de Serlvet Action :(
Throw an exception ServletAction
I think the ideal that you're searching for is one class per view. Take a
look at JSF.
- Original Message -
From: Schaub, Stephen [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, July 11, 2005 3:56 PM
Subject: RE: Putting execute() in ActionForm
Wel, I catually have something like form.cards[0].cardNumber, but it is
also not an array. It is a collection.
Doesn't matter, it works for both as long as you got a getCardNumber() in
there.
Wendy Smoak wrote:
From: Mick Knutson [EMAIL PROTECTED]
I have a Collection in my ActionForm,
Sun's Creator Studio rulez the inexpensive Java IDE world; JetBrain's IDEA
rulez the $300+ IDEs. Eclipse isn't worth a shit.
But REAL programmers prefer ed or vi.
~mark
An old woodcutter once had to chop down a very large tree and all he owned
was a hacksaw. He was really really good at
Make sure params is of type java.util.Map.
- Original Message -
From: Laurie Harper [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Tuesday, June 21, 2005 12:48 PM
Subject: Re: How to pass Jstl param implicit Object to html:link
'params' is a JSTL implicit object; I don't think
Short answer: No. You can't use html:link/ and submit values entered in
input elements to your action without using Javascript.
As Wendy said, you can use a simple link and do this:
a href=# onClick=document.forms['myForm'].submit();/my link/a
If you're not getting user input and simply
You can use the fmt library. It adjusts to your locale.
jsp:useBean id=currDate class=java.util.Date/
fmt:formatDate value=${currDate} type=date dateStyle=full/
Zarar
On Tue, 21 Jun 2005, Arno Schatz wrote:
Hi,
How do I present a Date in the users locale in a JSP?
I tried
Link looks like:
html:link action=/whatever.do?action=Do Somethinghi/html:link
Make sure you have following in ApplicationResources.properties:
whatever.dispatch=Do Something
When you load the method Map, make sure something like this happens:
public Map getKeyMethodMap() {
// stuff
. SimpleDispatchAction indeed looks much simpler:
http://wiki.apache.org/struts/StrutsCatalogDispatchActionImproved
On 6/17/05, Zarar Siddiqi [EMAIL PROTECTED] wrote:
Link looks like:
html:link action=/whatever.do?action=Do Somethinghi/html:link
Make sure you have following
=${pageContext.request.contextPath}MyAction.do to achieve this.
Using html:link takes care of that.
Zarar Siddiqi
- Original Message -
From: Nitesh [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Cc: [EMAIL PROTECTED]
Sent: Thursday, June 16, 2005 1:20 AM
Subject: Re
Shot in the dark, try this:
html:radio idName='lista'
onclick='setBusquedaProveedor(${idProveedor},${strRazonSocial})'
property='idProveedor'
value='idProveedor' /
- Original Message -
From: Rafael Taboada [EMAIL PROTECTED]
To:
Where do you see the af.setURL(String) method in the ActionForward class?
http://struts.apache.org/api/org/apache/struts/action/ActionForward.html
I had a similar problem where dynamic values needed to be passed in via an
ActionForward but I wasn't able to find something as simple as you
54 matches
Mail list logo