[mailto:lukaszlen...@apache.org]
Sent: Tuesday, June 30, 2015 1:32 AM
To: Struts Users Mailing List
Subject: Re: Need documentation or code example for custom tag in Struts 2.3.24
2015-06-30 3:50 GMT+02:00 Lynn Li :
> I am upgrading Struts from 2.1.6 to 2.3.24. My application has a custom URL
> tag.
I am upgrading Struts from 2.1.6 to 2.3.24. My application has a custom URL
tag. I need help on refactoring custom URL tag code. Does anyone have
documentation or code example for custom tag in Struts 2.3.24? Thank you in
advance!
Nothing in this message is intended to constitute an electronic
I mean:
If the OS is unix/linux, you can create file link (or folder link) on
the file system.
This doc describes more details:
http://www.cyberciti.biz/faq/creating-hard-links-with-ln-command/
2011/12/13 Gurcharan Singh :
> Hi Li
>
> Sorry, not able to understand your point. Can y
What is your client side code (JSP)?
In OGNL expression, a value assignment is something like:
"aMap[aKey] = aValue"
So, you need create HTML code like:
On the server side, the OGNL expression will be converted into Java
method invoking like:
yourAction.getAMap().put("aKey", "aValue")
Unfortun
My suggestion:
You can create a file(or folder) link on your file system.
>From the view of your web app,
it works like a file(or folder) inside the [document root directory],
but the real file(or folder) is actually somewhere outside the
[document root directory].
2011/12/8 Gurcharan Singh :
>
In OGNL, the "==" test will call the equals method,
so, I believe the expression "#selectedOffer==#queryString" should work.
Read the following document:
http://commons.apache.org/ognl/language-guide.html
In the sector [Operators], there is a table describe all the operators.
If you think the tes
I did some search, found it here:
com.opensymphony.xwork2.conversion.impl.XWorkConverter.addConverterMapping(Map, Class)
And this converter is configured in [struts-default.xml]:
http://struts.apache.org/2.x/docs/struts-defaultxml.html
The following doc describe more details:
http://struts.apache
Yes, of course you are right.
But what you talking about sounds like to change S2 mechanism itself,
which we can not do.
As a S2 user but not a S2 developer, the simplest way is to write a
new validator..
Of course, If the [pre-condition based validation] is a common
request, I think it will
This doc explains it.
http://struts.apache.org/2.x/docs/interceptors.html#Interceptors-MethodFiltering
2011/11/29 Srineel Mazumdar :
> Hi,
>
> Please explain the meaning of the following :
>
> input,back,cancel,browse
>
-
To u
Changing the [validation interceptor] will switch on/off the all
validations by one pre-condition.
But what he need is:
if and only if pre-condition-A is true, run validation-A;
if and only if pre-condition-B is true, run validation-B;
etc...
So, I think the right way is, change the validators.
be,
adding some [pre-condition checking] into the Struts2 bundled
validators themselves.
But this is out of our control, hope the developers of Struts2 can here this.
2011/11/28 Jyothrilinga Rao :
> Thanks Li Ying,
> I got some information from
> http://today.java.net/pub/a/today/2006/01/19
If your validate rules are fixed, only some parameters (integer/date
format or something else) relies on the country setting, I suggest you
implement it by retrieve the params via OGNL expression.
The parameter for the Validators can be OGNL expression.
These docs may help:
http://struts.apache.or
u need upgrade to the latest version,
and see if the error happen.
2011/11/28 Li Ying :
> The error message is "optGroupInternalListUiBean.parameters is undefined"
> I had a quick look at the source of Struts2 and tag template,
> In [template/simple/optgroup.ftl]:
> line
The error message is "optGroupInternalListUiBean.parameters is undefined"
I had a quick look at the source of Struts2 and tag template,
In [template/simple/optgroup.ftl]:
line 23: <#if parameters.optGroupInternalListUiBeanList??>line 24:
<#assign optGroupInternalListUiBeans=parameters.optGroupInter
your actions, so you can
use it in all the actions.
2011/11/23 Felipe Issa :
> It's not a definitive solution, but it works. Thanks Li Ying!
>
> Em 21/11/2011 23:07, Li Ying escreveu:
>>
>> or you can do the null check in the jsp code, before you create the
>>
or you can do the null check in the jsp code, before you create the
param list for the format string.
Code like:
2011/11/22 Felipe Issa :
> Hi. I'm trying to internationalize my application, and for that i need to
> use the struts l10n. I have managed to parse the number according to the
> us
I have read the source of java.text.MessageFormat, looks like it
output a "null" text to the result String when the argument is null.
I think you can create a read-only property in your action (or your
data model class), and implement the null check and format process in
this property,
code like:
(1)I believe the word [template] in struts2 means,
the template file to render a struts2 tag.
for example, the file
[struts2-core-2.2.3.jar]/template/xhtml/form.ftl
is a template file to render the tag using theme "xhtml"
(2)what you are trying to do, is to change the jsp file location which
wi
Do you want to map your action to the following url?
namespace: common
action: homepage
But your package configuration is:
I think maybe this setting maps all the actions in this package to
namespace "/",
but not "common" as you want.
Read the following documents, may help:
http://struts.apach
This document may help:
http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-Actionannotation
2011/11/21 叶伟平 :
> Dear All,
> I have a action class which's namespace is "/"(Annotation), and, I
> want to use another namespace for a method within the class. How to do
> that?
>
>
I have 2 suggestion:
(A)Declare the input data field in your action as a String, instead of
date or integer.
So, the String field can hold anything input from client side.
But this will be inconvenience to use, because you have to convert the
string value
to the date or integer value by yourself,
Hi, Ilya:
> But struts-2 breaks this scheme.
>
> 1) it does not pass exception to container so container can't log it.
I used struts2 for several years.
In our projects, struts-2 does not break this schema.
I have read the source of struts2. When an exception is thrown from
action execution, str
Hi Miguel:
How did you generate the error message?
(A)Did you add the message key to the action errors, like:
this.addActionError("error.authorisation");
(B)or did you retrieve the message text by the key, then add the text
to the action errors, like:
this.addActionError(this.getText("
I think lazy initialization is a simple choice, because it is not
dependent on the J2EE container, this make your code easy to test.
If you worry about duplicated-initialization triggered by multi
request, the simple solution is, make your initialization code
[synchronized], using reserved word [s
I tried the JSP code which you posted. It works fine.
What is your [locale]? you said, you [select Arabic], do you mean
[locale] is [Arabic]?
What name is your property file, and what is the content in it?
-
To unsubscribe, e-m
JQuery UI can help you.
Here is the home page:
http://jqueryui.com/
Here is the tab ui demo:
http://jqueryui.com/demos/tabs/
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h..
Read the [ Unsubscribe ] section of this page:
http://struts.apache.org/mail.html
I believe you can do it by yourself.
2011/10/17 ashok ramasankar :
> Hi,
>
> Please unsubscribe my mail id from the user group - user@struts.apache.org
> Please do the needful.
>
> Thanks,
> Ashok
>
--
Did your problem happens when date input or output?
For output case, the tag can let you choose the format to use.
See:
http://struts.apache.org/2.x/docs/date.html
For input case, Struts2 can convert HTTP parameters from String into
most of data type you need, include Date.
But for Date, it [us
I think conversion and validation should not be turned off.
The [conversion] convert http parameters (which is String) to the real
data type so your action can accept.
The [validation] check the parameters if they a valid.
And also, normally, conversion and validation should not take too much ti
This page may help:
http://www.ontola.com/en/javascript-onclick-return-false-does-not-work-in-i
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
I took a quick look at Struts1 document.
Looks like the following information can help:
http://struts.apache.org/1.x/struts-taglib/tagreference.html#html:link
= START =
To specify a single parameter, use the paramId attribute to define the
name of the request parameter to be subm
I guess you can not do this.
Because there should be ONLY ONE HTTP response for every HTTP request.
So you can only return a file downlod or a redirect to the client, but not both.
If you want to jump to another page after file download,
may be you can try JavaScript solution in the client side.
You don't need an extra-filter.
The S2 default encoding is UTF-8.
The code of S2 filter is:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter:
public void doFilter(..) {
..
prepare.setEncodingAndLocale(request, response);
..
}
and the code of PrepareOperations
the problem is that you pushed a HashMap on the ValueStack's root.
if you do that, all the values will be populated to the HashMap, not
your action class
you can try this code to fix it.
ActionContext.getContext().put("browser", userSession.getBrowser());
(2011/02/04 17:12), Rubens Gomes
I think this is not a struts issue.
are you using tomcat as your server?
you can try to set URIEncoding of Connector to "utf-8" in server.xml
(2011/01/26 23:45), Rafael Karbowski wrote:
Hi @ all,
I have a problem with the encoding of German umlauts. In the getter of the
source action they a
That's just wired.
The first idea in my head was, may be there is lacks of brackets in
your expression.
But then I checked the document of OGNL:
http://www.opensymphony.com/ognl/html/LanguageGuide/apa.html
Accordinting to this document,
the operator [%] has higher precedence than operator [==].
You can use the tag, as Maurizio Cucchiara has told you.
http://struts.apache.org/2.2.1.1/docs/tabbedpanel.html
Or you can use JQuery UI.
Here are demos and docs:
http://jqueryui.com/demos/tabs/
-
To unsubscribe, e-mail: user-
May be something getting wrong in Eclipse IDE.
Try:
(1)Delete the whole project from Eclipse IDE.
But NOT delete the project content from the file system
(2)Import the project to Eclipse again
(3)Clean the project
And see if the error get cleared?
-
What HTML code does your tag render?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
can you show the generated html file?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
You can put the following debug code in your jsp:
It may help you find out what the result of expression is.
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apach
I read the source of [simple/text.ftl], and found nothing
looks like rendering the extra [class="inputError"] attribute.
Can you tell me where it is?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional com
I read the source code of [simple/css.ftl],
it looks like trying to combine [cssClass] and [cssErrorClass].
So you can try:
<@s.textfield name="port" value=port key="service.port" maxsize="5"
cssClass="prop-port"
cssErrorClass="inputError"
/>
see if the result is what you want?
I think the tag-lib [/struts-tags] is defined in
[struts2-core-2.2.1.jar/META-INF/struts-tags.tld].
Can you see this file in your Eclipse, under the [Web App Libraries]?
Or, can you see the [Web App Libraries] in the [Java Build Path =>
Libraries] of your web-app?
Or, you can [refresh] your whol
Read this doc:
http://struts.apache.org/2.2.1/docs/type-conversion.html
From
[# 3 Creating a Type Converter]
to
[# 6 Applying a Type Converter for an application]
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For a
Try:
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
I think you don't need this bothering job.
You can:
(1)Define some properties in your base class of all your action classes.
(2)Use these properties to capture data from the request.
(3)Run your interceptor AFTER the interceptors of struts2.
But BEFORE the execution of the Action class
So,
The i
It don't works, because the JSP local variable is not an OGNL local variable.
The JSP local variable will be translated into a local variable of the
Servlet code,
and it is a local variable of Java language, so you can not reference it in
the OGNL expression.
An OGNL local variable should be [put
>> Since after validation fails the iterator grid also empty
I think, you need separate the field names by list index -- since your
data model is a list--,
to indicate which [textfield] should be captured by which POJO element.
And also, you need separate the field name of validation error, t
I think Michal was right.
If you don't want execute validation for some Action Method, the
annotation "@SkipValidation" is a good solution.
And, in your case,
I noticed that, your server side action is doing nothing when the
[cancel] button clicked.
I suggest you can put a html Link for your [can
What is the data type of objectList?
How did you execute the validation, and how did you add the field error?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.o
Can you show us the entire Exception stack?
I guess, this may be a type conversion error.
According to this struts2 documents:
http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-BuiltinTypeConversionSupport
"XWork will automatically handle the most common type conversion for
y
Are the file size different?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
gt;
>> 1,convert the munber into string in the jsp/view page.
>> 2,write a JSTL to render that dataType by your self.
>>
>> Regards,
>> Mead
>>
>>
>> On Tue, Dec 7, 2010 at 10:25 AM, Yanto Bong wrote:
>>
>> > Hi Li,
>> >
>
BTW, according to the exception message:
The execute method of UserRegistrationAction IS CALLED,
but some code invoked by this method raised an exception.
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additiona
It looks like, the latest class files were not deployed to the WebApp Context.
Sometimes this happens.
When you find something getting wrong, and your source code looks like right,
Just try turn off the web app, and re-deployed your latest code again.
See if it the error get fixed.
Sometimes, th
Do you mean, when user click some bookmark, you want to check if this
bookmark belongs to this user?
Basically, you can not control bookmark, because it is a browser operation.
The only way i can tell is, to add a user id param to all your page url.
So, when userA saved a bookmark, and when it cl
what is your locale associated with the request?
if your locale's date format is defferent from "-MM-dd" ,
you have to customize the type conversion to make it work.
http://struts.apache.org/2.2.1/docs/type-conversion.html
-
This looks like the result of toString() of BigDecimal.
May be you can try this:
http://download.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html#toPlainString%28%29
2010/12/6 Yanto Bong :
> Hi All,
>
> We've using BigDecimal as datatype in hibernate and model for Numeric (20,8)
> da
It looks like so.
2010/12/3 maven apache :
> Thanks!
>
> So the way I use the interceptor is right?
>
> Nothing have to be changed except saving the session id intead of sessin it
> self?
>
-
To unsubscribe, e-mail: user-unsubscr
I read your code, and noticed one thing.
You saved the whole HttpSession instance in Map, this will waste memory.
The information you really need is just the SessionID, but not the
whole Session.
SessionID can be retrieved from HttpSession.getId();
See:
http://download.oracle.com/javaee/5/api/
The only data need to save is UserID and SessionID, I think it will
not over 100 bytes per user.
For 1000 user, the total memory will not over 10MB.
So, you don't have to worry about memory problem.
For the DB solution, if you worry about response speed.
You can change the solution:
Do not check
I built a web app in this summer, using the latest Struts2.2.1 and the
latest Spring3.x.
And there was nothing going wrong.
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@s
ActionContext is just a wrap class for convenience.
If you need the real HttpSession.
You should get the HttpRequest first, from ServletActionContext.getRequest().
See:
http://struts.apache.org/2.2.1/struts2-core/apidocs/org/apache/struts2/ServletActionContext.html
And then, you can get the Htt
The problem will be:
(1)How to save the information about who is logged in from which session.
and
(2)How to check this information before every action execution
For problem 1, if you only have one app server, you can save this
information in global variable, if you need support multi app serv
OR,
You can send a whole HTML code of the as response.
In this case, your server side view will be simple, just like any normal JSP.
The client side will receive the HTML code, and you can insert this
HTML piece into your page.
But it will be difficult to manipulate, because what you get is not
I recommend JSON when you need exchange complex data strut between
client and server.
Because it is very friendly to JavaScript, so you can easily handle
complex data strut in your client side JavaScript code.
Sample for JSON can be find in the web site Biesbrock has told you.
The idea of JSON is
e error message building part,
add the maximumSize as a message format param.
But it need many code, I don't think this issue is worth doing so may work.
2010/12/1 :
> Thanks Li --
>
> I saw what the interceptor was doing and decided that was not going to
> work. Would you mind p
2010/12/1 Anjib Mulepati :
> Li
> When you say sending response using JSON what does that mean?
I mean, send a string in JSON format as response.
If your response is simple, for example, just a "OK" or "ERROR" flag,
you can use plain text.
But when you need send a
The source code of FileUploadInterceptor is:
http://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
..
if (maximumSize != null && maximumSize < file.length()) {
Chris is right.
On the client side, there is not such a concept of "Struts
Action".There is Server Side Resource only.
You have to access(post or get) it by URL, param, and you must handle
the response from the server side.
Code should looks like:
(1)Client side JavaScript
Send a request to Se
What is the error message?
And, how did you defined the property "today"?
Is it the same data type as the static method param?
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h..
> Struts will not automatically populate fields based on parameters passed via
> the URL
I always use URL to binding parameters to Action.
And I have read source code of ParametersInterceptor, I think this
Interceptor will populate all the params to Action.
And it dose not treat params via URL o
I think your tag has a leak of attribute "method"
Your code:
will generate HTML likes:
When you click this button, there will be a http request parameter
like "btn.search=Search".
Struts2 will accept this parameter, and try to save it to your action property.
So, there will be a property sett
Another way is, using AJAX:
(1)Send a file upload post, (using AJAX), to your FileUploadAction
(2)FileUploadAction just read in the CSV file content, and return it
as HTTP Response
(3)On client side, AJAX can receive the Server response, then you can put it
to the textarea (using JQuery)
See:
h
Why do you need two forms?
Can't you put the FileUpload and the textarea in one form?
And in your Action, you can create 2 method, one handle the file upload,
and the other one handle the other request
-
To unsubscribe, e-mail:
(1)Select file from a [file input]
(2)Upload it to your Action (by a post)
(3)In your action, read in the CSV data, and store into some
property(let's say CSVDataProperty)
(4)Show your page again, and set the default value of the textarea by
CSVDataProperty
2010/11/30 Anjib Mulepati :
> Can anyo
What happens when
(1)liste is null
or
(2)liste is filled by null element
or
(3)index accessed is out of bound?
2010/11/27 Peter Nguyen :
> Li,
>
> I think the issue is here is most likely point 3. When the form is submitted,
> I suspect struts is trying to call getListe(int) t
There will be only one class, which will be the class of the elements
in the List.
I just want to find the Constructor with the least parameters if there
are more than one constructors for this class.
Once I get the constructor, I can use it to create instance and append
it to List automatically.
mport java.util.ArrayList;
import java.util.List;
/**
* A List class which can create items as need.
* When method get(index) and add(index, element) is called,
* and if there is no item in this index, item instances will be created
* automatically to avoid a NullPointerException.
*
* @author Li
I think the reason of the Exception maybe:
(1)the data you post is named like "liste[0].nom"
(2)Struts1 accept this http param, and try to translate it to a form
property, by using a lib named Apache Commons BeanUtils
See: http://commons.apache.org/beanutils/
(3)BeanUtils treats nested property
> Any examples of doing this in struts 2
You can get the HttpServletResponse by:
ServletActionContext.getResponse()
And then, you can set the download file name, by:
response.setHeader("Content-Disposition",
"attachment; filename=" + fileName);
And then, you can get the Out
My suggestion:
(1)I believe you can use ZipOutputStream to output the zipped data to
the response OutputStream directly, instead of a temp file. So no temp
file need to be created.
OR
(2)You can create a batch application, repeatedly run it with some
interval (use cron or something).
And in this
Maybe you can add a property in your action which return the current
date. And reference this property in your validation configuration.
Or create a Static method in an Utility class, return return the
current date, And reference this property in your validation
configuration.
If both of these do
try
2010/11/19 Altenhof, David Aron :
> Trying to figure out a way to do the following without much luck.
>
> I have an enumeration with a list of menu options and corresponding labels
> such as:
>
> public enum Color {
> RED("Red"),
> BLUE("Blue"),
> GREEN("Green");
>
>
Everything submit from the client side, are passed as String.
So you can't take object instance as your parameter.
You need take the ids of these objects as parameter, and load object
by the ids by you self.
2010/11/18 Harsh C :
> I think that is probably what it was. Basically in my action, I
Why you define "paramsPrepareParamsStack" again?
I believe it is already defined in the default configuration file,
you can just use it.
2010/11/18 RogerV :
>
> Hi
>
> I'm setting up a new Struts 2 project - the first time I've started from
> scratch in ages. I think it must be age, but I seem
try:
invoke the [get] method on map:
or
reference property on map:
or
iterator on values of map:
or
iterator on keys of map:
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands
Hi RogerV
I don't think config-browser plugin tells you which stack are you using,
it just show you all of actions in namespaces you have configured,
of course, including default namespace
(2010/11/18 18:18), RogerV wrote:
Hi
I'm setting up a new Struts 2 project - the first time I've started
t;>
>> The only other thing I can think of is that it's trying to set the cglib
>> proxy object on the action class and is complaining about that. We are using
>> cglib-nodep-2.2 to lazy load the KeywordList, and it worked perfectly fine
>> in Struts 2.0.
>>
>
I suggest you to do these things in the following way:
(1)put 2 method in IdentifyAction.
The first [execute] method returns [input],
show the input page to user.
(2)In the Identify-input.jsp,
submit fields to [IdentifyAction] itself, but another method: [verify]
(3)when validation fails, the r
"[Ljava.lang.String;" means a String array.
Looks like you are trying to copy a List from one action to another.
By somehow, struts2 is looking for a set method which take a String
array as it's parameter.
2010/11/15 Raj Nagappan :
> Hi, we recently upgraded from Struts 2.0.14 to 2.2.1 and I n
What data type of the property [yourAnswer] is ?
If it is an int property, try delete the double-quotation surrounding
the value 1.
2010/11/15 Prabhubalaji Ragavan :
> Hi
> I am using a radio option in my code. when i try to validate that thru the
> validator.xml, the validation is not happenin
My suggestion:
(1)Reference your js file as a static resource.
(2)If the js need some dynamic information from your action.
You can put js variables or hidden tags in your jsp,
and retrieve these variables or hidden tags in your js.
The js can be static outside resource, but [dynamic information
> 3. No such value is set. So I guess it is taking default value right now.
As I said, You may need change it to more than 200MB.
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user
(1)Is there any Proxy Server between the client PC and the Web App Server?
(2)When the action going wrong, is there any Error or Exception
message on the Server side?
(3)There is a configuration item to control the max-file-size you can
upload. You may need change it to more than 200MB.
[maxFileS
xample, if you defined:
then you should reference them by:
(4)I am not very sure, but I think the resource bundle name in
struts-config.xml should be separated by dot instead of slash
2010/11/10 bladu :
>
> Hi Steven and Li,
>
> I have found out that my locale is [es]. But the p
> try parameter="com/myapp/struts/MessageResources"/>
This is right.
The name of a resource bundle, should not include the locale suffix.
Actually, a resource bundle, contains several resource files which
have the same base name and different suffix for each locale.
For more information, see:
ht
>>
Is there an unnecessary quotation mark after [titleID]?
Try delete it and see if works.
If it still not working, My suggestion is:
(1)you can implement the search logic in the method [viewPage], and
access the search result via a new property.
or
(2)use a Map instead of a List, so you ca
The template of has these code:
<#if !stack.findValue("#optiontransferselect_js_included")??><#t/>
">
<#assign temporaryVariable =
stack.setValue("#optiontransferselect_js_included", "true") /><#t/>
These code should generate some HTML code which import the JS file.
And, the JS
1 - 100 of 281 matches
Mail list logo