Re: Struts 6.3 Issue Uploading Files

2024-03-03 Thread Zoran Avtarovski
Thanks Lukasz,

I'm not sure that is the issue. I did a simple verification test and added some 
debugging around the request content type I got the following :
Request Content Type: multipart/form-data; 
boundary=---22500187869113554433768726201
Using default regex string content type REGEX : true

I just plugged the default value into the REGEX parser :
Pattern multipartValidationPattern = 
Pattern.compile("^multipart/form-data(?:\\s*;\\s*boundary=[0-9a-zA-Z'()+_,\\-./:=?]{1,70})?(?:\\s*;\\s*charset=[a-zA-Z\\-0-9]{3,14})?");
boolean validContentType = request.getContentType() != null && 
multipartValidationPattern.matcher(contentType.toLowerCase(Locale.ENGLISH)).matches();

I tried to raise a ticket to include some logging in the isMultipartRequest 
function to record why it failed but I don't have an account anymore.

I will modify the source code locally to add some debug code this afternoon. 
Hopefully it will build OK and I can get back to you with some feedback.

Z.


On 1/3/2024, 5:19 pm, "Lukasz Lenart" mailto:lukaszlen...@apache.org>> wrote:


The request must match the following regex [1], more details in the
docs [2], yet I notice there is no logging around this logic, feel
free to create a ticket to improve that.


[1] 
https://github.com/apache/struts/blob/master/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java#L110
 
<https://github.com/apache/struts/blob/master/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java#L110>
[2] 
https://struts.apache.org/core-developers/file-upload.html#request-validation 
<https://struts.apache.org/core-developers/file-upload.html#request-validation>


śr., 28 lut 2024 o 23:28 Zoran Avtarovski mailto:zo...@sparecreative.com>> napisał(a):
>
> Hi Guys,
>
>
>
> We are unable to upload files to our first 6.3 application using HTTP 
> requests, but the strange thing is they work with ajax requests. I suspect we 
> are overlooking something in the config which is required in 6.3.
>
>
>
> We are using 6.3.0.2 running on Tomcat 9. The file object is null after the 
> upload but we can see the upload is there.
>
>
>
> I can see the params interceptor finds the file and copies it to the temp 
> directory, but I then can’t access the file in the action??? What’s really 
> strange is if we use the same mechanism using a an ajax request with FormData 
> it works as expected. That’s why we created a simple setup as outlined below 
> to identify the root cause.
>
>
>
> Any help would really be appreciated.
>
>
>
> Here’s a snippet of the logs:
>
> multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:103) - Found 
> file item: [upload]
>
> multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:114) - Item 
> is a file upload
>
>
>
> When I try and access the file in my action:
>
> action.IndexAction (IndexAction.java:54) - Uploaded file : null
>
> action.IndexAction (IndexAction.java:55) - Uploaded file name : null
>
> action.IndexAction (IndexAction.java:56) - Uploaded file type : null
>
> action.IndexAction (IndexAction.java:57) - Uploaded file length : 0
>
>
>
>
>
> And then after the request has completed:
>
> multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:361) - 
> Removing file upload name=Invoice - 1331-1.pdf, StoreLocation= 
> /apache-tomcat-9.0.44_base/work/Catalina/localhost/caams/upload_0569c990_d32c_4688_ad50_44db275ab0cc_.tmp,
>  size=465396 bytes, isFormField=false, FieldName=upload
>
>
>
> This is what my form looks like:
>
>
>
>  theme="simple">
>
> 
>
> Submit
>
> 
>
>
>
> My action has the following (BaseAction extends ActionSupport):
>
>
>
> public class IndexAction extends BaseAction {
>
>
>
> private File upload;
>
> private String uploadFileName;
>
> private String uploadContentType;
>
> private long uploadContentLength;
>
>
>
> public IndexAction() {
>
> }
>
>
>
> @Override
>
> public String execute() {
>
> return SUCCESS;
>
> }
>
>
>
> public String edit() {
>
> return INPUT;
>
> }
>
>
>
> public String uploadTest() {
>
> try {
>
> LOGGER.debug("Uploaded file : "+ upload);
>
> LOGGER.debug("Uploaded file name : "+ uploadFileName);
>
> LOGGER.debug("Uploaded file type : "+ uploadContentType);
>
> LOGGER.debug("Uploaded file length : "+ uploadContentLength);
>
>
>
> inputStream = new FileInputStream(upload);
>
>
>
> if (inputStream != null) {
>
> inputStream.close();
>
> }
>
>
>
> } catch (Exception e) {
>
>

Re: Struts 6.3 Issue Uploading Files

2024-02-29 Thread Zoran Avtarovski
Hi Burton,

 

The issue is with a simple HTTP request the file object is null, see the red 
log entry below. But if I use a simple jQuery ajax call, it works as expected 
and I’m not sure why and how to rectify.

 

This was the simple code I used to upload the file, same set of interceptors, 
same action, same method and it works:

   jQuery.ajax({

    type: 'POST',

    url: $form.attr('action'),

    cache: false,

    contentType: false,

    processData: false,

    data: formData,

    success: function (response) {

    if (response.success) {

    console.log(“success, file uploaded 
successfully”);

    } else {

    console.log(“failure, file upload failed to 
execute successfully”);

    }

    },

    error: function (err) {

    console.log("Error ajax submission : ", err);

    }

    });

 

The log files now include:

action.IndexAction (IndexAction.java:54) - Uploaded file : 
/apache-tomcat-9.0.44_base/work/Catalina/localhost/caams/upload_eabd436d_0fdd_4ff7_a598_b9a19724d8dd_.tmp

action.IndexAction (IndexAction.java:55) - Uploaded file name : Invoice - 
1331-1.pdf

action.IndexAction (IndexAction.java:56) - Uploaded file type : application/pdf

action.IndexAction (IndexAction.java:57) - Uploaded file length  : 0

 

whereas with an HTTP request the logs looked like this:

action.IndexAction (IndexAction.java:54) - Uploaded file : null

action.IndexAction (IndexAction.java:55) - Uploaded file name : null

action.IndexAction (IndexAction.java:56) - Uploaded file type : null

action.IndexAction (IndexAction.java:57) - Uploaded file length : 0

 

I’m trying to understand why the same action method works with the ajax 
requests but not plain HTTP requests?

 

Finally, 6.3 doesn’t have the 
org.apache.struts2.interceptor.ActionFileUploadInterceptor in the jar so I 
can’t see how we could test?

 

Z.

 

 

 

 

 

 

 

 

On 1/3/2024, 1:30 am, "Burton Rhodes" mailto:burtonrho...@gmail.com>> wrote:

 

 

I'm not exactly sure what isn't working for you, but have you tried 

using the newer FilesUploadAware interface? More information can be 

found at https://struts.apache.org/core-developers/file-upload.html 
<https://struts.apache.org/core-developers/file-upload.html>

 

 

I might also recommend you set  to see if anything comes up in the logs.

 

 

Thanks,

Burton

 

 

-- Original Message --

>From "Zoran Avtarovski" <mailto:zo...@sparecreative.com>>

To "Struts Users Mailing List" mailto:user@struts.apache.org>>

Date 2/28/2024 4:27:48 PM

Subject Struts 6.3 Issue Uploading Files

 

 

>Hi Guys,

> 

> 

> 

>We are unable to upload files to our first 6.3 application using HTTP 
>requests, but the strange thing is they work with ajax requests. I suspect we 
>are overlooking something in the config which is required in 6.3.

> 

> 

> 

>We are using 6.3.0.2 running on Tomcat 9. The file object is null after the 
>upload but we can see the upload is there.

> 

> 

> 

>I can see the params interceptor finds the file and copies it to the temp 
>directory, but I then can’t access the file in the action??? What’s really 
>strange is if we use the same mechanism using a an ajax request with FormData 
>it works as expected. That’s why we created a simple setup as outlined below 
>to identify the root cause.

> 

> 

> 

>Any help would really be appreciated.

> 

> 

> 

>Here’s a snippet of the logs:

> 

>multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:103) - Found 
>file item: [upload]

> 

>multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:114) - Item is 
>a file upload

> 

> 

> 

>When I try and access the file in my action:

> 

>action.IndexAction (IndexAction.java:54) - Uploaded file : null

> 

>action.IndexAction (IndexAction.java:55) - Uploaded file name : null

> 

>action.IndexAction (IndexAction.java:56) - Uploaded file type : null

> 

>action.IndexAction (IndexAction.java:57) - Uploaded file length : 0

> 

> 

> 

> 

> 

>And then after the request has completed:

> 

>multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:361) - 
>Removing file upload name=Invoice - 1331-1.pdf, StoreLocation= 
>/apache-tomcat-9.0.44_base/work/Catalina/localhost/caams/upload_0569c990_d32c_4688_ad50_44db275ab0cc_.tmp,
> size=465396 bytes, isFormField=false, FieldName=upload

> 

> 

> 

>This is what my form looks like:

> 

> 

> 

>theme="simple">

> 

>

Struts 6.3 Issue Uploading Files

2024-02-28 Thread Zoran Avtarovski
Hi Guys,

 

We are unable to upload files to our first 6.3 application using HTTP requests, 
but the strange thing is they work with ajax requests. I suspect we are 
overlooking something in the config which is required in 6.3.

 

We are using 6.3.0.2 running on Tomcat 9. The file object is null after the 
upload but we can see the upload is there.

 

I can see the params interceptor finds the file and copies it to the temp 
directory, but I then can’t access the file in the action??? What’s really 
strange is if we use the same mechanism using a an ajax request with FormData 
it works as expected. That’s why we created a simple setup as outlined below to 
identify the root cause.

 

Any help would really be appreciated.

 

Here’s a snippet of the logs:

multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:103) - Found 
file item: [upload]

multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:114) - Item is 
a file upload

 

When I try and access the file in my action:

action.IndexAction (IndexAction.java:54) - Uploaded file : null

action.IndexAction (IndexAction.java:55) - Uploaded file name : null

action.IndexAction (IndexAction.java:56) - Uploaded file type : null

action.IndexAction (IndexAction.java:57) - Uploaded file length  : 0

 

 

And then after the request has completed:

multipart.JakartaMultiPartRequest (JakartaMultiPartRequest.java:361) - Removing 
file upload name=Invoice - 1331-1.pdf, StoreLocation= 
/apache-tomcat-9.0.44_base/work/Catalina/localhost/caams/upload_0569c990_d32c_4688_ad50_44db275ab0cc_.tmp,
 size=465396 bytes, isFormField=false, FieldName=upload

 

This is what my form looks like:

 





  Submit



 

My action has the following (BaseAction extends ActionSupport):

 

public class IndexAction extends BaseAction {

 

    private File upload;

    private String uploadFileName;

    private String uploadContentType;

    private long uploadContentLength;

 

    public IndexAction() {

    }

 

    @Override

    public String execute() {

    return SUCCESS;

    }

 

    public String edit() {

    return INPUT;

    }

 

    public String uploadTest() {

    try {

    LOGGER.debug("Uploaded file : "+ upload);

    LOGGER.debug("Uploaded file name : "+ uploadFileName);

    LOGGER.debug("Uploaded file type : "+ uploadContentType);

    LOGGER.debug("Uploaded file length  : "+ uploadContentLength);

    

inputStream = new FileInputStream(upload);

 

    if (inputStream != null) {

    inputStream.close();

    }

 

    } catch (Exception e) {

    LOGGER.error("General . uploading error :", e);

    }

 

    return SUCCESS;

    }

 

    public File getUpload() {

    return upload;

    }

 

    public void setUpload(File upload) {

    this.upload = upload;

    }

 

    public String getUploadFileName() {

    return uploadFileName;

    }

 

    public void setUploadFileName(String uploadFileName) {

    this.uploadFileName = uploadFileName;

    }

 

    public String getUploadContentType() {

    return uploadContentType;

    }

 

    public void setUploadContentType(String uploadContentType) {

    this.uploadContentType = uploadContentType;

    }

 

    public long getUploadContentLength() {

    return uploadContentLength;

    }

 

    public void setUploadContentLength(long uploadContentLength) {

    this.uploadContentLength = uploadContentLength;

    }

}

 

My relevant struts.xml config:

    



    

    

    

    

    

    



      





    

    

 

    

    

   



    /WEB-INF/pages/main/formUpload.jsp

    home

    

 



    /WEB-INF/pages/main/formUpload.jsp

    

 

    



I18N Interceptor Change

2016-08-16 Thread Zoran Avtarovski
HI Guys,

 

We have an old project which has been happily working for years. Recently we 
updated it to 2.5.x which was surprisingly easy.

 

One issue we did run into which was quite annoying was the I18N Interceptor now 
validates locales against the list of default available locales in this bit of 
code:

 

if (locale != null && 
!Arrays.asList(Locale.getAvailableLocales()).contains(locale)) {

    locale = Locale.getDefault();

}

 

The problem is our app is for refugees and not all the languages in in the 
available locales array. This must be relatively new as it worked in the old 
version 2.x ish.

 

As a work-around we over-rode the standard interceptor without the validation 
but I wanted to ask if the sore team could use a parameter to bi-pass the 
validation.

 

For example a tag in the struts.xml file:

 



  

 false

  



 

and then access it in the interceptor.

 

Z.



Re: Cascading Nature of Templates and Themes

2015-05-04 Thread Zoran Avtarovski
Hi Lucasz,

>>I had copied all the missing simple templates into my mobile template
>
>don't do it, Struts will find them. Just override those templates which
>you need

I don¹t think I was clear enough here. If I don¹t include the file the
error is thrown. The issue I have is struts doesn¹t find them working up
the chain.


>
>Maybe because of hardcoded "simple" - and it happens that not all
>templates were adjusted to be "expandTheme" friendly ;)
>
>>
>> The mobile select.ftl template is simply:
>>
>> <#include
>> 
>>"/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl"
>>/>
>> <#include "/${parameters.templateDir}/simple/select.ftl" />
>
>You shouldn't hardcode "simple" here, use "expandTheme" to tell Struts
>to check your theme first and than parent theme.

I was just following the guidelines. If I don¹t hardcode simple aren¹t I
at risk of a circular reference, as the file will simply reference itself?


Z.



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Cascading Nature of Templates and Themes

2015-05-04 Thread Zoran Avtarovski
I spoke too soon.

I just replaced all instances of parameters.theme with
parameters.expandTheme.

I had copied all the missing simple templates into my mobile template
directory as a work-around. When I deleted optgroup.ftl from the mobile
template directory I get the following error:

ERROR [ajp-nio-8009-exec-2] - Template processing error: "Error reading
included file template/~~~mobile/optgroup.ftl"

Error reading included file template/~~~mobile/optgroup.ftl
The problematic instruction:
--
==> include 
"/${parameters.templateDir}/${parameters.expandTheme}/optgroup.ftl" [on
line 118, column 1 in template/simple/select.ftl]
 in include "/${parameters.templateDir}/simple/select.ftl" [on line 25,
column 1 in template/mobile/select.ftl]
--

Java backtrace for programmers:
--
freemarker.template.TemplateException: Error reading included file
template/~~~mobile/optgroup.ftl
.
.
.
Caused by: java.io.FileNotFoundException: Template
template/~~~mobile/optgroup.ftl not found.


What I don’t understand I why the template manager doesn’t try to load
optgroup.ftl from the simple template?


The mobile select.ftl template is simply:

<#include 
"/${parameters.templateDir}/${parameters.expandTheme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/select.ftl" />
<#include 
"/${parameters.templateDir}/${parameters.expandTheme}/controlfooter.ftl" />

And the theme.properties file has one entry:

parent=simple

Again any assistance would be appreciated.

Z.

On 1/05/2015 6:23 pm, "Lukasz Lenart"  wrote:

>2015-05-01 1:32 GMT+02:00 Zoran Avtarovski :
>> We¹ve started a new project which required a custom theme which we call
>> mobile and we set it to extend the simple theme by creating a
>> theme.properties file and setting parent=simple.
>>
>> Unfortunately this isn¹t working. It has in the past without any
>>issues. Has
>> something changed in the latest version of struts that would explain
>>this?
>>
>> We are using struts 2.3.20 and freemarker 2.3.19 if it makes any
>>difference.
>
>Strange, the same mechanism is used by Struts itself. Can you show
>project's structure? Or prepare a small demo app to represent your
>case?
>
>Here you have some examples:
>https://github.com/apache/struts-examples/tree/master/themes
>https://github.com/apache/struts-examples/tree/master/themes_override
>
>
>Regards
>-- 
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Cascading Nature of Templates and Themes

2015-05-04 Thread Zoran Avtarovski
Thanks for the pointer Lucasz.

One thing I did notice was that some of my files didn’t use the
${parameters.expandTheme} parameter, but instead just had plain old
${parameters.theme} in the free marker templates.

I’ll make the changes and I’m pretty sure that should resolve the issue.

Again thanks for the help.

Z.


On 1/05/2015 6:23 pm, "Lukasz Lenart"  wrote:

>2015-05-01 1:32 GMT+02:00 Zoran Avtarovski :
>> We¹ve started a new project which required a custom theme which we call
>> mobile and we set it to extend the simple theme by creating a
>> theme.properties file and setting parent=simple.
>>
>> Unfortunately this isn¹t working. It has in the past without any
>>issues. Has
>> something changed in the latest version of struts that would explain
>>this?
>>
>> We are using struts 2.3.20 and freemarker 2.3.19 if it makes any
>>difference.
>
>Strange, the same mechanism is used by Struts itself. Can you show
>project's structure? Or prepare a small demo app to represent your
>case?
>
>Here you have some examples:
>https://github.com/apache/struts-examples/tree/master/themes
>https://github.com/apache/struts-examples/tree/master/themes_override
>
>
>Regards
>-- 
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Cascading Nature of Templates and Themes

2015-04-30 Thread Zoran Avtarovski
We¹ve started a new project which required a custom theme which we call
mobile and we set it to extend the simple theme by creating a
theme.properties file and setting parent=simple.

Unfortunately this isn¹t working. It has in the past without any issues. Has
something changed in the latest version of struts that would explain this?

We are using struts 2.3.20 and freemarker 2.3.19 if it makes any difference.

Z.





Re: Stream Result Returns Empty File

2013-11-13 Thread Zoran Avtarovski
Found the issue.

I hadn’t set the contentLength parameter.

In the latest update to 2.3.15 if the contentLength isn’t set it generates
a zero length stream.

Once I set contentLength to tempFile.length() it all worked again.

Z.



On 13/11/2013 3:34 pm, "Zoran Avtarovski"  wrote:

>I¹m seeing a really strange issue in one of our struts apps with a stream
>result where the downloaded file is empty (zero bytes).
>
>I can¹t see where it is going wrong. I dynamically generate a zip file in
>tomcat¹s temp folder and then use a Buffered input reader to pass off to
>the
>struts stream.
>
>I can the the zip file in the tomcat temp folder and it contains the data
>it¹s supposed to. The issue is getting from the file to the input stream.
>I¹ve included by struts configuration, the relevant part of my action and
>the a detailed log.
>
>I¹d appreciate any help.
>
>Z.
>
>
>My struts config :
>method="exportData">
>
>false
>${documentContentType}
>name="contentDisposition">${documentFileName}
>name="contentLength">${documentContentLength}
>1024
>
>
>
>In my action class :
>
>String filePrefix = System.getProperty("java.io.tmpdir") +
>³/temporaryData.zip" ;
>   LOGGER.debug("Read the generated file : "+ zipName);
>File tempFile = new File(zipName);
>if(tempFile.exists()){
>LOGGER.debug("The file exists : "+ zipName);
>}
>if(tempFile.canRead()){
>LOGGER.debug("The file can be read : "+ zipName);
>}
>if(tempFile.isFile()){
>LOGGER.debug("The file is a file : "+ zipName);
>}
>if(tempFile.isHidden()){
>LOGGER.debug("The file is hidden : "+ zipName);
>}
>LOGGER.debug("The file size is : "+ tempFile.length());
>
>inputStream = new BufferedInputStream(new
>FileInputStream(tempFile));
>documentFileName = "attachment; filename=NfcData.zip";
>documentContentType = "application/zip";
>
>
>My log files looks like this:
>
>DEBUG [http-bio-8084-exec-24] - Zip file name :
>/Users/zoran/Library/Application
>Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
>DEBUG [http-bio-8084-exec-24] - Read the generated file :
>/Users/zoran/Library/Application
>Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
>DEBUG [http-bio-8084-exec-24] - The file exists :
>/Users/zoran/Library/Application
>Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
>DEBUG [http-bio-8084-exec-24] - The file can be read :
>/Users/zoran/Library/Application
>Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
>DEBUG [http-bio-8084-exec-24] - The file is a file :
>/Users/zoran/Library/Application
>Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
>DEBUG [http-bio-8084-exec-24] - The file size is : 1441
>DEBUG [http-bio-8084-exec-24] - Document File name : attachment;
>filename=NfcData.zip
> Document Content Type : application/zip
>DEBUG [http-bio-8084-exec-24] - Returning cached instance of singleton
>bean
>'org.springframework.transaction.config.internalTransactionAdvisor'
>DEBUG [http-bio-8084-exec-24] - Retrieving convert for class [class
>org.apache.struts2.dispatcher.StreamResult] and property [allowCaching]
>DEBUG [http-bio-8084-exec-24] - Converter is null for property
>[allowCaching]. Mapping size [0]:
>DEBUG [http-bio-8084-exec-24] - field-level type converter for property
>[allowCaching] = none found
>DEBUG [http-bio-8084-exec-24] - global-level type converter for property
>[allowCaching] = 
>com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b6e6482
>DEBUG [http-bio-8084-exec-24] - Retrieving convert for class [class
>org.apache.struts2.dispatcher.StreamResult] and property [bufferSize]
>DEBUG [http-bio-8084-exec-24] - field-level type converter for property
>[bufferSize] = none found
>DEBUG [http-bio-8084-exec-24] - global-level type converter for property
>[bufferSize] = 
>com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b6e6482
>DEBUG [http-bio-8084-exec-24] - Creating converter of type
>[com.opensymphony.xwork2.conversion.impl.NumberConverter]
>DEBUG [http-bio-8084-exec-24] - Entering nullPropertyValue
>[target=[com.sparecreative.sms.gateway.action.ClientAction@988c0a6,
>com.opensymphony.xwork2.DefaultTextProvider@907a831

Stream Result Returns Empty File

2013-11-12 Thread Zoran Avtarovski
I¹m seeing a really strange issue in one of our struts apps with a stream
result where the downloaded file is empty (zero bytes).

I can¹t see where it is going wrong. I dynamically generate a zip file in
tomcat¹s temp folder and then use a Buffered input reader to pass off to the
struts stream.

I can the the zip file in the tomcat temp folder and it contains the data
it¹s supposed to. The issue is getting from the file to the input stream.
I¹ve included by struts configuration, the relevant part of my action and
the a detailed log.

I¹d appreciate any help.

Z.


My struts config :


false
${documentContentType}
${documentFileName}
${documentContentLength}
1024



In my action class :

String filePrefix = System.getProperty("java.io.tmpdir") +
³/temporaryData.zip" ;
   LOGGER.debug("Read the generated file : "+ zipName);
File tempFile = new File(zipName);
if(tempFile.exists()){
LOGGER.debug("The file exists : "+ zipName);
}
if(tempFile.canRead()){
LOGGER.debug("The file can be read : "+ zipName);
}
if(tempFile.isFile()){
LOGGER.debug("The file is a file : "+ zipName);
}
if(tempFile.isHidden()){
LOGGER.debug("The file is hidden : "+ zipName);
}
LOGGER.debug("The file size is : "+ tempFile.length());

inputStream = new BufferedInputStream(new
FileInputStream(tempFile));
documentFileName = "attachment; filename=NfcData.zip";
documentContentType = "application/zip";


My log files looks like this:

DEBUG [http-bio-8084-exec-24] - Zip file name :
/Users/zoran/Library/Application
Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
DEBUG [http-bio-8084-exec-24] - Read the generated file :
/Users/zoran/Library/Application
Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
DEBUG [http-bio-8084-exec-24] - The file exists :
/Users/zoran/Library/Application
Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
DEBUG [http-bio-8084-exec-24] - The file can be read :
/Users/zoran/Library/Application
Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
DEBUG [http-bio-8084-exec-24] - The file is a file :
/Users/zoran/Library/Application
Support/NetBeans/7.4/apache-tomcat-7.0.41.0_base/temp/temporaryData.zip
DEBUG [http-bio-8084-exec-24] - The file size is : 1441
DEBUG [http-bio-8084-exec-24] - Document File name : attachment;
filename=NfcData.zip
 Document Content Type : application/zip
DEBUG [http-bio-8084-exec-24] - Returning cached instance of singleton bean
'org.springframework.transaction.config.internalTransactionAdvisor'
DEBUG [http-bio-8084-exec-24] - Retrieving convert for class [class
org.apache.struts2.dispatcher.StreamResult] and property [allowCaching]
DEBUG [http-bio-8084-exec-24] - Converter is null for property
[allowCaching]. Mapping size [0]:
DEBUG [http-bio-8084-exec-24] - field-level type converter for property
[allowCaching] = none found
DEBUG [http-bio-8084-exec-24] - global-level type converter for property
[allowCaching] = 
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b6e6482
DEBUG [http-bio-8084-exec-24] - Retrieving convert for class [class
org.apache.struts2.dispatcher.StreamResult] and property [bufferSize]
DEBUG [http-bio-8084-exec-24] - field-level type converter for property
[bufferSize] = none found
DEBUG [http-bio-8084-exec-24] - global-level type converter for property
[bufferSize] = 
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b6e6482
DEBUG [http-bio-8084-exec-24] - Creating converter of type
[com.opensymphony.xwork2.conversion.impl.NumberConverter]
DEBUG [http-bio-8084-exec-24] - Entering nullPropertyValue
[target=[com.sparecreative.sms.gateway.action.ClientAction@988c0a6,
com.opensymphony.xwork2.DefaultTextProvider@907a831],
property=contentDisposition]
DEBUG [http-bio-8084-exec-24] - Retrieving convert for class [class
com.opensymphony.xwork2.util.CompoundRoot] and property [(null)]
DEBUG [http-bio-8084-exec-24] - field-level type converter for property
[null] = none found
DEBUG [http-bio-8084-exec-24] - global-level type converter for property
[null] = none found
DEBUG [http-bio-8084-exec-24] - falling back to default type converter
[com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b6e6482]
DEBUG [http-bio-8084-exec-24] - Entering nullPropertyValue
[target=[com.sparecreative.sms.gateway.action.ClientAction@988c0a6,
com.opensymphony.xwork2.DefaultTextProvider@907a831], property=contentType]
DEBUG [http-bio-8084-exec-24] - Retrieving convert for class [class
com.opensymphony.xwork2.util.CompoundRoot] and property [(null)]
DEBUG [http-bio-8084-exec-24] - field-level type converter for property
[null] = none found
DEBUG

K8 Struts2 Exploit

2013-07-29 Thread Zoran Avtarovski
I've just found a number of new jsp pages on a web app we developed.

There was a text file relating to the K8 Struts2 Exploit. We contacted the
client and updated the files, but I'd like to know if anybody has further
information about this exploit.

Basically do we tell the client to wipe the server and reinstall everything
or is the update to the web app enough.

Z.





Re: Localised text tag

2013-05-08 Thread Zoran Avtarovski
I'm using struts v2.3.8 and OGNL v3.0.6.

Is there a property or setting for OGNL to prevent double evaluations? Or
is there a fix in GitHub?

Z.


On 8/05/13 3:51 PM, "Lukasz Lenart"  wrote:

>Hi,
>
>Yeah, it looks like a double evaluation which is a bug probably
>
>
>Regards
>-- 
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>
>2013/5/8 Dale Newfield :
>> It seems like an evaluation of a value, which could be bad, in fact a
>>large security hole.  What if that value were "System.exit()"? (I forget
>>my ognl...I think you need fully qualified path and a hash or at or
>>something to call static methods, but you get the point.)
>>
>> -Dale
>>
>>
>> On May 7, 2013, at 11:10 PM, Zoran Avtarovski 
>>wrote:
>>
>>> I have a small issue that I'm trying to resolve and I was hoping the
>>>someone
>>> might have come across it earlier.
>>>
>>> I'll try to explain as best I can:
>>> I have a number of objects on the value stack:
>>> 1. pojo  - a java object with a string attribute called key which
>>>links to a
>>> DB based localised text value
>>> 2. movement ­ another java object with a string attribute called
>>>strength
>>> To display the localised text associated with the pojo key I use the
>>> following tag
>>>
>>> 
>>>
>>> The problem is that if the key value clashes with another item on the
>>>value
>>> stack I don't get the string value.
>>> For example if the key value on pojo is "movement.strength" and the
>>>strength
>>> value for movement is "weak" I don't get the expected results. Instead
>>>of
>>> getting the localised text with key "movement.strength" I get the
>>>localised
>>> text with key "weak". I tried setting the searchValueStack property to
>>>false
>>> but it made no change.
>>>
>>> I'd appreciate any help.
>>>
>>> Z.
>>>
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Localised text tag

2013-05-07 Thread Zoran Avtarovski
I have a small issue that I'm trying to resolve and I was hoping the someone
might have come across it earlier.

I'll try to explain as best I can:
I have a number of objects on the value stack:
1. pojo  - a java object with a string attribute called key which links to a
DB based localised text value
2. movement ­ another java object with a string attribute called strength
 To display the localised text associated with the pojo key I use the
following tag



The problem is that if the key value clashes with another item on the value
stack I don't get the string value.
For example if the key value on pojo is "movement.strength" and the strength
value for movement is "weak" I don't get the expected results. Instead of
getting the localised text with key "movement.strength" I get the localised
text with key "weak". I tried setting the searchValueStack property to false
but it made no change.

I'd appreciate any help.

Z.





Re: Struts2-jQuery plugin

2012-11-21 Thread Zoran Avtarovski
Hi Lucas,

I don't use the plugin as I find using jQuery without a plugin to be
simple enough.

I suspect that if you look at the generated javascript in your
searchResult.jsp page the jQuery binding will be waiting for a document
ready trigger which isn't fired for ajax requests.

The way I get around this to use the jQuery live function for binding
which works perfectly, but as I said not having used the sj plugin not
sure what you need to do.

Z.



On 21/11/12 12:46 AM, "lucas owen"  wrote:

>Hi Struts users!
>
>I'm building a web app and I have a serious problem:
>
>index.jsp is a search form with 2 combo boxes which i populate with
>sj:select (this works correctly)
>
>when the user clicks "search", the form sends the data to search.action
>and
>the results are displayed in searchResult.jsp
>
>in this searchResult.jsp i have the same 2 como boxes (same code) but
>
>1.- they dont work (they dont call the sj:select href action)
>2.- they dont get pre-selected with the value the user entered
>
>so the question is can i use sj:select after coming from search.action or
>this just can be used in jsp without any previous struts processing (like
>index.jsp)?
>
>thank you so much in advance!!



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Multi dimension array from form

2012-11-02 Thread Zoran Avtarovski
Thanks Jeffrey,

In the end I went with using a string representation of the array
'[firstIndex][secondIndex][value]' and then used a tokenizer to recreate
the array.

It was pretty straight forward in the end.

I don't know why but I thought I'd used multi dimensional arrays like that
in the past but when I went back to look at some past projects, we hadn't.

I think I was suffering a little delirium.

Z.




On 2/11/12 1:28 PM, "Jeffrey Black"  wrote:

>Z,
>
>Have a look at the following page:
>
>http://struts.apache.org/2.x/docs/html-form-buttons-howto.html
>
>I haven't worked through your use-case yet, but it may get you where you
>want to be.  I've used these techniques in my apps.
>
>Best,
>
>jb
>
>
>On Nov 1, 2012, at 9:47 AM, Zoran Avtarovski 
>wrote:
>
>> I have a two dimension array in my action:
>> 
>> Integer[][] dataArray with appropriate getter/setter.
>> 
>> In my form I use the following checkbox tag to pass the data from user
>>to
>> action
>> 
>>> status="typeStat">
>>> var="attribute" status="attStat">
>>> name="dataArray[%{#typeStat.index}][%{#attStat.index}]"
>> label="%{#attribute.name}" fieldValue="%{#attribute.attributeId}"/>
>>
>>
>> 
>> The form renders correctly in that the checkboxes are named
>>dataArray[0][1]
>> and so forth, but I can't the array form data into the array.
>> 
>> Is there something I'm missing? I thought this was possible.
>> 
>> I'd appreciate any help as the only other option I can see is to
>>construct a
>> string with a the multi dimension data and then token and construct the
>> array in the action, which I'd rather not.
>> 
>> Z.
>> 
>> 
>> 
>> 
>> 
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Multi dimension array from form

2012-11-01 Thread Zoran Avtarovski
I have a two dimension array in my action:

Integer[][] dataArray with appropriate getter/setter.

In my form I use the following checkbox tag to pass the data from user to
action







The form renders correctly in that the checkboxes are named dataArray[0][1]
and so forth, but I can't the array form data into the array.

Is there something I'm missing? I thought this was possible.

I'd appreciate any help as the only other option I can see is to construct a
string with a the multi dimension data and then token and construct the
array in the action, which I'd rather not.

Z.





Re: s:text encoding issue

2011-10-19 Thread Zoran Avtarovski
No. My Mac uses en_AU as the default, but like you we use the
request_locale parameter with the required locale. The system is designed
to enable users to select the desired locale.

The strange part is that that we haven't had any issues in the past when
we just had Scandinavian languages, the problem only appears with Arabic
and some African languages.

I might have to look at the source for s:text tag and see if there is
something I am missing.

The key issue here is the getText method call on ActionSupport is working
as expected, which is why I'm confused.

Z.


On 20/10/11 12:09 AM, "Łukasz Lenart"  wrote:

>I did the same with struts2-blank example application and it works
>just fine. My Mac uses EN locale by default but you can change locale
>in the app with request_locale parameter and it works as expected.
>
>What you mean by "the selected locale is Arabic" ? Is it the system
>locale ?
>
>
>Kind regards
>-- 
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>Warszawa JUG conference - Confitura http://confitura.pl/
>
>2011/10/19 Zoran Avtarovski :
>> It woks fine for the default locale for me as well.
>>
>> Where it fails is when the selected locale is Arabic. Using the getText
>> method in application support works as expected but s:text fails to
>>render
>> the text correctly.
>>
>> Z.
>>
>> On 19/10/11 11:20 PM, "Li Ying"  wrote:
>>
>>>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-mail: user-unsubscr...@struts.apache.org
>>>For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: s:text encoding issue

2011-10-19 Thread Zoran Avtarovski
It woks fine for the default locale for me as well.

Where it fails is when the selected locale is Arabic. Using the getText
method in application support works as expected but s:text fails to render
the text correctly.

Z.

On 19/10/11 11:20 PM, "Li Ying"  wrote:

>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-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: s:text encoding issue

2011-10-19 Thread Zoran Avtarovski
Hi Lucasz,

Here's the entry from struts.xml



Z.



On 19/10/11 4:23 PM, "Łukasz Lenart"  wrote:

>2011/10/19 Zoran Avtarovski :
>> We are using struts 2.2.2, everything is UTF-8, struts, jsp, sitemesh,
>> freemarker and jdbc connection.
>
>and struts.i18n.encoding= ?
>
>
>Regards
>-- 
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>Warszawa JUG conference - Confitura http://confitura.pl/
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



s:text encoding issue

2011-10-18 Thread Zoran Avtarovski
I'm having an issue using the s:text tag, in that it is displaying garbage
on the screen. But if I use a s:property tag all works well.

For example if I use the two following tags and select Arabic:



The first works as expected and the displayed text is perfect, but the
second just produces a series of question marks.

I'd appreciate any help as we've just spent a shit load of time
standardising on s:text and I don't really want to have to do it all over
again.

We are using struts 2.2.2, everything is UTF-8, struts, jsp, sitemesh,
freemarker and jdbc connection.

Z. 




Unicode Encoding request parameters

2011-09-20 Thread Zoran Avtarovski
We have a struts2 multilingual web app that requires request parameters be
encoded as Unicode (UTF-8).

In order to get the POST parameters to work we had to implement a character
encoding filter to encode all HTML parameters as UTF-8.

I'd like to know if it's possible to do the encoding via S2 and avoid the
use of another filter. We'e set the struts.i18n.encoding property to UTF-8
and I don't know what else to do.

As always I'd appreciate any suggestions you guys might have.

Z.
 




Re: implementation of m. and www.

2011-09-13 Thread Zoran Avtarovski
We use a simple interceptor which reads to request URL and sets some base
action flags which we then use use with sitemesh to determine template
structure.

The benefit of an interceptor is that you only make any changes centrally.

Z.


On 13/09/11 2:00 AM, "Frans Thamura"  wrote:

>hi all
>
>i have 3 container,
>
>1. www using jquery common
>2. m. using jquery mobile
>3. REST API
>
>
>for 1 and 2, i try to implement a same URI for both
>
>this is an exanple
>
>http://www.mervpolis.com/profile/fthamura
>http://m.mervpolis.com/profile/fthamura
>
>i want if the user access using mobile, and click www from email, will
>be redirect to the m. URL
>
>and also if we click m. in PC/notebook browser, will redirect to www.
>
>question
>1. is there implementation that u can share, if we wanna to implement
>under one container (.war) for both.
>
>2. if we implement 2 containers.
>
>for the REST API, we dont have problem. esp the security
>implementation, we still want to know the REST implementation with the
>both case no. 1 and no. 2 which we use jquery both, and i am glad if
>we can make JQuery consume JSON from REST API of Struts
>
>this is the case
>
>server -> JSON -> jquery for www
>server -> JSON -> jquery mobile for m.
>
>which the interceptor for redirector
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Multi Devices and Multilanguage

2011-06-29 Thread Zoran Avtarovski
We use a custom sitemesh decorator for each targeted platform and also a
custom struts theme for each.

This way we use the same core jsp files across the application. By keeping
the JSP functionality simple we find it works really well.

I hate to be the one who breaks it to you but you'll have to do some work
arounds. For example we have a number of key navigation pages which are
quite different for each of the platforms (mobile, tablet, web) and as
such require more work. The action classes have to know the targeted
platform to setup the appropriate data objects.

As for multi-lingual development we use a database backed localised text
system. We've had no issues with it. Having said that we are about to
start on an Arabic language version, which should be a lot of fun ;). Same
principle as above applies, use the S2 localised text wherever possible
and be prepared to create some custom CSS and decorator files for
non-latin based languages.

Z.




On 30/06/11 1:28 AM, "Frans Thamura"  wrote:

>hi all
>
>we want to create a multi devices rendering for our apps, which we use
>struts2, for mobile, tablet and web common, we use jquery mobile, i like
>the
>JQM beta1.
>
>and we also want to make web with multi language
>
>anyone can share the strategy which we can start to make this
>
>F



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 and FTP (php) editors integration

2011-06-14 Thread Zoran Avtarovski
Why don't you use the Java versions of the CK Software. We have no issues
with either CKEditor or CKFinder.

Z.

On 15/06/11 5:27 AM, "webmeiker"  wrote:

>I mean use of CKEditor, CKFinder or ElFinder 3rd party software (based in
>PHP) that allow server file exploration inside a Struts2 application...
>
>2011/6/14 Dave Newton 
>
>> Oh, OP meant embedding an HTML component in an S2 I guess. Duh, never
>>mind.
>>
>> Dave
>>  On Jun 14, 2011 12:07 PM, "Brian Thompson" 
>>wrote:
>> > You sure that isn't the File FTP Protocol? :P
>> >
>> > Redundancy FTW!
>> >
>> > -Brian
>> >
>> >
>> > On Tue, Jun 14, 2011 at 11:01 AM, Dave Newton 
>> wrote:
>> >> On Tuesday, June 14, 2011, webmeiker wrote:
>> >>> Have somebody successfully integrated a Struts2 app with some
>>(web)FTP
>> >>> editor (based in PHP) like ElFinder?
>> >>>
>> >>> I always get responses like ŒInvalid backend configuration¹,
>>ŒInvalid
>> XML
>> >>> Response¹ or things like that.
>> >>
>> >> S2 doesn't implement the FTP protocol out-of-the-box. How are you
>> >> trying to do this?
>> >>
>> >> Dave
>> >>
>> >> -
>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> >> For additional commands, e-mail: user-h...@struts.apache.org
>> >>
>> >>
>> >
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> >
>>
>
>
>
>--



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: OT: Arabic Website

2011-06-02 Thread Zoran Avtarovski
Thanks Tito,

That's the sort of stuff I'm after. The struts/java specific stuff I'm
fine with, it's more the presentation (HTML/CSS) that I need help with.

Z. 

On 2/06/11 4:55 PM, "tito"  wrote:

>hi,
>
>struts Application Resources,Struts locale .. and UTF-8 encoding is the
>place to start.. also you also have take care of the  RTL ( right to left
>)
>layout in ur web app. this explains the RTL >
>http://www.w3.org/International/tutorials/bidi-xhtml/
>
>
>regards,
>Tito Cheriachan
>http://about.me/tito
>
>
>
>On Thu, Jun 2, 2011 at 10:49 AM, Zoran Avtarovski
>wrote:
>
>> We have a multi-lingual website that we have developed using struts that
>> only uses English and European languages.
>>
>> We'd like to add Arabic to the site and was hoping somebody might have
>>some
>> pointers for where to start.
>>
>> Z.
>>
>>
>>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



OT: Arabic Website

2011-06-01 Thread Zoran Avtarovski
We have a multi-lingual website that we have developed using struts that
only uses English and European languages.

We'd like to add Arabic to the site and was hoping somebody might have some
pointers for where to start.

Z.




Re: Pagination using Struts library

2011-05-18 Thread Zoran Avtarovski
You'll need to make some mods for displaytag to work with S2.

1. You'll need to add an acceptableParameterName method to your classes,
we just add it to our base class.
2. You have to add the Displaytag responseOverrideFilter to your web.xml
for the export to work

Having said all that, we are moving away from display tag and to jQuery
Datatables. Honestly our life has become so much easier since we started
incorporating more client side javascript. The code is easier to follow,
ajax calls make security a breeze and the server load is considerably
lighter.

Z.

On 14/05/11 12:04 AM, "Miguel"  wrote:

>Speaking of which, Dave, have you used displaytag recently?
>
>It seems to have been abandoned. It's good for regular usage, but as
>time goes by we start having some problems.
>
>For example, with the export options (displaytag can export to excel,
>pdf, etc automatically) we see a ognl WARN:
>
>WARN  [CommonsLogger.java:60] : Error setting expression '6578706f7274'
>with value '[Ljava.lang.String;@385b5df0'
>ognl.ExpressionSyntaxException: Malformed OGNL expression: 6578706f7274
>[ognl.ParseException: Encountered "  "7274 "" at line 1,
>column 9.
>
>This is due to the fact that displaytag's export url is
>Someaction.action?6578706f7274=1&d-16533-e=5 and 6578706f7274 doesn't
>seem to be valid on recent versions.
>
>Miguel Almeida
>
>
>Dave,On Wed, 2011-05-11 at 08:06 -0400, Dave Newton wrote:
>
>> 
>> DisplayTag is open-source, BTW. 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Extending Template Error

2011-04-26 Thread Zoran Avtarovski
Hi guys,

I'm having a couple of issues with my freemarker tempates.

One is with extending the 'simple; theme. I have setup a custom theme which
has a theme.properties file containing a single line, parent=simple

The problem I'm having is that it can't find the simple directory.
Freemarker keeps throwing an error. I had to create a freemarker template
file with an include of the simple template, <#include
"/${parameters.templateDir}/simple/fielderror.ftl" />.

My struts.xml file contains . I don't know why it's not working. We recently upgraded
to 2.2.1 but I'm not certain if the problem existed prior to that.

The other problem I have is trying to use the s:checkbox tag as opposed the
the checkboxlist tag. I need to create a customised checkbox display and I
want to use the following code:

 
  


But the checkbox doesn't reflect the checkBoxArray value in the action. It
works when I use the s:checkboxlist tag, but I need finer control.

Any help on either issue would be appreciated.

Z.




Re: Struts 2 - s:text garbled

2011-01-09 Thread Zoran Avtarovski
Hi Rubens,

I've had a similar issue foreign text was displayed as rubbish) not just
with the latest version but the last few. The difference is that we use
sitemesh not tiles.

In the what I found was that I had to change the filter order in my
web.xml. To be honest I couldn't see why this should have an impact but it
did and as I'm sure you're aware after a while you're just happy to have a
fix.

Here's the snippet of my web.xml I changed:


struts-prepare

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter


struts-execute

org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter


sitemesh

com.opensymphony.module.sitemesh.filter.PageFilter


struts-prepare
/*
REQUEST
FORWARD


sitemesh
/*
FORWARD
REQUEST


struts-execute
*.action
REQUEST
FORWARD


struts-execute
/struts/*
REQUEST
FORWARD




I hope this helps.

Z.

On 8/01/11 10:27 AM, "Rubens Gomes"  wrote:

>No.  I use Struts-2 resource bundle only. And I am running my application
>on Tomcat 6 with JDK 1.6.  I use titles though.  And below is a page that
>I have problem.  
>
>If I remove the first line <%@ page ... %>, name="pageTitle.common"> renders the correct characters to the page.
>
>
><%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
>language="java" %>
>
><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
><%@ taglib prefix="s" uri="/struts-tags" %>
><%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles";  %>
>
>
>  namespace="/ssl/security" action="login" />
>  
>
>
>EZLista - name="pageTitle.common" />
>
>
>
>
>/
>
>name="${sessionScope.userSession.browser}.home.definition">
>  name="title">${requestScope.pageTitle}
>
>
>
>-Original Message-
>From: Dave Newton [mailto:davelnew...@gmail.com]
>Sent: Friday, January 07, 2011 6:19 PM
>To: Struts Users Mailing List
>Subject: Re: Struts 2 - s:text garbled
>
>Are you using a custom ResourceBundle that handles non-encoded files? Or a
>ResourceBundle.control?
>
>Otherwise I'd assume the default XWork/S2 resource bundle isn't the one
>that
>takes an encoding argument, which is a 1.6 (?) thing, so I'd have no
>problem
>believing that was the case.
>
>Dave
>
>On Fri, Jan 7, 2011 at 6:06 PM, Rubens Gomes 
>wrote:
>
>> No. I do not use native2ascii.  The resource is saved/stored under the
>> UTF-8 character set.  Because I edit my resource files from within
>>Eclipse,
>> and I have preferences set to UTF-8.
>>
>> Another piece of information, I know that if I convert the resource
>>file to
>> Unicode characters and save it.  Then, the page is rendered okay having
>>the
>> pageEncoding tag on the JSP.
>>
>>
>>
>> -Original Message-
>> From: Dave Newton [mailto:davelnew...@gmail.com]
>> Sent: Friday, January 07, 2011 6:03 PM
>> To: Struts Users Mailing List
>> Subject: Re: Struts 2 - s:text garbled
>>
>> Out of curiosity, did you try after using the native2ascii (or whatever
>> it's
>> called) tool?
>>
>> (I've never actually tried non-encoded resource files, but I'm usually
>> using
>> a tool to create them, so I'm not always sure what I'm actually ending
>>up
>> with, because I'm lazy.)
>>
>> Dave
>>
>> On Fri, Jan 7, 2011 at 5:51 PM, Rubens Gomes 
>> wrote:
>>
>> > Hello,
>> >
>> > I already spent several hours on this problem.   And I have done some
>> > search on the mailing lists as well.
>> >
>> > I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP
>>plugin
>> > (2.2.2), and I running into a problem with rendering garbled foreign
>> > characters from s:text.  If I remove the pageEncoding tag from the
>>top of
>> > the JSP page, the  works okay.
>> >
>> > This line when added to the top of the JSP causes  to
>>render
>> > incorrect garbled Portuguese characters.
>> >
>> > <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
>> > language="java" %>
>> >
>> > All my resource files are saved in UTF-8.  And so is my JSPs.  And I
>>also
>> > have the following on all pages.
>> >
>> > 
>> >
>> > And I have following settings too:
>> >
>> > struts.xml:
>> > ...
>> > 
>> > ...
>> >
>> > freemaker.properties:
>> > default_encoding=UTF-8
>> >
>> >
>> > --
>> > Rubens
>> >
>> >
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: execAndWait Interceptor

2010-12-16 Thread Zoran Avtarovski
Sorry about the delayed response. I have been busy with xmas crap (ba
humbug).

The way we implement an ajax solution is to create a new thread, with a flag
stored in the session and poll the server using a jquery ajax call every 10
seconds. The ajax call returns a json response which has the flag value as
its first item and then relevant data if the process is complete.

The beauty of this is we have no page refreshes and when the process is
complete use the ajax response to either display the info or a link to the
report.

Z.


On 14/12/10 7:06 PM, "RogerV"  wrote:

> 
> 
> 
> Sparecreative wrote:
>> 
>> We use the interceptor for interrogating a legacy database where we have
>> no control over the execution or timing of the query.
>> 
>> We basically have an API we call and then wait in hope.
>> 
>> I have to say that I've found the interceptor to be inconsistent at best.
>> 
>> For example we have some queries that are actually quite quick but the
>> interceptor insists on doing at least one page refresh before returning a
>> result. We've tried tweaking all the setting with absolutely no joy.
>> 
>> On the last project, we actually implemented an ajax solution which was
>> far more elegant result.
>> 
> 
> Are there any pointers or code samples available to show how to implement an
> ajax exec & wait?
> 
> Regards



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: execAndWait Interceptor

2010-12-13 Thread Zoran Avtarovski
We use the interceptor for interrogating a legacy database where we have
no control over the execution or timing of the query.

We basically have an API we call and then wait in hope.

I have to say that I've found the interceptor to be inconsistent at best.

For example we have some queries that are actually quite quick but the
interceptor insists on doing at least one page refresh before returning a
result. We've tried tweaking all the setting with absolutely no joy.

On the last project, we actually implemented an ajax solution which was
far more elegant result.

Z.

On 10/12/10 3:11 AM, "stanl...@gmail.com"  wrote:

>Does anyone actually use this interceptor?  I have a team asking me about
>it's use in production and how this solution would compare to a jQuery
>solution.  I played around with it lst night and am skeptical about it.
>For
>one thing, the documentation says
>
>"The ExecuteAndWaitInterceptor is great for running long-lived actions in
>the background while showing the user a nice progress meter. This also
>prevents the HTTP request from timing out when the action takes more than
>5
>or 10 minutes."
>
>and a request like that would get me fired!
>
>Peace,
>Scott



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Spring 3 Upgrade

2010-12-02 Thread Zoran Avtarovski
I just wanted to check if there were any issues with upgrading spring to
version 3 with struts 2.2.1?

I notice the complete download still has Spring 2.5 libraries.

I'd appreciate any feedback from people who've made the jump and any issues
to look out for.

Z.




Re: Calling OGNL static method with date issue

2010-12-01 Thread Zoran Avtarovski
I have a feeling you have to use  is set with a  tag
Or 
 if set
with a  tag.

The other option, which I know works, is to expose a method on your action
which you can then access via OGNL.

Z.

On 1/12/10 6:19 AM, "Ken McWilliams"  wrote:

>In my jsp I have two dates ("today" and "expiryDate") the following
>works in the JSP:
>
>
>
>Now I created two static methods (In a Class called
>dateUtils.DateRange):
>/* Calling the following from my JSP:
>*
>* Works just fine...
>*/
>public static int numTest(int num) {
>   return num + 5;
>}
>
>/* Calling the following from my JSP:
>* 
>* DOES NOT WORK
>*/ 
>public static Date dateTest(Date date) {
>   date.setYear(1900);
>   return date;
>}
>
>Anyone know what's going wrong?
>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Link Display Logic

2010-11-30 Thread Zoran Avtarovski
With OGNL you can call specific methods. So in my base action I have the
following:

public boolean isUserAuthorised(Integer actionId){
 // here I get a handle to the authorisation code and test
 // if the current user is authorised to execute the action
 // if the user is aurthorised return true else return false
}

Then on my page I have the following


Hope it helps.

Z.

On 1/12/10 3:16 AM, "Biesbrock, Kevin"  wrote:

>I figured it out.  My interceptor was returning null instead of
>invocation.invoke()...n00b mistake. :)
>
>In your example, you invoke a specific method "isUserAuthorized()".
>What is the method named in your action?  Is it "getIsUserAuthorized"?
>I have an action method "isAuthorized" and I have to invoke it e.g.,
>.  If I change 'authorized' to
>'isAuthorized', then my else block is executed.
>
>
>Beez
>r 5347 
>
>-----Original Message-
>From: Biesbrock, Kevin
>Sent: Tuesday, November 30, 2010 11:06 AM
>To: 'Zoran Avtarovski'; 'Struts Users Mailing List'
>Subject: RE: Link Display Logic
>
>Thank you for the suggestion, Zoran! I guess I'm doing somewhat of a
>combination of what you and Dave suggested.
>
>I've been utilizing the Aware interfaces for my actions...I think it's
>similar to what you're suggesting with your base action class, just a
>different approach, if I understand correctly.  The difference is that
>our UserInterceptor determines authorization level and sets the level on
>the action via a UserAware interface with a setAuthorizationLevel
>method.
>
>Then I have a jsp fragment that checks if they have the required
>authorization level.  That jsp fragment is being included similarly to
>what I think Dave was suggesting, just using the standard s:action tag
>instead of writing my own custom tag.
>
>For some reason my s:action is being executed successfully, but it's not
>including the jsp fragment in my main jsp.  I have the
>executeResult="true" attribute set.  It worked for a minute and now it
>seems to just neglect to include it.  I'm working on that right now.
>
>Thank you again for your suggestions!  It definitely seems to be
>pointing me in a good direction! :)
>
>Sincerely,
>
>Beez
>
>-Original Message-
>From: Zoran Avtarovski [mailto:zo...@sparecreative.com]
>Sent: Monday, November 29, 2010 6:45 PM
>To: Struts Users Mailing List; Biesbrock, Kevin
>Subject: Re: Link Display Logic
>
>What we have implemented is a set of public authorisation methods in our
>base action which we call via ognl passing the actionId as the
>parameter.
>For example to test if a user should be shown the print report we have a
>isUserAuthorised(Integer actionId) method which we use as follows:
>Your stuff in here
>
>I have to say that I think this is one of the best aspects of OGNL as
>we're easily able to easily use server side authorisation with simple
>ajax calls.
>
>Z.
>
>On 30/11/10 5:41 AM, "Biesbrock, Kevin" 
>wrote:
>
>>Hello users.  I'm Kevin, first time caller, long time listener (Mr.
>>Obvious reference).
>> 
>>I have two reports and need to display a link for each if the following
>
>>conditions are met:
>>1. The user is authorized to view the reports (they are secured),
>>and
>>2. The specific report currently exists
>> 
>>Both of these conditions are determined via predefined methods (they
>>are "black boxes" to me).
>> 
>>Following the MVC pattern, what is the best way to split up the display
>
>>logic of this such that my links are displaying to the appropriate
>>users when they exist?
>> 
>>The links will display on the home page.  So I thought about
>>determining these factors in the home action and wrapping s:if tags
>>around links to the reports.  It seems simple enough, I was just
>>curious if there was a different and/or better approach.
>>
>>Thank you for your time,
>>Kevin - "Beez"
>
>
>
>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Link Display Logic

2010-11-29 Thread Zoran Avtarovski
What we have implemented is a set of public authorisation methods in our
base action which we call via ognl passing the actionId as the parameter.
For example to test if a user should be shown the print report we have a
isUserAuthorised(Integer actionId) method which we use as follows:
Your stuff in here

I have to say that I think this is one of the best aspects of OGNL as
we're easily able to easily use server side authorisation with simple ajax
calls.

Z.

On 30/11/10 5:41 AM, "Biesbrock, Kevin"  wrote:

>Hello users.  I'm Kevin, first time caller, long time listener (Mr.
>Obvious reference).
> 
>I have two reports and need to display a link for each if the following
>conditions are met:
>1. The user is authorized to view the reports (they are secured),
>and
>2. The specific report currently exists
> 
>Both of these conditions are determined via predefined methods (they are
>"black boxes" to me).
> 
>Following the MVC pattern, what is the best way to split up the display
>logic of this such that my links are displaying to the appropriate users
>when they exist?
> 
>The links will display on the home page.  So I thought about determining
>these factors in the home action and wrapping s:if tags around links to
>the reports.  It seems simple enough, I was just curious if there was a
>different and/or better approach.
>
>Thank you for your time,
>Kevin - "Beez"



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Character Encoding Error using new filters

2010-10-20 Thread Zoran Avtarovski
I have set UTF-8 as the default everywhere - struts, tomcat, sitemesh.

I had a small breakthrough. It looks like  it's a 2.1.6 specific issue. I
updated a development version to 2.1.8 and 2.2.1 and both worked fine. I
now have to find time to test the updated version for unintended
consequences. 

Are there any issues I should look out for in particular when going from
2.1.6 to 2.2.1?

Z.

On 19/10/10 2:42 AM, "Dave Newton"  wrote:

>That defines the encoding of the web.xml file itself...
>On Oct 18, 2010 10:32 AM, "Martin Gainty"  wrote:
>>
>> Hi Zoran
>>
>> can you confirm the encoding attribute at the top of your web.xml e.g.
>> 
>>
>> in which case you *should* be able to map
>> U+00C6Æc3 86LATIN CAPITAL LETTER AE
>> http://www.utf8-chartable.de/
>>
>> please confirm
>> Martin Gainty
>> __
>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>dient lediglich dem Austausch von Informationen und entfaltet keine
>rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>>le
>destinataire prévu, nous te demandons avec bonté que pour satisfaire
>informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
>copie
>de ceci est interdite. Ce message sert à l'information seulement et n'aura
>pas n'importe quel effet légalement obligatoire. Étant donné que les email
>peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>aucune responsabilité pour le contenu fourni.
>>
>>
>>
>>
>>
>>> Date: Mon, 18 Oct 2010 12:05:56 +1100
>>> Subject: Character Encoding Error using new filters
>>> From: zo...@sparecreative.com
>>> To: user@struts.apache.org
>>>
>>> I have a really strange character encoding error that is appearing
>>>when I
>>> attempt to change my struts2 filter configuration from:
>>>
>>> 
>>> struts-cleanup
>>>
>>>
>org.apache.struts2.dispatcher.ActionContextCleanUpla
>>> ss>
>>> 
>>> 
>>> struts
>>>
>>>
>org.apache.struts2.dispatcher.FilterDispatcher>
>>> 
>>> 
>>> sitemesh
>>>
>>>
>com.opensymphony.module.sitemesh.filter.PageFilterla
>>> ss>
>>> 
>>>
>>> 
>>> struts-cleanup
>>> /*
>>> 
>>> 
>>> sitemesh
>>> /*
>>> 
>>> 
>>> struts
>>> /*
>>> 
>>>
>>>
>>> To
>>>
>>> 
>>> struts-prepare
>>>
>>>
>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter<
>/f
>>> ilter-class>
>>> 
>>>
>>> 
>>> sitemesh
>>>
>>>
>com.opensymphony.sitemesh.webapp.SiteMeshFilters>
>>> 
>>>
>>> 
>>> struts-execute
>>>
>>>
>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter<
>/f
>>> ilter-class>
>>> 
>>>
>>> 
>>> struts-prepare
>>> /*
>>> 
>>>
>>> 
>>> sitemesh
>>> /*
>>> REQUEST
>>> FORWARD
>>> INCLUDE
>>> 
>>>
>>> 
>>> struts-execute
>>> /*
>>> 
>>>
>>>
>>> With only this change when I enter a 'æ' character (and e together) it
>>> appears a A!|! (garbage). Clearly there is a character encoding issue
>here.
>>> The whole app as well as Tomcat is encoded to UTF-8.
>>>
>>> What am I missing here. Please help!!!
>>>
>>> Z.
>>



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: give suggestion data display base on the Locale

2010-10-18 Thread Zoran Avtarovski
I think you¹re missing the point.

 Instead of:


Use 



Z.


> please understand this:
> 
> 
> 
> 
> 
> 
> 
> 
> listValue is a values of list. i am using iterator to traverse the list. now
> on listValue, i want to put here internationalization concept.so that all
> the list value can be display based on Locale which store in a list. please
> suggest!
> 
> 
> Li Ying-2 wrote:
>> > 
>> > You can call method [getText("activity.name")] to
>> > retrieve localized string.
>> > 
>> > Read this document for more information:
>> > http://struts.apache.org/2.2.1/docs/localization.html
>> > 
>> > 
>> > 
>> > 
>> > 2010/10/15 singh123 :
>>> >>
>>> >> 
>>> >> 
>>> >>        
>>> >>        
>>> >> 
>>> >> 
>>> >>
>>> >> listObject is a Linked list object. listValue and listIndex is of Object
>>> >> type.
>>> >> i have two properties file:
>>> >>
>>> >> messages.properties:
>>> >> activity.name=activity
>>> >>
>>> >> messages_fr.properties:
>>> >> activity.name=activity_fr
>>> >>
>>> >>  i want to add Localization feature so that when Linked list populate and
>>> >> display, it show text based on the Locale.
>>> >>  please suggest in this regard.
>>> >> --
>>> >> View this message in context:
>>> >> 
>>> http://old.nabble.com/give-suggestion-data-display-base-on-the-Locale-tp2997
>>> 1062p29971062.html
>>> >> Sent from the Struts - User mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >> -
>>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> >> For additional commands, e-mail: user-h...@struts.apache.org
>>> >>
>>> >>
>> > 
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> > 
>> > 
>> > 



Character Encoding Error using new filters

2010-10-17 Thread Zoran Avtarovski
I have a really strange character encoding error that is appearing when I
attempt to change my struts2 filter configuration from:


struts-cleanup

org.apache.struts2.dispatcher.ActionContextCleanUp


struts

org.apache.struts2.dispatcher.FilterDispatcher


sitemesh

com.opensymphony.module.sitemesh.filter.PageFilter



struts-cleanup
/*


sitemesh
/*


struts
/*



To


struts-prepare

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter



sitemesh

com.opensymphony.sitemesh.webapp.SiteMeshFilter



struts-execute

org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter



struts-prepare
/*



sitemesh
/*
REQUEST
FORWARD
INCLUDE



struts-execute
/*



With only this change when I enter a 'æ' character (and e together) it
appears a A!|! (garbage). Clearly there is a character encoding issue here.
The whole app as well as Tomcat is encoded to UTF-8.

What am I missing here. Please help!!!

Z.


Re: Re : s:url tag - multiple params with same name

2010-08-11 Thread Zoran Avtarovski
I haven¹t tried it but I suspect that if you use a list it should work.

Something like this:

 



Z.

> 
> On Fri, 06 Aug 2010 17:12:10 -0400, François Rouxel 
> wrote:
> 
>> > should be working, did you put in s:url tag includeParameters='get' ?
>> >
> 
> Yes, although I don't think that's what includeParams is used for - here's
> my actual code:
> 
> 
>  
>  
>  
> 
> 
> URL 1: 
> 
> 
> and here's the result:
> 
> URL 1: a.b?pn=thirdval
> 
> I'm using Struts 2.0.11
> 
> Steve



Re: OGNL Qurey

2010-07-29 Thread Zoran Avtarovski
Hi Dale,

This sounds too easy, so I just want to clarify. From my action if I call
findValue(myExpressionString) and it will use OGNL to evaluate the
expression.

That¹s fantastic and exactly what I was looking for.

I¹ll try it this weekend.

Z.
> 
> On Thu, Jul 29, 2010 at 10:07 PM, Dale Newfield  wrote:
>> > On 7/29/10 9:50 PM, Zoran Avtarovski wrote:
>>> >>
>>> >> What I want to know if there is a way for OGNL to evaluate the expression
>>> >> represented by the string through recursion?
>> >
>> > I see no reason you can't get a reference to the ValueStack object from
>> > within OGNL and call the findValue() method to make that happen.
> 
> That wasn't very clear.  What I should have said is that you could
> easily make an eval() method on your action that just grabs the
> ValueStack and calls findValue().
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



OGNL Qurey

2010-07-29 Thread Zoran Avtarovski
I¹m trying to construct a conditional display mechanism for a web app, but I
need some help with the OGNL side of things.

My app will produce a string like ³object1.attribute == 25 && object2.
attribute > 5²  and store it as a parameter in my action called condition.

What I want to know if there is a way for OGNL to evaluate the expression
represented by the string through recursion?

Before anybody mentions it, I know the risk, but the way the string is
constructed will protect against injected code.

Z.


Re: REST URLs

2010-07-27 Thread Zoran Avtarovski
Another option that doesn¹t tie you down to the REST plugin is to use the
URL Rewrite Filter ( www.tuckey.org/urlrewrite/)

We¹ve been using this for a while without any issues.

Z.
> 
> Is there anyway we can use /client/{clientId}/business/{businessId} kind of
> URLs in Struts 2.0?
> 
> -- AB



Re: how to set default focus field in ?

2010-05-13 Thread Zoran Avtarovski
As a simple solution, why not just modify the form tag template and if the
focusElement parameter is set, include a simple javascript block at the
close of the form to set the focus. Just keep in mind that if there are two
forms on a page and both have the focusElement parameter set only the last
will be relevant.

The advantage being you can use javascript code to match your environment ­
jQuery, Dojo, pure javascript, etc.

Z.

> 
> I recommend attaching the focus to the relevant form element purely
> using Javascript,
> 
> ie, including in you JSP :
> 
> window.onload = function() {
>  document.getElementById('yourInpudId').focus();
> }
> 
> 
> That way you have a pure javascript implementation, and you can push
> that code to the relevant JSP without having to mess up with your template.
> 
> My second recommendation is to use a Javascript framework, instead of
> the plain and ugly javascript as up there (since the example above will
> break if you want to attach more than one thing to the onload).
> So rewritten with jquery ( http://jquery.com/ )
> 
> $(document).ready(function() {
>$('yourInpudId').focus();
> });
> 
> 
> But the idea is the same in both case, do the focus purely in Javascript.
> 
> Denis.
> 
> Le 2010-05-12 14:53, Emi Lu a écrit :
>> >
 >>> By using tiles,  is in global_layout.jsp page, for decedent
 >>> pages,
 >>> I will not be able to set body onload.
 >>>
>>> >>
>>> >> Admittedly I don't know tiles, but Sitemesh will copy the body onLoad
>>> >> and
>>> >> unload functions to the decorating page and I would be suprised if Tiles
>>> >> didn't support this as well.
>> >
>> > For the global page.jsp: if body onload is set, it's for all
>> > decedents; no, I do not want that.
>> >
>> > (1) Do not bother to create several parents layout files
>> > (2) Only one file needs default focus;
>> > Other hundreds of .jsp foucs will be set differently or
>> > not set at all
>> >
>> > So, I do need s:form to support focus.
>> >
>> > -- 
>> > Lu Ying
>> >
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> >
>> >
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: Jquery autocomplete with struts2.

2010-04-22 Thread Zoran Avtarovski
I hate to be the one to say it, but I don¹t think the issue here is jQuery
but your understanding of Struts2.

I think you first need to get your head around using S2 and then migrating
that simple php example will be easy.

You fill find the only difference between the PHP example and using a json
response is that the PHP example converts the data to json in the page
context.

Z.
> 
> Hi All,
>  
>   Say I have java "arraylist" in action and how to set this in resonse object
>  
>   ServletActionContext.setResponse()
>  
>   How to do this in struts2??
>  
> Thanks,
> Sharath.
> 
> --- On Thu, 4/22/10, sharath karnati  wrote:
> 
> 
> From: sharath karnati 
> Subject: Re: Jquery autocomplete with struts2.
> To: "Struts Users Mailing List" 
> Date: Thursday, April 22, 2010, 3:36 PM
> 
> 
> Please find below example
>  
> http://makhaer.blogspot.com/2008/12/jquery-autocomplete.html
>  
> in this example, he is just using jquery with textfield for doing autocomplete
> with PHP. I'd like to do samething with struts2 action.
>  
> Can anyone please let me know, how to send data from action to .jsp to display
> autocomplete rather than using another plug-ins.
>  
> Thanks,
> Sharath.
> 
> --- On Thu, 4/22/10, Johannes Geppert  wrote:
> 
> 
> From: Johannes Geppert 
> Subject: Re: Jquery autocomplete with struts2.
> To: user@struts.apache.org
> Date: Thursday, April 22, 2010, 2:29 PM
> 
> 
> 
> Hello,
> 
> since version 2.0.0 the Struts2 jQuery Plugin have a autocompleter tag.
> This is an easy way to implement an Autocompleter.
> 
> See:
> http://code.google.com/p/struts2-jquery/wiki/AutocompleterTag
> 
> Best Regards
> 
> Johannes Geppert
> 
> 
> sharath wrote:
>> > 
>> > Hi All,
>> >  
>> >    I'm trying to use Jquery autocomplete with struts2. The example for
>> > using Jquery autocomplete is given below(link)
>> >  
>> >    http://makhaer.blogspot.com/2008/12/jquery-autocomplete.html
>> >  
>> >    In this example, author is returning data with .php similarly I'd like
>> > to return data from struts2 action(not with json object)
>> >  
>> >    Can anyone please let me know how to return data from struts2 action
>> > for accomplishing same thing.
>> >  
>> >    Thanks in advance.
>> >  
>> > Regards,
>> > Sharath.
>> > 
> 
> 
> -
> ---
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep



Re: World¹s Simplest Struts/2 Ajax Pattern

2010-04-06 Thread Zoran Avtarovski
While I appreciate what you¹re saying, we¹ve found that by moving to one of
the javascript libraries (we use jQuery, but they all offer pretty much the
same range and depth) for all our ajax work, the task has been simplified
immensely.

Also, by moving away from the S2 ajax tags, we¹ve found that it has been
easier to manage features and libraries.

I guess what I¹m saying is that sometimes it¹s worth stepping back to see if
we¹re just not reinventing the wheel. I make no secret of the fact that I
find the S2 built in ajax support to be a wasted effort.

Z.
> 
> 
> After answering similar questions regarding Struts/2 and Ajax on several
> forums, I have decided to write an actual paper on the topic.  While I
> figure out where to publish "papers" I am dropping the link here.
> 
> http://struts2inaction.com/SimpleAjax.html World¹s Simplest Struts/2 Ajax
> Pattern 
> 
> Peace,
> Scott



Re: Pagination with Struts 2.1.8 ?

2010-03-29 Thread Zoran Avtarovski
We use display tag extensively and it ties into S2 really well.

We¹ve set it up to use DB based pagination so you only load the items you
need and it ties into S2 i18n properties.

We also use jqGrid which is based on jQuery and works really well where you
want ajax based tables.

Z.
> 
> Thanks. I already read about it but does it work well with Struts 2 ?
> 
> 
> --- On Mon, 3/29/10, Alex Rodriguez Lopez  wrote:
> 
> 
> From: Alex Rodriguez Lopez 
> Subject: Re: Pagination with Struts 2.1.8 ?
> To: user@struts.apache.org
> Date: Monday, March 29, 2010, 4:32 AM
> 
> 
> Display tag, works like a charm:
> 
> http://displaytag.sourceforge.net/1.2/tut_basic.html
> 
> Works with lists and handles pagination, data export, I recommend it!
> 
> Em 29-03-2010 11:07, Celinio Fernandes escreveu:
>> > Hi,
>> > This is a classic requirement.
>> > I have this table, in a JSP, that I have created with the  html tag
>> and that i have filled using the.
>> > This  tag iterates over an ArrayList defined in my action.
>> > There are too many lines and I need to add some pagination functionality to
>> it.
>> > What solutions are out there and which one do you recommend ?
>> > Thanks for your feedback.
>> >
>> >
>> >
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 
> 



Re: Translation Properties

2010-03-28 Thread Zoran Avtarovski
When you get to that scale, I think it makes sense to move to DB based
properties. Easier to manage, easier to move and less chance that something
will go pear shaped.

You can also build yourself a nice interface for managing the translations
that will be portable across all you apps.

Z.
> 
> 
> I was curious if anyone else has come across a wonderful tool to help
> manage your applicationMessages translations for the various locales you
> use in your Struts applications?  Our project continues to expand into
> other locales and trying to manage upwards of 15+ languages with over
> 3000 messages per locale is getting to be a slight headache.
> 
> Chris
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: [Struts 2.1.8.1] Internationalization: how to remain in the current page ?

2010-03-28 Thread Zoran Avtarovski
Hi Guys,

We simplified it for struts to use a simple interceptor.  Can¹t show the
exact code due to legal crap, but here¹s the overview.

In our base action we have a String called requestString, with appropriate
getters and setters. We also have a Map of unsafe URL¹s and
their safe counterparts. For example if the unsafe url was
deleteObject.action it¹s safe option would be listObject.action

The interceptor uses the following code:

if(unsafeUrls.get(request.getRequestURI()) != null)
responseUrl = unsafeUrls.get(request.getRequestURI());
else
responseUrl = request.getRequestURI();


StringBuffer rStr = new StringBuffer(responseUrl);
rStr.append(³?²);
for (Iterator iter = request.getParameterMap().keySet().iterator();
iter.hasNext();) {
> String key = (String) iter.next();
> if (!"request_locale".equalsIgnoreCase(key)) {
> if (request.getParameter(key) != null) { // you can also include
> your own parameter specific exceptions. With the tag we used to have a comma
> delimited list of excluded parameters.
> rStr.append(key);
> rStr.append("=");
> rStr.append((String) request.getParameter(key));
> rStr.append("&");
> }
 }
}

action.setRequestString(sStr.toString());



And then on the page we have:

"
 title=""
/>


I had to modify the code to satisfy our people but let me know if you have
any questions. We use a complex parameter filtering process to unsure that
security isn¹t compromised.

We¹ve had to do quite a bit of i18n which has involved implementing DB based
properties and tighter integration with S2 and spring.

Z.
> 
> 
> 
> 
> Hi Zoran,
> 
> would you mind sharing the code of this tag? It would be helpful to me,
> as somehow I've been able to link to the same sction with an empty url
> tag but unable to retain params. Thanks!
> 
> Em 24-03-2010 22:42, Zoran Avtarovski escreveu:
>> > I wrote a small custom tag which builds the link with the existing action
>> > and parameters. This way it just reloads the page. I also included a
>> > parameter that wouldn¹t allow the change (a jQuery dialog would give the
>> > user feed back) to take place if there might me an issue with system
>> > integrity ­ for example submitting a form twice.
>> >
>> > Z.
>>> >>
>>> >> hi,
>>> >> I have a quick and basic question.
>>> >> Regarding internationalization, whenever a user clicks on a link with a
>>> flag,
>>> >> i want to change the locale (language)
>>> >> of the web application.
>>> >> That works well with the i18n interceptor.
>>> >> However i always redirect the user to the home page (home.jsp) when i do
>>> that
>>> >> because that is how i have setup the input result :
>>> >> >> >>   method="changeLocale">
>>> >>/home/home.jsp
>>> >> 
>>> >>
>>> >> My JSP looks like this :
>>> >> 
>>> >>   fr
>>> >>  
>>> >>  >> >> src="<%=request.getContextPath()%>/images/flag_fr.png" />
>>> >>
>>> >> So my question is :
>>> >> how do you specify the current page in the input result name ?
>>> >> so that the user stays on the current page when he changes languages.
>>> >> Thanks for helping.
>>> >>
>>> >>
>> >
>> >
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: [Struts 2.1.8.1] Internationalization: how to remain in the current page ?

2010-03-24 Thread Zoran Avtarovski
I wrote a small custom tag which builds the link with the existing action
and parameters. This way it just reloads the page. I also included a
parameter that wouldn¹t allow the change (a jQuery dialog would give the
user feed back) to take place if there might me an issue with system
integrity ­ for example submitting a form twice.

Z.
> 
> hi,
> I have a quick and basic question.
> Regarding internationalization, whenever a user clicks on a link with a flag,
> i want to change the locale (language)
> of the web application.
> That works well with the i18n interceptor.
> However i always redirect the user to the home page (home.jsp) when i do that
> because that is how i have setup the input result :
>          method="changeLocale">
>   /home/home.jsp
>    
>    
> My JSP looks like this :
> 
>  fr
> 
>  src="<%=request.getContextPath()%>/images/flag_fr.png" />  
>    
> So my question is :
> how do you specify the current page in the input result name ?
> so that the user stays on the current page when he changes languages.
> Thanks for helping.
> 
> 



S1 Quirk with html tag

2009-12-09 Thread Zoran Avtarovski
Yesterday I had to go back and update some changes to struts 1 app we
developed and are maintaining.

It¹s been a while since I¹ve done any struts1 work but it was urgent and
resources are thin in the lead up to xmas.

Anyway, my question is that I have two identical forms with identical
configuration, but one works fine if the form elements don¹t have a name
attribute and the other doesn¹t.To illustrate one form works with the
following tag:



But the second form only works when a name attribute is included:



I¹d appreciate any insight into why this happens, as it caused me about 8
hours extra work, frustration and a little less hair leading up to the
holidays.

Z.


Re: [Struts 2.1.8] datetimepicker and action: String or Date ??

2009-11-16 Thread Zoran Avtarovski
HI Fernando,

For what it¹s worth in applications where we have a diverse range of locales
we found that it was best to create our own date converter.

The date converter then reads our properties file which contains an entry
with a comma delimited list of date formats which the date converters tries
in sequence and only if it fails does it throw an error.

We¹ve now developed about 6 applications that our clients use in non-English
countries and we¹re finding it works great.

If you want the source code just email me off list.

Z.
> 
>  
> Any advice, please ?
> Thanks.
> 
> 
> -Message d'origine-
> De : Celinio Fernandes [mailto:cel...@yahoo.com]
> Envoyé : dimanche 15 novembre 2009 23:08
> À : Struts Users Mailing List
> Objet : [Struts 2.1.8] datetimepicker and action: String or Date ??
> 
> Hi,
> I have struts2-core-2.1.8.jar and xwork-core-2.1.6.jar in my classpath.
> 
> I read that there are many problems of conversion using the datetimepicker
> tag.
> 
> I checked the vault page here :
> http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x
> -to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Userdefinedco
> nverter%2528subclassingStrutsTypeConverter%2529willnolongerbeneededwhenusingda
> tetimepicker%253A
> 
> 
> But what exactly is the type of the getter/setter in the action ??
> 
> For instance if I use this line in a JSP :
>  displayFormat="MM/" required="true"/>   
> 
> 
> What getters should i get in my action ?
> 
> java.util.Date expirationDate;
>     //String expirationDate;
>     
>     public java.util.Date getExpirationDate() {
>         return expirationDate;
>     }
>     
>     public void setExpirationDate(java.util.Date expirationDate) {
>         this.expirationDate = expirationDate;
>     }
> 
> ==> I get this error :
> java.lang.NoSuchMethodException:
> com.eni.dvtejb.clientStruts2.action.PaiementAction.setExpirationDate([Ljava.la
> ng.String;)
> 
> And if i use getter/setter of type String, it complains about some RFC format
> that is not valid.
> 
> So how exactly does it work ? Can someone provide a good example with the code
> for the action and the code for the JSP with the datetimepicker tag ?
> 
> Thanks.
> 
> 
> 
>   
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: Using Struts2 JQuery drag & drop

2009-11-03 Thread Zoran Avtarovski
Hey Ignacio,

I’m not a big fan of integrated ajax functionality. While it provides a
simple solution at first when you need something a little more complex or
customised it starts to show it’s limitations.

Rather than using the sx;div tag why not just use a plain div and then use a
jQuery ajax call, which can be triggered by your drag and drop event, to
retrieve the content from the server side. I suspect that you want to pass
your event coordinates to the server and display something appropriate.

I don’t use S2 ajax plugin as I’ve been burnt by it too often. So, somebody
else may be of more help on that front.

Z.
> 
> Hello Z.,
> you are right. I am really new to JQuery & Javascript as I've just focused
> into server side programming. I'm not a javascript fan... I have to use it
> anyway.
> I have already solved the coords. problem  in JQuery drag&drop. There seem
> to be many docs about it in the net. Anyway, I haven't solved the other
> important problem and is how to trigger a struts2 remote div from
> javascript. The JQuery drop listener is a javascript function. I have the
> available and need to invoke a sx:div (old method) or the new sj:div to
> process them and show the result in the same page ; Any example over there?
> 
> Thanks
> 
> I'll get that JQuery book :-)
> 
> 
> Sparecreative wrote:
>> > 
>> > Hi Ignacio,
>> > 
>> > It not jQuery specific but more extracting the coordinates of the event
>> > using javascript. Depending on what your doing you have six pairs to
>> > choose
>> > from:
>> > 
>> > clientX,clientY
>> > layerX,layerY
>> > offsetX,offsetY
>> > pageX,pageY
>> > screenX,screenY
>> > x,y
>> > 
>> > Without knowing exactly what you¹re doing, I can only really give you
>> > general advice, but you could take the coordinates from the event and pass
>> > them via ajax and then use the response as required.
>> > 
>> > I¹m apologise if I¹m being presumptuous but I suspect that you¹d really
>> > benefit from a good book on both javascript and jQuery.
>> > 
>> > Z.
>> > 
>> > 
>>> >> Hello,
>>> >> I am looking at last version of Struts2 JQuery plugin and looks graet.
>>> >> Unfortunately I am really new to JQuery. I've been doing things with
>>> >> discontinued Dogo plugin but have found that the drag & drop tags in
>>> >> JQuery
>>> >> plugin could really fit for a Rich Int. App I have in mind. Hope somebody
>>> >> here can help me with a simple scenario.
>>> >> I would need to drop a small image into a bigger image; as far as I've
>>> >> seen
>>> >> that's no problem. The problem is that example in the showcase just shows
>>> >> a
>>> >> simple javascript subscribing to the drop action. I would need to get the
>>> >> coords where the small image/div was dropped and execute a remote DIV (to
>>> >> a
>>> >> struts2 action) sending those coords as parameter so that the remote div
>>> >> shows the results some processing with that simple data.
>>> >> 
>>> >> Anybody could point me on how to:
>>> >> A) Get the coords inside the big div where the small image was dropped.
>>> >> B) How to set those x & y coords as a remote div action parameters.
>>> >> 
>>> >> Hope this is simple to achieve.
>>> >> 
>>> >> Thanks for any directions,
>>> >> Ignacio
>> > 
>> > 
>> > 



Re: Using Struts2 JQuery drag & drop

2009-11-01 Thread Zoran Avtarovski
Hi Ignacio,

It not jQuery specific but more extracting the coordinates of the event
using javascript. Depending on what your doing you have six pairs to choose
from:

clientX,clientY
layerX,layerY
offsetX,offsetY
pageX,pageY
screenX,screenY
x,y

Without knowing exactly what you¹re doing, I can only really give you
general advice, but you could take the coordinates from the event and pass
them via ajax and then use the response as required.

I¹m apologise if I¹m being presumptuous but I suspect that you¹d really
benefit from a good book on both javascript and jQuery.

Z.


> Hello,
> I am looking at last version of Struts2 JQuery plugin and looks graet.
> Unfortunately I am really new to JQuery. I've been doing things with
> discontinued Dogo plugin but have found that the drag & drop tags in JQuery
> plugin could really fit for a Rich Int. App I have in mind. Hope somebody
> here can help me with a simple scenario.
> I would need to drop a small image into a bigger image; as far as I've seen
> that's no problem. The problem is that example in the showcase just shows a
> simple javascript subscribing to the drop action. I would need to get the
> coords where the small image/div was dropped and execute a remote DIV (to a
> struts2 action) sending those coords as parameter so that the remote div
> shows the results some processing with that simple data.
> 
> Anybody could point me on how to:
> A) Get the coords inside the big div where the small image was dropped.
> B) How to set those x & y coords as a remote div action parameters.
> 
> Hope this is simple to achieve.
> 
> Thanks for any directions,
> Ignacio



Re: i18n within dojo attribute

2009-10-29 Thread Zoran Avtarovski
You¹re missing the closing inverted comma on fieldPrompt.

Z.
> 
> It occurred to me to use an OGNL form to do this, but I am still having a
> challenge getting it to work.
> 
> I've tried 
> 
>  promptMessage="${getText('fieldPrompt)}" />
> 
> This gets me past the first problem, but still doesn't work. I am getting
> message that getText must have a prefix in the default namespace. I'm not sure
> where to take it from there.
> 
> Any suggestions? 
> 
> -- Larry 
> 
> - Original Message -
> From: "larryreed" 
> To: "user" 
> Sent: Friday, October 23, 2009 4:58:42 PM GMT -08:00 US/Canada Pacific
> Subject: i18n within dojo attribute
> 
> I have a text field which I would like to 'dojo-ize' by turning it into a
> ValidationTextBox.
> 
> One of the parameters, 'promptMessage' is a text message that is put up as a
> help when the focus enters the text box.
> 
> My problem is that I would like to internationalize this message. My thought
> was to place a struts2 text tag as the value of this attribute.
> 
> However, placing the tag inside the attribute quotes quotes the tag. Here is
> what I did: 
> 
>  promptMessage="Enter field value" />
> 
> This works, but the message is in English. To internationalize it, I tried
> this: 
> 
>  promptMessage="" />
> 
> But this quotes the angle brackets and the result is:
> 
>  promptMessage=""
> 
> I've tried a couple of other variations that do not work either. Any
> suggestions as to how I might do this?
> 
> -- Larry 
> 



Re: [S2] i18n for lists/maps

2009-09-14 Thread Zoran Avtarovski
Exactly. Using the s:select for your example below would be as follows:



Z.

> Z,
> I'll clarify with a simple example :
> The dropdown must be like :
> 
> EnglishType1 value="2">EnglishType2 for EN and  value="1">SpanishType1SpanishType2
> 
> So, the values 1 and 2 remain constant, only the text changes. Now, i don't
> want to maintain 1, 2 separately from its text. My understanding from your
> suggestion is to have a list of "Option" objects whose responseKey attribute
> wil hold 1, 2 and responseValue attribute is like "key.value1" ,
> "key.value2" etc. which is defined in properties file as :
> key.value1=EnglishType1
> key.value2=EnglishType2 etc.
> 
> Let me know if i've understood it correctly.
> 
> Thanks,
> Joseph
> 
> 
> 
> I just want to get a couple things straight:
> 
> 1. Your state names are in localised properties files
> 2. The properties files are available to struts2 either via
> struts.custom.i18n.resources or convention (read don¹t ask)
> 
> If you app satisfies these two points then the method I mentioned will work
> fine.  If it doesn¹t, it¹s not that much work to satisfy them.
> 



Re: [S2] i18n for lists/maps

2009-09-08 Thread Zoran Avtarovski
I just want to get a couple things straight:

1. Your state names are in localised properties files
2. The properties files are available to struts2 either via
struts.custom.i18n.resources or convention (read don’t ask)

If you app satisfies these two points then the method I mentioned will work
fine.  If it doesn’t, it’s not that much work to satisfy them.

Where specifically are you seeing a problem?

Z.
> 
> 
> This won't work for me because the list is not maintained in Action, rather
> in a properties file - since it's a set of constants (ex : list of US
> states)
> 
> 
> 
> Sparecreative wrote:
>> > 
>> > You don¹t have to have a DB back end.
>> > 
>> > Here¹s a couple of examples from our system:
>> > 
>> > > > listValue="%{getText(responseValue)}"  name="name"
>> > label="%{getText(responseLabel)}" />
>> > 
>> > > > listKey="responseKey" listValue="%{getText(responseValue)}"  name="name"
>> > label="%{getText(responseLabel)}" />
>> > 
>> > It¹s pretty self explanatory, but the getText function is called on your
>> > action. Obviously this is predicated on your actions either extending
>> > ActionSupport or implementing a getText method to retrieve localised
>> > values.
>> > 
>> > Z.
>>> >> 
>>> >> 
>>> >> Yeah, i dont want to change to DB backed bundles. My question is if the
>>> >> s:select tag can take a list from a resourcebundle directly and use it .
>>> >> If
>>> >> so, how should the list be specified ?
>>> >> 
>>> >> On Sat, Sep 5, 2009 at 3:59 AM, Tommy Pham  wrote:
>>> >> 
> >>> > - Original Message 
>>>  > > From: j alex 
>>>  > > To: Struts Users Mailing List 
>>>  > > Sent: Friday, September 4, 2009 12:48:43 PM
>>>  > > Subject: [S2] i18n for lists/maps
>>>  > >
>>>  > > Hi,
>>>  > >
>>>  > > Normally, we use the resource bundles to store Strings like
field
>  labels,
>>>  > > error messages etc. But how about things like dropdown display
>  values ?
>> > .
> >>> > I
>>>  > > need to i18n-ize an app that has a lot of such dropdowns and
the
>  lists
> >>> > are
>>>  > > currently referenced like
>>>  > > list="#application.dropdownmap['loanType']"/> where dropdownmap
is
>  loaded
>>>  > > into ServletContext from a properties file . that has
>>> definitions
>  like :
>>>  > > loanType=1~Home Loan|2~Car Loan|3~Refi etc. Here, the 1,2,3
remains
> >>> > constant
>>>  > > but the display value will vary by locale.
>>>  > >
>>>  > > It'll be really neat if it's possible to maintain this list in
a
>  typical
>>>  > > resource bundle file like ApplicationResources_and be able to
use
>>>  > > it from s:select tags without having to do any manual parsing.
Any
>  inputs
>>>  > > will be really helpful.
>>>  > >
>>>  > > Thanks!
> >>> >
> >>> > Hi Alex,
> >>> >
> >>> > I don't mean to advice you on adding more complexity to your project
 >>> but
> >>> > Mike Baranski and I were discussing about using/getting the
 >>> ResourceBundle
> >>> > from DB backend instead.  He had one working:
> >>> >
> >>> > "Here you go, this is what I did.  I don't know if it's the "best"
 >>> way, but
> >>> > it works:
> >>> >
> >>> > http://mikeski.net/site/node/37
> >>> >
> >>> > Mike."
> >>> >
> >>> > I had planned on using DB backend instead solely so that anyone with
 >>> the
> >>> > proper privileges via the web UI can add/change the texts.  You only
 >>> need
 >>> to
> >>> > provide the proper db structure and key for the texts.  If you do
 >>> implement
> >>> > DB backend, IMHO, I think it will give you more flexibility for the
 >>> future
> >>> > and less of the menial work ;), especially when they (your boss
> and/or
> >>> > client(s)) decide to use additional language.
> >>> >
> >>> > Regards,
> >>> > Tommy
> >>> >
> >>> >
> >>> > 
> -
> >>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >>> > For additional commands, e-mail: user-h...@struts.apache.org
> >>> >
> >>> >
>> > 
>> > 
>> > 



Re: [S2] i18n for lists/maps

2009-09-07 Thread Zoran Avtarovski
You don¹t have to have a DB back end.

Here¹s a couple of examples from our system:





It¹s pretty self explanatory, but the getText function is called on your
action. Obviously this is predicated on your actions either extending
ActionSupport or implementing a getText method to retrieve localised values.

Z.
> 
> 
> Yeah, i dont want to change to DB backed bundles. My question is if the
> s:select tag can take a list from a resourcebundle directly and use it . If
> so, how should the list be specified ?
> 
> On Sat, Sep 5, 2009 at 3:59 AM, Tommy Pham  wrote:
> 
>> > - Original Message 
>>> > > From: j alex 
>>> > > To: Struts Users Mailing List 
>>> > > Sent: Friday, September 4, 2009 12:48:43 PM
>>> > > Subject: [S2] i18n for lists/maps
>>> > >
>>> > > Hi,
>>> > >
>>> > > Normally, we use the resource bundles to store Strings like field
>>> labels,
>>> > > error messages etc. But how about things like dropdown display values ?
.
>> > I
>>> > > need to i18n-ize an app that has a lot of such dropdowns and the lists
>> > are
>>> > > currently referenced like
>>> > > list="#application.dropdownmap['loanType']"/> where dropdownmap is
>>> loaded
>>> > > into ServletContext from a properties file . that has definitions like :
>>> > > loanType=1~Home Loan|2~Car Loan|3~Refi etc. Here, the 1,2,3 remains
>> > constant
>>> > > but the display value will vary by locale.
>>> > >
>>> > > It'll be really neat if it's possible to maintain this list in a typical
>>> > > resource bundle file like ApplicationResources_and be able to use
>>> > > it from s:select tags without having to do any manual parsing. Any
>>> inputs
>>> > > will be really helpful.
>>> > >
>>> > > Thanks!
>> >
>> > Hi Alex,
>> >
>> > I don't mean to advice you on adding more complexity to your project but
>> > Mike Baranski and I were discussing about using/getting the ResourceBundle
>> > from DB backend instead.  He had one working:
>> >
>> > "Here you go, this is what I did.  I don't know if it's the "best" way, but
>> > it works:
>> >
>> > http://mikeski.net/site/node/37
>> >
>> > Mike."
>> >
>> > I had planned on using DB backend instead solely so that anyone with the
>> > proper privileges via the web UI can add/change the texts.  You only need
>> to
>> > provide the proper db structure and key for the texts.  If you do implement
>> > DB backend, IMHO, I think it will give you more flexibility for the future
>> > and less of the menial work ;), especially when they (your boss and/or
>> > client(s)) decide to use additional language.
>> >
>> > Regards,
>> > Tommy
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> >
>> >



Re: possible bug in v2.1.6 ??

2009-09-04 Thread Zoran Avtarovski
For what it¹s worth I was getting some strange results with included jspfs.
In my case it was the freemarker encoding that was getting screwed up.

What I found was if I included the <%@ page
contentType="text/html;charset=UTF-8" language="java" %> tag at the head of
my .jspf files it worked fine.

I don¹t know if it was a tomcat or struts issue but I know that now all our
.jspf files include the tag. And we haven¹t seen the problem again.

Z.

> 
> On Thu, Sep 3, 2009 at 10:35 AM, Tommy Pham wrote:
>> >
>> > Hi Wes,
>> >
>> > Why then does it work with Servlet+JSP+JSTL1.2 on the same exact dev
>> system?  I'd would agree with you if it fails with just the basics.
>> >
>> > Thanks,
>> > Tommy
>> >
> 
> To be honest I don't know, my guess is that since the original request
> comes in through the jsp servlet, it "just works" whereas the struts
> filter catches the request and eventually dispatches to the JSP. I'm
> sure if I read the spec and mapped this out as a use-case, there is
> probably a logical reason, but I just figured that if you can rename
> the fragments, then you are better off... Another thought, instead of
> using fragments, have you thought about using tag files? I quit using
> includes as soon as the .tag files became available.
> 
> -Wes



Re: Freemarker Text Encoding Error

2009-08-26 Thread Zoran Avtarovski
I guess you can, but I was a little reluctant to introduce the freemarker
servlet mapping at the web.xml level as the configuration is handled
internally by struts and I didn’t really want to run into any issues down
the line.

I guess I could have also looked at the tomcat configuration and specified
the charset there. But I’m more comfortable just introducing the page
attribute to all my page fragments.

Z.
> 
> 
> this is good information zoran!
> 
> can we specify contentType="text/html;charset=UTF-8" thru init-params?
> 
> 
> freemarker
> freemarker.ext.servlet.FreemarkerServlet
> 
> 
> 
>   ContentType
>   text/html
> 
> 
>   default_encoding
>   ISO-8859-1
> 
> 
> 
>  freemarker
>  *.ftl
> reprised from FreeMarkerServlet documentation at
> http://struts.apache.org/2.1.6/docs/tutoriallesson04-03.html
> 
> /dziekuje/
> Martin Gainty 
> __
> Jogi és Bizalmassági kinyilatkoztatás
>  Ez az
> üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
> készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
> semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
> könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
> ezen üzenet tartalma miatt.
> 
> 
> 
> 
> 
> 
> 
>> > Date: Thu, 27 Aug 2009 10:17:03 +1000
>> > Subject: Re: Freemarker Text Encoding Error
>> > From: zo...@sparecreative.com
>> > To: user@struts.apache.org; musa...@gmail.com;
>> freemarker-u...@lists.sourceforge.net; ddek...@freemail.hu
>> > 
>> > Apologies in advance for the cross post, but it saves on typing.
>> > 
>> > I found that the solution was simple in the end. While testing various
>> > options I noticed I had one page that worked. In identifying the difference
>> > between that and the others there was a difference in the content jspf for
>> > that page, it had a <%@ page contentType="text/html;charset=UTF-8"
>> > language="java"%> while the others didn’t.
>> > 
>> > I thought there was no longer a need for these in JSP fragments, the main
>> > JSP page has one as does the sitemesh decorator. But obviously I was wrong.
>> > 
>> > So thanks again for your help guys.
>> > 
>> > Z.
>> > 
>>> > > 
>>> > > It is good to post here, but for tricky stuff like this, you have a
>>> > > better chance with them. Also if you find the solution, please let us
>>> > > know.
>>> > > 
>>> > > musachy
>>> > > 
>>> > > On Tue, Aug 25, 2009 at 10:38 PM, Zoran
>>> > > Avtarovski wrote:
>>>>> > >> > I knew somebody would say that. I was too lazy to subscribe and I
half
>>>>> > >> > expected them to ask on the struts list.
>>>>> > >> >
>>>>> > >> > Thanks Musachy, I’ll subscribe and post now. I guess I was hoping
others
>>>>> > >> > might have experienced a similar problem.
>>>>> > >> >
>>>>> > >> > Z.
>>>>> > >> >
>>>>> > >> > did you try asking the FreeMarker guys?
>>>>> > >> >
>>>>> > >> > On Tue, Aug 25, 2009 at 7:26 PM, Zoran
>>>>> > >> > Avtarovski wrote:
>>>>>>> > >>> >> I¹m having trouble displaying Danish text in my forms using the
struts
>>>>>>> > >>> >> tags
>>>>>>> > >>> >> and I think it related to an error with how freemarker gets the
locale.
>>>>>>> > >>> >> I¹m
>>>>>>> > >>> >> getting a lot of question marks in the text, but if I set the
server
>>>>> > >>> local
>>>>>>> > >>> >> to Danish, all works as expected. Obviously that¹s not a
>>>>>>> solution as the
>>>>>>> > >>> >> other languages also have problems.
>>>>>>> > >>> >>
>>>>>>> > >>> >> For example the s:select tag is incorrectly displaying some
>>>>>&g

Re: Freemarker Text Encoding Error

2009-08-26 Thread Zoran Avtarovski
Apologies in advance for the cross post, but it saves on typing.

I found that the solution was simple in the end. While testing various
options I noticed I had one page that worked. In identifying the difference
between that and the others there was a difference in the content jspf for
that page, it had a <%@ page contentType="text/html;charset=UTF-8"
language="java"%> while the others didn’t.

I thought there was no longer a need for these in JSP fragments, the main
JSP page has one as does the sitemesh decorator. But obviously I was wrong.

So thanks again for your help guys.

Z.

> 
> It is good to post here, but for tricky stuff like this, you have a
> better chance with them. Also if you find the solution, please let us
> know.
> 
> musachy
> 
> On Tue, Aug 25, 2009 at 10:38 PM, Zoran
> Avtarovski wrote:
>> > I knew somebody would say that. I was too lazy to subscribe and I half
>> > expected them to ask on the struts list.
>> >
>> > Thanks Musachy, I’ll subscribe and post now. I guess I was hoping others
>> > might have experienced a similar problem.
>> >
>> > Z.
>> >
>> > did you try asking the FreeMarker guys?
>> >
>> > On Tue, Aug 25, 2009 at 7:26 PM, Zoran
>> > Avtarovski wrote:
>>> >> I¹m having trouble displaying Danish text in my forms using the struts
>>> >> tags
>>> >> and I think it related to an error with how freemarker gets the locale.
>>> >> I¹m
>>> >> getting a lot of question marks in the text, but if I set the server
>>> local
>>> >> to Danish, all works as expected. Obviously that¹s not a solution as the
>>> >> other languages also have problems.
>>> >>
>>> >> For example the s:select tag is incorrectly displaying some Danish text.
>>> >> But
>>> >> if I go in and edit the freemarker template file and change the label
>>> >> display from ${} notation to one using <@s.property /> tag it works as
>>> >> expected.
>>> >>
>>> >> Here¹s the details
>>> >>
>>> >> <@s.property value="%{parameters.label}"/> prints the correct text:
>>> >>
>>> >> Hvornår (ca.) begyndte de nuværende rygsmerter eller bensmerter (iskias)?
>>> >>
>>> >> But ${parameters.label?html} prints texts with Œ?¹ substituted for
>>> >> unsupported characters :
>>> >>
>>> >> Hvorn?r (ca.) begyndte de nuv?rende rygsmerter eller bensmerter (iskias)?
>>> >>
>>> >>
>>> >> I can see one solution is to change all the freemarker template files and
>>> >> replace ${} with <@s.property/>.
>>> >>
>>> >> But I¹m sure there has to be a simpler solution.
>>> >>
>>> >> Please, please help. As at the rate I¹m going I won¹t be needing a
>>> haircut
>>> >> for a while.
>>> >>
>>> >> Z.
>>> >>
>> >
>> >
>> >
> 
> 



Re: Freemarker Text Encoding Error

2009-08-25 Thread Zoran Avtarovski
I knew somebody would say that. I was too lazy to subscribe and I half
expected them to ask on the struts list.

Thanks Musachy, I’ll subscribe and post now. I guess I was hoping others
might have experienced a similar problem.

Z.
> 
> did you try asking the FreeMarker guys?
> 
> On Tue, Aug 25, 2009 at 7:26 PM, Zoran
> Avtarovski wrote:
>> > I¹m having trouble displaying Danish text in my forms using the struts tags
>> > and I think it related to an error with how freemarker gets the locale. I¹m
>> > getting a lot of question marks in the text, but if I set the server local
>> > to Danish, all works as expected. Obviously that¹s not a solution as the
>> > other languages also have problems.
>> >
>> > For example the s:select tag is incorrectly displaying some Danish text. >>
But
>> > if I go in and edit the freemarker template file and change the label
>> > display from ${} notation to one using <@s.property /> tag it works as
>> > expected.
>> >
>> > Here¹s the details
>> >
>> > <@s.property value="%{parameters.label}"/> prints the correct text:
>> >
>> > Hvornår (ca.) begyndte de nuværende rygsmerter eller bensmerter (iskias)?
>> >
>> > But ${parameters.label?html} prints texts with Œ?¹ substituted for
>> > unsupported characters :
>> >
>> > Hvorn?r (ca.) begyndte de nuv?rende rygsmerter eller bensmerter (iskias)?
>> >
>> >
>> > I can see one solution is to change all the freemarker template files and
>> > replace ${} with <@s.property/>.
>> >
>> > But I¹m sure there has to be a simpler solution.
>> >
>> > Please, please help. As at the rate I¹m going I won¹t be needing a haircut
>> > for a while.
>> >
>> > Z.
>> >
> 
> 



Re: Freemarker Text Encoding Error

2009-08-25 Thread Zoran Avtarovski
Thanks Martin,

I‘m not using a freemarker template, the struts tags are.

I’ve set the charset meta tag correctly in my jsp page. The issue is with
the freemarker templates the struts tags use. I tried adding the <#setting
locale="da_DK"> setting to the top of the control header template with no
joy.

Z. 
> 
> 
> this is from freemarker code
>  * ContentType if specified, response uses the specified
>  * Content-type HTTP header. The value may include the charset (e.g.
>  * "text/html; charset=ISO-8859-1").
>  * If not specified, "text/html" is used.
>  * If the charset is not specified in this init-param, then the charset
>  * (encoding) of the actual template file will be used (in the response HTTP
> header
>  * and for encoding the output stream). Note that this setting can be
> overridden
>  * on a per-template basis by specifying a custom attribute named
>  * content_type in the attributes parameter of the
>  * <#ftl> directive.
>  * 
> 
> change the charset meta tag in the .ftl
> <#macro page title>
>   
>   
> FreeMarker Struts Example - ${title?html}
> 
>   
>   
>   
>   
> 
> 
> http://en.wikipedia.org/wiki/ISO/IEC_8859-1
> Æ 
> 00C6
> 
> SchutzStaffel Lindholm at door he says we will work at Oswiccim..do you know
> Oswiccum?
> 
> Martin Gainty 
> __
> Jogi és Bizalmassági kinyilatkoztatás/Note de déni et de confidentialité
>  
> Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
> nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
> alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
> megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
> tartalma miatt.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
> interdite. Ce message sert à l'information seulement et n'aura pas n'importe
> quel effet légalement obligatoire. Étant donné que les email peuvent
> facilement être sujets à la manipulation, nous ne pouvons accepter aucune
> responsabilité pour le contenu fourni.
> 
> 
> 
> 
> 
>> > Date: Wed, 26 Aug 2009 12:26:09 +1000
>> > Subject: Freemarker Text Encoding Error
>> > From: zo...@sparecreative.com
>> > To: user@struts.apache.org
>> > 
>> > I¹m having trouble displaying Danish text in my forms using the struts tags
>> > and I think it related to an error with how freemarker gets the locale. I¹m
>> > getting a lot of question marks in the text, but if I set the server local
>> > to Danish, all works as expected. Obviously that¹s not a solution as the
>> > other languages also have problems.
>> > 
>> > For example the s:select tag is incorrectly displaying some Danish text. >>
But
>> > if I go in and edit the freemarker template file and change the label
>> > display from ${} notation to one using <@s.property /> tag it works as
>> > expected.
>> > 
>> > Here¹s the details
>> > 
>> > <@s.property value="%{parameters.label}"/> prints the correct text:
>> > 
>> > Hvornår (ca.) begyndte de nuværende rygsmerter eller bensmerter (iskias)?
>> > 
>> > But ${parameters.label?html} prints texts with Œ?¹ substituted for
>> > unsupported characters :
>> > 
>> > Hvorn?r (ca.) begyndte de nuv?rende rygsmerter eller bensmerter (iskias)?
>> > 
>> > 
>> > I can see one solution is to change all the freemarker template files and
>> > replace ${} with <@s.property/>.
>> > 
>> > But I¹m sure there has to be a simpler solution.
>> > 
>> > Please, please help. As at the rate I¹m going I won¹t be needing a haircut
>> > for a while.
>> > 
>> > Z.
> 
> 
> Windows Live: Make it easier for your friends to see what you’re up to on
> Facebook. Find out more.
>  WL:en-US:SI_SB_facebook:082009> 



Freemarker Text Encoding Error

2009-08-25 Thread Zoran Avtarovski
I¹m having trouble displaying Danish text in my forms using the struts tags
and I think it related to an error with how freemarker gets the locale. I¹m
getting a lot of question marks in the text, but if I set the server local
to Danish, all works as expected. Obviously that¹s not a solution as the
other languages also have problems.

For example the s:select tag is incorrectly displaying some Danish text. But
if I go in and edit the freemarker template file and change the label
display from ${} notation to one using <@s.property /> tag it works as
expected.

Here¹s the details 

<@s.property value="%{parameters.label}"/> prints the correct text:

Hvornår (ca.) begyndte de nuværende rygsmerter eller bensmerter (iskias)?

But ${parameters.label?html} prints texts with Œ?¹ substituted for
unsupported characters :

Hvorn?r (ca.) begyndte de nuv?rende rygsmerter eller bensmerter (iskias)?


I can see one solution is to change all the freemarker template files and
replace ${} with <@s.property/>.

But I¹m sure there has to be a simpler solution.

Please, please help. As at the rate I¹m going I won¹t be needing a haircut
for a while.

Z.


Re: Anyone using the Ajaxtags with Struts 2

2009-08-24 Thread Zoran Avtarovski
Like you I thought I¹d give the ajax tags stuff a whirl in S2, but honestly
Musachy is right. You¹re better off using a JS framework directly. That way
you can get the control you need. Almost all of the them have some level of
tree functionality and I¹ve given up recommending a particular framework ­
they¹re all much of a muchness.

Z.
> 
> 
> You rock bro!  So is there a way to get the TreeItem attributes passed back
> to the server?  If not, I am confused as to why they would be set on the
> node object.
> 
> 
> 
> Musachy Barroso wrote:
>> > 
>> > On Thu, Aug 20, 2009 at 8:06 AM, stanlick wrote:
>>> >> P.S. I was surprised to see that you had worked on this project Musachy.
>>> >> You just pop up everywhere!
>> > 
>> > I think I wrote that tree so I wouldn't trust it too much :)
>> > 
>> > musachy
>> > -- 
>> > "Hey you! Would you help me to carry the stone?" Pink Floyd
>> > 
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> > 
>> > 
>> > 



Re: Re : Re : Re : Re : Struts2 + I18N

2009-08-17 Thread Zoran Avtarovski
At the moment when we use execandwait we¹re finding that that the production
thread doesn¹t even start until after the delay period is over. For example
I did a simple test with the following configuration:

   


2000
50

/WEB-INF/pages/execAndWait.jsp
/WEB-INF/pages/View.jsp

> 
The view action checks for the existence of legacy data and if it exists
retrieves it ad appends to the current data. If no legacy data exists the
action is done in no time, but if legacy data is present it can take up to a
couple of minutes to extract and combine.

I was of the impression the above configuration would skip the
execAndWait.jsp page if the thread was done within 2000 milliseconds ­ with
a check every 50 milliseconds, but what actually happens is that the action
pauses for 2000 milliseconds and then starts the main thread, so we always
get the execandWait page. I tried increasing the delay to 1 and the same
happens with just a 10 second delay.

I¹m hoping that I just haven¹t understood the configuration options, but I
haven¹t been able to find more detailed information.

Z.
> 
> Zoran Avtarovski wrote:
>> > For what it¹s worth, the I18n and the execandwait areas are the two areas I
>> > find that S2 falls down the most.
> 
> Do you have any specific suggestions for how execandwait should work?
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: Re : Re : Re : Re : Struts2 + I18N

2009-08-16 Thread Zoran Avtarovski
Hi Julien,

I¹m not sure of it¹s too late for you, but what we did was cheat and added a
simple interceptor to the stack which set the default struts locale to
whatever you need. It was trivial piece of code and then everything worked
as expected.

For what it¹s worth, the I18n and the execandwait areas are the two areas I
find that S2 falls down the most. And what I hate even more is that we have
a new young guy on the team and every time he comes across one of hacks
we¹ve implemented I have to listen to Stripes this, and Stripes that or
Wicket this and Wicket that for the next 2 hours.

Z.


Re: Internationalization and SEO

2009-08-12 Thread Zoran Avtarovski
Have you seen URLRewrite Filter, it will enable you to set request
parameters based on URL. For example you can have
www.mydomain.com/en/myPage.htm remap to
www.mydomain.com/myPage.htm?locale=en and likewise for the others.

It¹s one of the handiest tools for web.

Z.
> 
> Hello,
> 
> I have a question relating to serving international content that I hope
> someone can help with.
> 
> It is kind of leaning towards an SEO question, but it does relate to
> Struts in terms of how I can use Struts 2 to control page direction
> because of language selection.
> 
> In terms of SEO, I am guessing that serving the content for three
> languages on one page, would be bad for SEO.
> 
> For example, serving English, French and German versions for a page all
> on the same URL:
> 
> www.mydomain.com/myPage.htm
> 
> This is possible of course creating and using the corresponding language
> resource bundles.  Struts 2 would serve up the correct content based on
> the browser locale setting.
> 
> However, looking around Googles knowledgebase, it would be better to have:
> 
> www.mydomain.com/en/myPage.htm
> www.mydomain.com/fr/myPage.htm
> www.mydomain.com/de/myPage.htm
> 
> How can I configure struts to work in this way, ie redirect a user to a
> subdirectory tree based on the language locale set in their browser.
> 
> Thanks for any thoughts.
> Robin
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: Configuring SiteMesh for specific action mappings in Struts 2?

2009-08-12 Thread Zoran Avtarovski
I apologise, you’re right. But by changing it to :

/widgets/home.action

It will work exactly the same way and only exclude the home action when
invoked via the widgets namespace.

Z.

>  I think your pattern is on the namespace rather than the action?
> C. 
> 
> 
>  
> 
> 
>  
> 
> -Original Message-
> From: Zoran Avtarovski 
> To: Struts Users Mailing List ; CS Wong
> 
> Sent: Tue, Aug 11, 2009 9:49 pm
> Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I¹m certain that¹s not correct. We use the decorators.xml file extensively
> and we¹re able to have pretty fine control over the sitemesh decorators. I
> know in our installation the decorator is based on the action url rather
> than the resulting jsp file.
> 
> For example you could include a excludes pattern which ignores all widget
> requests by placing
> /widgets/* in your excludes section.
> 
> Z.
>> > 
>> > 
>> > Tried this route but it seems to me that they only work if the patterns
>> > specified point to physical files only. For example, it'd work if it points
>> > to "index.html" or "/view/hello.jsp".
>> > However, I was assuming that it would work for the output from the filter
>> > dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
>> > for the output from "/hello.action" but to be excluded for
>> > "/widgets/hello.action".
>> > 
>> > Big picture-wise, what I wanted was to have one default Struts 2 package,
>> > all configured to serve full pages decorated by SiteMesh. Then I'll create
>> > another package "widgets", where there's no decorator invoked and it only
>> > serves the raw content of the JSPs returned. On my pages, if20AJAX is
>> > available, I'd dynamically change the links to load from the "widgets"
>> > package instead so I can just call the widget and render it dynamically
>> into
>> > the page using JS. I'd be able to reuse both the action classes and the JSP
>> > throughout both packages then.
>> > 
>> > BTW, I know that SiteMesh is not a native Struts 2 application so if enough
>> > people think I'm off-topic here please do let me know. I just thought that
>> > since SiteMesh is a supported plugin, it may be applicable here.
>> > 
>> > Thanks,
>> > Wong
>> > 
>> > 
>> > On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
>> > eduard.neuw...@googlemail.com> wrote:
>> > 
>>>> >> > Hi Wong,
>>>> >> >
>>>> >> > perhaps would the following entries from decorators.xml help you :
>>>> >> >
>>>> >> > 
>>>> >> >  
>>>> >> >   /styles/*
>>>> >> >   /scripts/*
>>>> >> >   /images/*
>>>> >> >   /index.html
>>>> >> >  
>>>> >> > ...
>>>> >> > 
>>>> >> >
>>>> >> > Regards
>>>> >> > Eduard Neuwirt
>>>> >> >
>>>> >> > CS Wong schrieb:
>>>> >> >
>>>> >> >  Hi,
>>>>>> >>> >> I'm trying to configure sitemesh to only take effect for a certain
subset
>>>>>> >>> >> of
>>>>>> >>> >> action mappings in my Struts 2 application.
>>>>>> >>> >>
>>>>>> >>> >> Say for example, I have the following struts.xml snippet:
>>>>>> >>> >>
>>>>>> >>> >> 
>>>>>> >>> >>  
>>>>>> >>> >>/view/form.jsp
>>>>>> >>> >>  
>>>>>> >>> >> 
>>>>>> >>> >>  espace="/widgets" extends="struts-default">
>>>>>> >>> >>  
>>>>>> >>> >>/view/form.jsp
>>>>>> >>> >>  
>>>>>> >>> >> 
>>>>>> >>> >>
>>>>>> >>> >> I would like the output of "/showForm.action" to be decorated by
>>>>>> SiteMesh
>>>>>> >>> >> but for "/widgets/showForm.action" to be returned empty instead.
The
>>>>>> >>> >> critical part here is that I want the JSP file to be reused by
both
>>>> >>> action
>>>>>> >>> >> mappings.
>>>>>> >>> >>
>>>>>> >>> >> But try as I might, I can't seem to get SiteMesh's  tag
to
>>>>>> >>> >> recognize a mapping. I have to specify the file "/view/form.jsp"
to be
>>>>>> >>> >> excluded instead and that means I won't be able to reuse the JSP
file.
>>>>>> >>> >>
>>>>>> >>> >> Is there any way I can get around this?
>>>>>> >>> >>
>>>>>> >>> >> I'm using Struts 2.0.14.
>>>>>> >>> >>
>>>>>> >>> >> Thanks,
>>>>>> >>> >> Wong
>>>>>> >>> >>
>>>>>> >>> >>
>>>>>> >>> >>
>>>> >> >
>>>> >> >
>>>> >> > -
>>>> >> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> >> > For additional commands, e-mail: user-h...@struts.apache.org
>>>> >> >
>>>> >> >
> 
> 
> 
>  
> 



Re: Configuring SiteMesh for specific action mappings in Struts 2?

2009-08-11 Thread Zoran Avtarovski
I¹m certain that¹s not correct. We use the decorators.xml file extensively
and we¹re able to have pretty fine control over the sitemesh decorators. I
know in our installation the decorator is based on the action url rather
than the resulting jsp file.

For example you could include a excludes pattern which ignores all widget
requests by placing
/widgets/* in your excludes section.

Z.
> 
> 
> Tried this route but it seems to me that they only work if the patterns
> specified point to physical files only. For example, it'd work if it points
> to "index.html" or "/view/hello.jsp".
> However, I was assuming that it would work for the output from the filter
> dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
> for the output from "/hello.action" but to be excluded for
> "/widgets/hello.action".
> 
> Big picture-wise, what I wanted was to have one default Struts 2 package,
> all configured to serve full pages decorated by SiteMesh. Then I'll create
> another package "widgets", where there's no decorator invoked and it only
> serves the raw content of the JSPs returned. On my pages, if AJAX is
> available, I'd dynamically change the links to load from the "widgets"
> package instead so I can just call the widget and render it dynamically into
> the page using JS. I'd be able to reuse both the action classes and the JSP
> throughout both packages then.
> 
> BTW, I know that SiteMesh is not a native Struts 2 application so if enough
> people think I'm off-topic here please do let me know. I just thought that
> since SiteMesh is a supported plugin, it may be applicable here.
> 
> Thanks,
> Wong
> 
> 
> On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
> eduard.neuw...@googlemail.com> wrote:
> 
>> > Hi Wong,
>> >
>> > perhaps would the following entries from decorators.xml help you :
>> >
>> > 
>> >  
>> >   /styles/*
>> >   /scripts/*
>> >   /images/*
>> >   /index.html
>> >  
>> > ...
>> > 
>> >
>> > Regards
>> > Eduard Neuwirt
>> >
>> > CS Wong schrieb:
>> >
>> >  Hi,
>>> >> I'm trying to configure sitemesh to only take effect for a certain subset
>>> >> of
>>> >> action mappings in my Struts 2 application.
>>> >>
>>> >> Say for example, I have the following struts.xml snippet:
>>> >>
>>> >> 
>>> >>  
>>> >>/view/form.jsp
>>> >>  
>>> >> 
>>> >> 
>>> >>  
>>> >>/view/form.jsp
>>> >>  
>>> >> 
>>> >>
>>> >> I would like the output of "/showForm.action" to be decorated by SiteMesh
>>> >> but for "/widgets/showForm.action" to be returned empty instead. The
>>> >> critical part here is that I want the JSP file to be reused by both
>>> action
>>> >> mappings.
>>> >>
>>> >> But try as I might, I can't seem to get SiteMesh's  tag to
>>> >> recognize a mapping. I have to specify the file "/view/form.jsp" to be
>>> >> excluded instead and that means I won't be able to reuse the JSP file.
>>> >>
>>> >> Is there any way I can get around this?
>>> >>
>>> >> I'm using Struts 2.0.14.
>>> >>
>>> >> Thanks,
>>> >> Wong
>>> >>
>>> >>
>>> >>
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> >
>> >



Cookies

2009-08-09 Thread Zoran Avtarovski
Two quick questions about cookies:

1. The cookie interceptor definition appears to be missing from the
struts-default.xml file on 2.1.6. Is this a sign the the interceptor is on
its way out? 
2. The interceptor looks like it can only be used to read cookies. Do I need
to grab the response object directly and add the cookie manually?

Z.


Re: CSS background images, struts2

2009-08-05 Thread Zoran Avtarovski
We use the tomcat method and have found there are no issues:

What you do is that in either your tomcat web.xml or your app xml specify :

  
jsp
*.css
  


Which will treat the css files as jsps and parse any el expressions they
contain and in your css place the following at the top so the browser knows
its a CSS file.

/* <%@ page contentType="text/css;charset=UTF-8" %> */

And the your style cane be set as follows:

background-image: 
url('${pageContext.request.contextPath}/images/image.gif');


If it sounds complex its not.  The only drawback is that the CSS file won¹t
be cached by browsers and there may be a small performance hit.

Z.

> 
> Haroon Rafique wrote:
>> > 
>> > If your file structure is somewhat like:
>> > 
>> > styles/base.css
>> > images/image.gif
>> > 
>> > then you can simply change your background-image directive to say:
>> > background-image: url('../images/image.gif');
>> > 
>> > 
> 
> 
> and
> 
> 
> 
> Musachy Barroso wrote:
>> > 
>> > assuming your dir structure is like:
>> > 
>> > css
>> > ...main.css
>> > images
>> > someimage.jpg
>> > 
>> > you can use this in your css: url(../images/someimagejpg)
>> > 
>> > 
> 
> 
> Now I'm at my desk, I can see that this does indeed work. Thanks for the
> help guys.
> 
> Later,
> 
> Andy




Re: One Struts2-project to rule them all

2009-07-30 Thread Zoran Avtarovski
We¹ve implemented a similar solution where we have a custom interceptor
which sets a domainId value based on the url used to access the site.

It¹s then a simple matter of applying the appropriate processing for each of
the domains based on the domainId value.

I can tell you from our perspective its great as our app manages about 120
domains on a single app and the client loves it because they a a single
interface for all domains.

Z.
> 
> Hi folksI'm facing a nice problem and I would be glad to hear from you. I
> think it should be useful to all.
> 
> Problem is easy:
> Gandalf and I need to build 15 websites one per domain, I really dont want
> to maintain 15 different and pretty small projects.
> I will be happy to use subdomains, but I couldnt.
> 
> Alternatives:
> - A Struts2 project attending 15 websites.
> is it possible? Writing my own FilterDispatcher??
> 
> - Multiple Struts2 project on per domain bundled in a EAR.
> I think I will overhead the job.
> I dont want to duplicate struts configurations, javascript and
> css resources.




Re: AJAX Validation

2009-07-28 Thread Zoran Avtarovski
I’ve seen others use a customised version of DWR in combination with
annotations. We looked at it to the point of almost going with it but in the
end the decision was made it wasn’t worth the effort.

We have little in the way of duplication. The approach we took was to be all
nice-nice on the JS validation with regards to client feedback and then be
more abrupt on the server side as we could assume that if the client side
validation failed, either somebody was doing something they shouldn’t be or
something had gone wrong in a big way.  If server side validation failed on
items that JS had supposedly validated we just threw the user to an error
page.

I like the looks of the JSONValidation Interceptor, but I’m just a little
concerned about the number of round trips. It looks like each form
submission occurs twice, once for validation via ajax and a second regular
HTTP request after.

Z.
> 
> @Wes : Thanks for the samples, I'll check it. The struts2-jquery-plugin you
> are talking about is the same as the one released in 1.0 last night ?
> @Martin : I agree. Coordinating the 2 layers (ie. client-side & server-side
> validation) is one of my main goal to avoid rewriting validation rules
> twice, possibly in 2 different languages.
> 
> Cheers,
> 
> Nicolas
> 
> On Tue, Jul 28, 2009 at 1:41 PM, Martin Gainty  wrote:
> 
>> >
>> > is JS validation thru a JS function faster than allowing the
>> > FieldValidationInterceptor to verify?
>> > is there a way to coordinate validations between the 2 layers (so that the
>> > effort is not duplicated)
>> > possibly an advised method from spring?
>> >
>> > 
>> http://struts.apache.org/2.1.2/struts2-core/apidocs/com/opensymphony/xwork2/v
>> alidator/annotations/RequiredFieldValidator.html
>> >
>> > thanks,
>> > Martin
>> > __
>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>> >
>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> > dient lediglich dem Austausch von Informationen und entfaltet keine
>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> > aucune responsabilité pour le contenu fourni.
>> >
>> >
>> >
>> >
>>> > > Date: Tue, 28 Jul 2009 21:51:44 +1000
>>> > > Subject: Re: AJAX Validation
>>> > > From: zo...@sparecreative.com
>>> > > To: user@struts.apache.org
>>> > >
>>> > > It depends on the approach you want to take in validation.
>>> > >
>>> > > For security reasons we run two layers of validation, a simple model
>> > using
>>> > > jQuery checking mandatory fields and limits checks and then a more
>> > rigorous
>>> > > model server side.
>>> > >
>>> > > As for setting up, we looked at how it was done with S2 and dojo, in the
>> > end
>>> > > we found it it much easier just to program directly when creating the
>> > form
>>> > > pages. Because of the powerful selectors  in jQuery and judicious use of
>>> > > listeners we¹ve had no issue with maintenance of code and we¹ve been >>>
able
>> > to
>>> > > leverage a range of plugins available for jQuery.
>>> > >
>>> > > Originally we tried to have the scripts created automagically through
>>> > > programming, but in the end it wasn¹t worth the effort. We¹ve extended
>> > the
>>> > > CSS and XHTML templates to accommodate some time saving features but on
>> > the
>>> > > whole there wasn¹t much to it.
>>> > >
>>> > > I now find it quicker to setup the validation directly rather than
>> > setting
>>> > > up t

Re: AJAX Validation

2009-07-28 Thread Zoran Avtarovski
It depends on the approach you want to take in validation.

For security reasons we run two layers of validation, a simple model using
jQuery checking mandatory fields and limits checks and then a more rigorous
model server side.

As for setting up, we looked at how it was done with S2 and dojo, in the end
we found it it much easier just to program directly when creating the form
pages. Because of the powerful selectors  in jQuery and judicious use of
listeners we¹ve had no issue with maintenance of code and we¹ve been able to
leverage a range of plugins available for jQuery.

Originally we tried to have the scripts created automagically through
programming, but in the end it wasn¹t worth the effort. We¹ve extended the
CSS and XHTML templates to accommodate some time saving features but on the
whole there wasn¹t much to it.

I now find it quicker to setup the validation directly rather than setting
up the XML files. It¹s amazing what can be achieved with a few well placed
s:if tags and some JS code.

Z.

> 
> Hi Zoran,
> 
> Thank you for your answer. Since you are using JQuery directly, how do you
> perform data validation ? Is it possible to use the XML Files or annotations
> provided by Struts ?
> 
> Cheers,
> 
> Nicolas
> 
> On Tue, Jul 28, 2009 at 11:26 AM, Zoran Avtarovski
> wrote:
> 
>> > From what I can tell Dojo has been moved out into a plugin, but still
>> > exists.
>> >
>> > Honestly though, I¹d take the opportunity move away from an integrated
>> > solution to using a javascript framework directly.
>> >
>> > We use jQuery and it integrates with Struts without any major issues and
>> > more often than not offers much greater flexibility. I know of others who
>> > use dojo, mootools and prototype without any issues.
>> >
>> > Z.
>>> > >
>>> > > Hi everybody,
>>> > >
>>> > > I'm currently working on a project based on Struts 2.0.11. We're
>>> planning
>> > to
>>> > > migrate to the last 2.1.x version but I've just seen that the Dojo
>>> plugin
>>> > > has been deprecating. Consequently, what's your recommandation to
>>> perform
>>> > > proper AJAX validation since the example on the Wiki is still based on
>> > the
>>> > > Dojo plugin ? Which plugin will be the next standard for Ajax tags in
>> > Struts
>>> > > 2 ? JQuery plugin ?
>>> > >
>>> > > Thanks in advance for your answers,
>>> > >
>>> > > Regards,
>>> > >
>>> > > Nicolas
>> >
>> >
>> >
> 




Re: Struts vs Other competitors

2009-07-28 Thread Zoran Avtarovski
Sadly, I have kids so I either have no time for video games or can¹t get
access to the gear. My past time is daydreaming about having a past time.

As for testing, and documentation these tasks are as valid as any others,
but again the problem from my perspective, and I don¹t mean that in a
negative way, is finding which tasks need to be done. I have so much trouble
navigating through the dev management part of the site. I guess what I was
trying to say is that if the outstanding items could be broken down in
manageable tasks, I¹d find it much less intimidating to take them on.

Z.
> 
> I would say the biggest help we can get right now is on the
> documentation and get help testing releases. One thing I have always
> seems lacking in the struts community, is support from users to help
> testing releases *before* they are actually released.
> 
> As for coordinating effort, I am not sure it would work (besides the
> usual.."hey I am working on this cool X thing.." email in dev@), I
> think that working as volunteers doesn't fit well with commitment
> because we also have other priorities, you know, like playing video
> games and stuff :)
> 
> musachy
> 
> On Mon, Jul 27, 2009 at 8:35 PM, Zoran
> Avtarovski wrote:
>> > I have to agree. Our touch with the JSF Oracle was both painful and
>> > fruitless and lead us to truly appreciate how bad things could be.
>> >
>> > Having said that, I think Martin has raised some points about how S2 can be
>> > improved and I think S2 is at a stage where there needs to be some general
>> > discussion on where all interested parties (devs and users)  think the
>> > framework should be heading and where there are deficiencies.
>> >
>> > I for one think, that with S2¹s improved plugin architecture, there is a
>> > huge amount of scope in what can be achieved. We need a few key people to
>> > guide the process. I know my biggest fear is over committing and not having
>> > the time to deliver. If there was a centralised coordinator who could
>> > organise a second tier of developers, for example, who can help on a
>> smaller
>> > scale then I believe more of the niche development could be achieved.
>> >
>> > Z.
>>> >>
>>> >> On Mon, Jul 27, 2009 at 4:42 AM, Andrey Rogov wrote:
>>>>> >>> > I agree with Matt Rable that JSF programming based on RAD methods
>>>>> makes us
>>>>> >>> > transition to JSF.
>>> >>
>>> >> I think many, many people have crossed that bridge and came back in
>>> >> rush after a while.
>>> >>
>>> >> musachy
>> >
>> >
>> >
> 
> 




Re: AJAX Validation

2009-07-28 Thread Zoran Avtarovski
>From what I can tell Dojo has been moved out into a plugin, but still
exists.

Honestly though, I¹d take the opportunity move away from an integrated
solution to using a javascript framework directly.

We use jQuery and it integrates with Struts without any major issues and
more often than not offers much greater flexibility. I know of others who
use dojo, mootools and prototype without any issues.

Z.
> 
> Hi everybody,
> 
> I'm currently working on a project based on Struts 2.0.11. We're planning to
> migrate to the last 2.1.x version but I've just seen that the Dojo plugin
> has been deprecating. Consequently, what's your recommandation to perform
> proper AJAX validation since the example on the Wiki is still based on the
> Dojo plugin ? Which plugin will be the next standard for Ajax tags in Struts
> 2 ? JQuery plugin ?
> 
> Thanks in advance for your answers,
> 
> Regards,
> 
> Nicolas




Re: Struts vs Other competitors

2009-07-27 Thread Zoran Avtarovski
I have to agree. Our touch with the JSF Oracle was both painful and
fruitless and lead us to truly appreciate how bad things could be.

Having said that, I think Martin has raised some points about how S2 can be
improved and I think S2 is at a stage where there needs to be some general
discussion on where all interested parties (devs and users)  think the
framework should be heading and where there are deficiencies.

I for one think, that with S2¹s improved plugin architecture, there is a
huge amount of scope in what can be achieved. We need a few key people to
guide the process. I know my biggest fear is over committing and not having
the time to deliver. If there was a centralised coordinator who could
organise a second tier of developers, for example, who can help on a smaller
scale then I believe more of the niche development could be achieved.

Z. 
> 
> On Mon, Jul 27, 2009 at 4:42 AM, Andrey Rogov wrote:
>> > I agree with Matt Rable that JSF programming based on RAD methods makes us
>> > transition to JSF.
> 
> I think many, many people have crossed that bridge and came back in
> rush after a while.
> 
> musachy




Re: [Struts 2] Date conversion general bug!

2009-07-16 Thread Zoran Avtarovski
I agree that date conversion is a real problem for S2, especially in multi
lingual applications.

We¹ve had to implement our own converter which either looks for a format
value with the date string or picks up a list of default prioritised date
formats and tries each one successively until success or failure with all.

Ideally it would be good if we could configure S2 out of the box (so to
speak) to perform the same functionality. By that I mean that in struts.xml
or by convention file you could specify  locale or a comma separated list of
date formats to try for both short (date only) and long (date and time)
values.

Z.


Resource Bundle Advice

2009-07-01 Thread Zoran Avtarovski
I have a 2.1.6 App that I want to move the resource bundle away from
properties files to a database backed solution and I was hoping I could get
some feedback on others experience.

I was planning to extend java.util.ResourceBundle and add the requisite
methods for accessing keys and properties via a spring backed dao and then
use the following methods to refresh the data after any changes:

LocalizedTextUtil.reset();

LocalizedTextUtil.addDefaultResourceBundle(³LocalisedMessageClass²);
LocalizedTextUtil.setReloadBundles(true);


I was hoping that somebody with some experience with this could give some
feed back.

Z.




Re: Freemarker error generated with CheckBox List

2009-06-22 Thread Zoran Avtarovski
Thanks Martin,

The method won’t error out on null values. The first part of the method
returns a false if either obj1 or obj2 are null.

I’d already isolated the code. The problem I’m having is that the Array
containing my checkbox selected values would occasionally contain a  null
value in the array (this was from a legacy system and I couldn’t easily do
anything with it).

In the end I added a workaround by iterating through the array and
discarding null values.

I still think the equals code for arrays should be the other way around as
it is for Iterable. That way it won’t throw an error.

The problem is purely in the way the Array equals code is written and if
changed won’t throw errors.

Z.
> 
> here is the code:
> public static boolean contains(Object obj1, Object obj2) {
> if ((obj1 == null) || (obj2 == null)) {
> //log.debug("obj1 or obj2 are null.");
> return false;
> }
> 
> if (obj1 instanceof Map) {
> if (((Map) obj1).containsKey(obj2)) {
> //log.debug("obj1 is a map and contains obj2");
> return true;
> }
> } if (obj1 instanceof Iterable) {
> Iterator iter = ((Iterable) obj1).iterator();
> while(iter.hasNext()) {
> Object value = iter.next();
> if (obj2.equals(value) || obj2.toString().equals(value)) {
> return true;
> }
> }
> } else if (obj1.getClass().isArray()) {
> for (int i = 0; i < Array.getLength(obj1); i++) {
> Object value = null;
> value = Array.get(obj1, i);
> 
> if (value.equals(obj2)) {
> //log.debug("obj1 is an array and contains obj2");
> return true;
> }
> }
> } 
> 
> //the Utility contains method will error out with
> null obj1
> null obj2
> obj1 which is not a valid Array
> obj2 which is not a valid Array
> 
> checkboxlist references required list attribute to draw from to quote
> list is a Iterable source to populate from. If the list is a Map (key, value),
> the Map key will become the option 'value' parameter and the Map value will
> become the option body.
> 
> http://struts.apache.org/2.0.14/docs/checkboxlist.html
> Martin Gainty 
> __
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>  
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
> sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
> oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich
> dem Austausch von Informationen und entfaltet keine rechtliche
> Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
> wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
> interdite. Ce message sert à l'information seulement et n'aura pas n'importe
> quel effet légalement obligatoire. Étant donné que les email peuvent
> facilement être sujets à la manipulation, nous ne pouvons accepter aucune
> responsabilité pour le contenu fourni.
> 
> 
> 
> 
> 
>> > Date: Mon, 22 Jun 2009 22:14:31 +1000
>> > Subject: Freemarker error generated with CheckBox List
>> > From: zo...@sparecreative.com
>> > To: user@struts.apache.org
>> > 
>> > I¹m getting  a freemarker error when I use a s:checkboxlist tag and the
>> > array which contains my item values is empty.
>> > 
>> > When I had a look at the stack trace it¹s pointing me to the following
>> > error:
>> > 
>> > Caused by: java.lang.NullPointerException
>> > at 
>> org.apache.struts2.util.ContainUtil.contains(ContainUtil.java:96)
>> > 
>> > When I had a look at the source for ContainUtil, I noticed that the equals
>> > expression is arse about.
>> > 
>> > if (obj1.getClass().isArray()) {
>> > for (int i = 0; i < Array.getLength(obj1); i++) {
>> > Object value = null;
>> > value = Array.get(obj1, i);
>> > 
>> > (Error is thrown here)  if (value.equals(obj2)) {
>> > //log.debug("obj1 is an array and contains obj2");
>> > return true;
>> > }
>> > }
>> > 
>> > Ideally the expression would be best rewritten if(obj2.equals(value))  as
>> we
>> > have already tested obj2 for nullness at the start of the contains method.
>> > 
>> > Now the hard part, I don¹t want to have to recompile the struts code and >>
was
>> > hoping there was a simple workaround.
>> > 
>> > All suggestions considered at this point.
>> > 
>> > TIA 
>> > 
>> > Z.
> 
> 
> Lauren found her dream laptop. Find the PC that’s right for you.
> 

Freemarker error generated with CheckBox List

2009-06-22 Thread Zoran Avtarovski
I¹m getting  a freemarker error when I use a s:checkboxlist tag and the
array which contains my item values is empty.

When I had a look at the stack trace it¹s pointing me to the following
error:

Caused by: java.lang.NullPointerException
at org.apache.struts2.util.ContainUtil.contains(ContainUtil.java:96)

When I had a look at the source for ContainUtil, I noticed that the equals
expression is arse about.

if (obj1.getClass().isArray()) {
for (int i = 0; i < Array.getLength(obj1); i++) {
Object value = null;
value = Array.get(obj1, i);

(Error is thrown here)  if (value.equals(obj2)) {
//log.debug("obj1 is an array and contains obj2");
return true;
}
}

Ideally the expression would be best rewritten if(obj2.equals(value))  as we
have already tested obj2 for nullness at the start of the contains method.

Now the hard part, I don¹t want to have to recompile the struts code and was
hoping there was a simple workaround.

All suggestions considered at this point.

TIA 

Z.


Re: [S2 2.1.6] Struts2 sucks wrt. OGNL expressions

2009-05-15 Thread Zoran Avtarovski
We upgraded to 2.1.6 and I remember that the messages starting appearing in
the logs.

Here are the two entries in my log4j properties file to restrict output only
to errors:

log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=ERROR
log4j.logger.org.apache.struts2.util.TextProviderHelper=ERROR


Z.


> 
> Zoran Avtarovski schrieb:
>> > It¹s in 2.1.6.
>> >
>> > In fact I was glad they were there and also to be able to get rid of them.
>> >
>> > Z.
>> >   
> 
> In 2.1.6 already? We're using 2.1.6, so then i'd like to know how i
> would enable this.
> 
> Thanks,
> 
> Robert
> 
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 




Re: [S2] - LabelValueBean in struts2

2009-05-15 Thread Zoran Avtarovski
We use them for the ajax calls, by having a standard structure across all
ajax calls it makes life easier. It¹s simple enough to construct your own.
You can even grab the source from S1.

Z.
> 
> Hi,
> 
> I am converting an app from Struts1 to Struts2. It is using LabelValueBean.
> 
> I would like to know is it available in Struts2 / or any other class or
> interface instead of LabelValueBean.
> 
> Thankx




Re: [S2 2.1.6] Struts2 sucks wrt. OGNL expressions

2009-05-15 Thread Zoran Avtarovski
It¹s in 2.1.6.

In fact I was glad they were there and also to be able to get rid of them.

Z.
> 
> Dave Newton schrieb:
>> > Robert Graf-Waczenski wrote:
>>> >> Are there any plans in a (current or) future version of Struts2 to
>>> >> enable such a behavior?
>> >
>> > That was added a month or two ago.
>> >
>> > Dave
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> >
>> >
> 
> So this will be available with the release of 2.1.7, right? (Currently
> 2.1.7 is not yet GA)
> 
> Thanks,
> 
> Robert
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 




OT: Good CSV export library

2009-05-08 Thread Zoran Avtarovski
Hi guys,

I¹m hoping somebody can help me. I need a java library that will take a List
of POJOs and convert to CSV. I¹ve found a truck load that go the other way,
CSV mapped to POJO but I can¹t find a good  one going my way.

I¹m looking for something that produces CSV¹s in the same way that xStream
produces XML files. Something that uses annotations would be fantastic.

I don¹t want to go to the effort of writing one of my own if a good one
already exists.


Z.


Re: determine if iphone user?

2009-05-03 Thread Zoran Avtarovski
If iPhone users are significant enough you¹re better off with an interceptor
to check all incoming requests.

Z.
> 
> 
> Cool, so is there a way to add a getter/setter in my action class to
> automatically pick up the request header, similar to parameters?
> 
> 
> 
>> > Date: Fri, 1 May 2009 15:29:03 -0230
>> > Subject: Re: determine if iphone user?
>> > From: richardsa...@gmail.com
>> > To: user@struts.apache.org
>> > 
>> > I think the HTTP_USER_AGENT header should be similar to:
>> > 
>> > Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+
>> > (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
>> > 
>> > If a request comes from the IPhone browser
>> > 
>> > On Fri, May 1, 2009 at 3:06 PM, Andy  wrote:
>>> > >
>>> > > Hi, is there an easy way to tell in an s2 action if the request is
>>> coming from an iphone/mobile device?
>>> > >
>>> > > Thanks!
>>> > >
>>> > > _
>>> > > Insert movie times and more without leaving Hotmail®.
>>> > > 
>>> http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutori
>>> al_QuickAdd1_052009
>> > 
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> > 
> 
> _
> Hotmail® has a new way to see what's up with your friends.
> http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial
> _WhatsNew1_052009




Re: number formatting (with commas)

2009-05-03 Thread Zoran Avtarovski
Wouldn¹t the appropriate currency symbol be in the locale properties? I
expect you would have a separate package.properties file for each locale.

Z.
> 
> akoo wrote:
>> > I am not sure actually, it was just an example I pulled the roseindia site.
>> > This is all quite new to me.
> 
> (Be wary of roseindia tutorials.)
> 
> Chris is right; it's just a positional parameter--not sure what I was
> thinking when I wrote my original response.
> 
> Dave
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 




Re: Any hint of JQuery on struts2 tutorial, thanks!

2009-04-30 Thread Zoran Avtarovski
We¹ve been using jQuery in a Struts2 project without any real issues. We¹re
not using the plugin.

If you¹ve got your head around struts and jQuery, I don¹t see what the
problem is. Using jQuery with S2 is just like using jQuery anywhere. In fact
it¹s quite liberating not to be limited by the predefined tags.

Z.
> 
> 
> Thanks, actually I want more, like examples from this link:
> http://www.instantshift.com/2009/02/05/40-excellent-jquery-tutorials/
> 
> Is it durable for me to learn how to implement them in struts2?
> If there're online tutorial or book tutorial about this issue, it will be
> fantastic for me
> 
> 
> dusty wrote:
>> > 
>> > Perhaps you are looking for some basic "tidbits" you may commonly use:
>> > 
>> > a) Calendar pop-up
>> > b) Ajax calls with JSON response from Struts
>> > c) Simple element hide/show
>> > 
>> > Can you build a list like this of things you need to build your UI or are
>> > you looking more for skill building sources?
>> > 
>> > 
>> > fireapple wrote:
>>> >> 
>>> >> Thank you! It seems I have a lot to learn:-)
>>> >> 
>>> >> 
>>> >> Wes Wannemacher wrote:
 >>> 
 >>> On Tue, Apr 28, 2009 at 10:39 AM, fireapple 
 >>> wrote:
> 
>  Hi, Wes, on the table of content of the book, I didn't find anything
>  related
>  to JQuery and Struts2. Since JQuery is similar with JavaScript, can
we
>  say
>  we can use JQuery in Struts2 as soon as we can use JavaScript in
>  Struts2?
>  Thank you. I'm a new programmer with stupid questions,:-)
> 
> 
> 
 >>> 
 >>> JQuery is a JavaScript framework/library, so if you are using JQuery
 >>> with Struts2, then you are using JavaScript with Struts2. Depending on
 >>> how new you are to programming, there may be better places to start.
 >>> JQuery isn't similar to JavaScript, it is JavaScript in the same way
 >>> that Struts is Java. JQuery takes many of the things that are
 >>> difficult in JavaScript and makes them easier. You are still using
 >>> JavaScript, but rather than writing 20 lines of code, you write just a
 >>> few. Looking back through the ToC, I guess I don't make it clear that
 >>> there is JQuery coverage specifically, but as I mentioned before, the
 >>> examples so far are already using JQuery. It may be hard to pick
 >>> things up through the examples if you are not already experienced with
 >>> the other topics. The example I mentioned to earlier incorporates
 >>> Struts 2 with Spring, JPA, a generic DAO setup, JSON, Struts 2
 >>> Conventions and JQuery. If you've never used JPA or Spring, there
 >>> would be quite a bit thrown at you in one example.
 >>> 
 >>> Depending on your goal, there are a few other routes you might want to
 >>> take before jumping into an advanced book. If you are looking to learn
 >>> more about Struts 2, my book is a follow-up to another book called
 >>> Struts 2 In Action that is a very well-written introduction and
 >>> reference on Struts 2 core topics. If you are already familiar with
 >>> Struts 2, but want to learn more about AJAX, then start by learning a
 >>> bit about JavaScript core and AJAX... Manning has another book
 >>> (http://manning.com/crane/) that has been a good seller for them.
 >>> 
 >>> My book isn't meant to be a reference only on Struts 2 and AJAX. It is
 >>> meant to give examples and best practices for integration with many of
 >>> the popular topics that come up on this list. Plus, it will give
 >>> examples on more advanced topics that haven't come up yet, but will
 >>> (OSGi?)
 >>> 
 >>> -Wes
 >>> 
 >>> 
 >>> -- 
 >>> Wes Wannemacher
 >>> Author - Struts 2 In Practice
 >>> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
 >>> http://www.manning.com/wannemacher
 >>> 
 >>> -
 >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 >>> For additional commands, e-mail: user-h...@struts.apache.org
 >>> 
 >>> 
 >>> 
>>> >> 
>>> >> 
>> > 
>> > 




Re: Submitting a Date to an Action

2009-04-30 Thread Zoran Avtarovski
That¹s exactly right but sometimes you want to use a format that isn¹t the
short format for the locale and I suspect that¹s what is happening with
Richard.

He has two choices, either configure his date time picker to produce the
date in the required format, or as suggested write your own converter. My
only concern with Matt¹s version is that the conversion exception is buried
which will have implications for validation.

Z.


> 
> Hi Richard,
> 
> Have a look at http://struts.apache.org/2.1.6/docs/type-conversion.html
> It says that "dates - uses the SHORT format for the Locale associated with the
> current request"
> 
> May be this will help.
> 
> Thank you.
> Regards,
> Kishan.G
>  
> Senior Software Engineer.
> www.spansystems.com
> 
> 
> 
> 
> -Original Message-
> From: Richard Sayre [mailto:richardsa...@gmail.com]
> Sent: Thursday, April 30, 2009 4:14 PM
> To: Struts Users Mailing List
> Subject: Re: Submitting a Date to an Action
> 
> Thank you.  I will give it a try.
> 
> On Thu, Apr 30, 2009 at 1:22 AM, Matt Jiang  wrote:
>> > Hi
>> >
>> > It is nothing about date picker tag. You can have a Converter to convert
>> > String to Date and vice versa.
>> > Below is my implementation for your reference:
>> > (For DateUtil, please replace with yours)
>> >
>> > public class DateConverter extends StrutsTypeConverter {
>> >
>> >  private static final String PATTERN = DateUtil.PATTERN__MM_DD;
>> >
>> > �...@override
>> >  /**
>> >   * Converts one or more String values to the specified class.
>> >   *
>> >   * @param context the action context
>> >   * @param values  the String values to be converted, such as those
>> > submitted from an HTML form
>> >   * @param toClass the class to convert to
>> >   * @return the converted object
>> >   */
>> >  public Object convertFromString(Map context, String[] values, Class
>> > toClass) {
>> >
>> >    Date returnObject = null;
>> >    String value = values[0];
>> >    if (value != null && !value.trim().equals("")) {
>> >      try {
>> >        returnObject = DateUtil.parseDate(value, PATTERN);
>> >      } catch (ParseException e) {
>> >        // Just to ignore the parse exception
>> >      }
>> >    }
>> >    return returnObject;
>> >  }
>> >
>> > �...@override
>> >  /**
>> >   * Converts the specified object to a String.
>> >   *
>> >   * @param context the action context
>> >   * @param o       the object to be converted
>> >   * @return the converted String
>> >   */
>> >  public String convertToString(Map context, Object o) {
>> >
>> >    Date date = (Date) o;
>> >    String formatedDate = DateUtil.dateFormater(date, PATTERN);
>> >    return formatedDate;
>> >  }
>> > }
>> >
>> >
>> >
>> > On Thu, Apr 30, 2009 at 1:19 AM, Richard Sayre
>> wrote:
>> >
>>> >> I have an Action with a date attribute
>>> >>
>>> >> private Date myDate;
>>> >>
>>> >> public void setMyDate(Date myDate) {
>>> >> this.myDate = myDate;
>>> >> }
>>> >>
>>> >> I have a form that has a date picker (not the struts 2 date picker)
>>> >> that populates a text field.  When I submitt the form to my action the
>>> >> property does not get set because Struts 2 is looking for
>>> >> setMyDate(String myDate).
>>> >>
>>> >> How do I tell Struts that the field is a Date?
>>> >>
>>> >>
>>> >> Thank you,
>>> >>
>>> >> Rich
>>> >>
>>> >> -
>>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> >> For additional commands, e-mail: user-h...@struts.apache.org
>>> >>
>>> >>
>> >
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 




Re: What is wrong with my with OGNL Map expression??

2009-04-30 Thread Zoran Avtarovski
Just to reiterate what Dale said, we¹ve taken to using the %{} across the
board as we were having problems with conflicts. In my experience this has
slowed my hair loss significantly.

Z.
> 
> Michael Griffith wrote:
>>  > I have a Map in the HttpSession
>>  > The map is stored in the session as an attribute named
>>  > genieProperties...
> 
> Kishan G. Chellap Paandy wrote:
>> > Assuming there's an attribute with name 'mySessionAttribute' in the
>> > Session scope 
>> > 
> 
> Which gets you half way there.  It gets you the Map.  To get the value
> you want from it, just call it's get method:
> 
> 
> 
> The %{} are often left out by people, but they're critical.  That's what
> says "this is an OGNL expression".  Musachy's response illustrates the
> potential confusion as to what EL you're using when it's not specified.
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 




Re: Open an excel in Struts application

2009-04-26 Thread Zoran Avtarovski
You can also use the plain old stream result type and pipe the HSSF
worksheet as you would any other file type. Saves on the overhead of another
unnecessary plugin.

Z.
> 
> 
> 
> When/if you use the JasperReports plugin use an older version of poi (3.0 is
> the latest I had success with). The new poi throws an exception which many
> have complained about but has not been fixed/
> Chris
> 
> 
> 
> -Original Message-
> From: renisha 
> To: user@struts.apache.org
> Sent: Sun, 26 Apr 2009 1:30 pm
> Subject: Re: Open an excel in Struts application
> 
> 
> 
> 
> Thanks for your reply . I am using struts2 version. Could you please give me
> some sampl code if you have.
> 
> Wes Wannemacher wrote:
>> > 
>> > On Sunday 26 April 2009 11:00:59 am renisha wrote:
>>> >> Hi,
>>> >>
>>> >> I am reading some values from database , doing some calculations and
>>> >> creating an excel file.
>>> >>
>>> >> In my action class , I am returning an HSSFWorkbook object and I need to
>>> >> diaply the excel file as the output . Please let me know how do I get it
>>> >> working .
>> > 
>> > 
>> > Which version of Struts?
>> > 
>> > I would suggest if you are using Struts 2, then take a look at the Jasper
>> > Reports plugin, there is XLS output from there.
>> > 
>> > -Wes
>> > 
>> > -- 
>> > 
>> > Wes Wannemacher
>> > Author - Struts 2 In Practice
>> > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
>> > http://www.manning.com/wannemacher
>> > 
>> > 
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> > 
>> > 
>> > 




Re: Struts 2 using Quartz

2009-04-20 Thread Zoran Avtarovski
We use spring as standard to setup the struts2 actions so it was a simple
matter of adding some config information to the applicationContext.xml file.
The spring site has comprehensive documentation.

Z. 
> 
> 
> 
> Hi all,
>  
> I'm using struts 2.0.6. I have requirement to write an logic in
> action file. Where that
> action should be schedule in (daily or weekly). For that , i have used
> Quartz in struts 1. It was working fine
> as per this site details. http://demo.jgsullivan.com/struts/
>I want to know how we can use quartz in struts 2. In struts 1 ,
> we have quartz-config.xml, there
> we can define our action  and trigger logic. If,anyone come across this
> requirement give me a suggestions.




Re: Display BigDecimal Format

2009-03-08 Thread Zoran Avtarovski
I did end up writing a custom type converter, but I really think that¹s
overkill. It would be great if there were a way to specify the BigDecmal
scale in the struts properties, or xwork-conversion properties.

Am I off the mark here or is it worthwhile doing something and submitting as
a patch?

Z.
> 
> Thanks Seshagari,
> 
> But I¹d have to do this in every action and on every form. I might just
> write a customConverter for BigDecimals and place it in my xwork properties
> file.
> 
> Z.
>> > 
>> > Hi
>> > 
>> > Follows  anapest code,  in  your action class. Me be resolved  your
>> problem.
>> > // Round two decimal function
>> > double roundTwoDecimals(double amout) {
>> > DecimalFormat twoCurrencyDecimalForm = new
>> > DecimalFormat(getText("#.##"));
>> > return Double.valueOf(twoCurrencyDecimalForm.format(amout));
>> > }
>> > 
>> > Thank you,
>> > Seshagiri V
>> > seshagi...@kensium.com.
>> >  
>> > US Main: 877 KENSIUM (536.7486)
>> > US Fax:   312.242.3029
>> >  
>> > Kensium
>> > 200 S Wacker Dr, Suite 3100
>> > Chicago, IL 60606
>> >  
>> > Confidentiality Note:
>> > -
>> > The information contained in this e-mail is strictly confidential and for
>> > the intended use of the addressee only. Any disclosure, use or copying of
>> > the information by anyone other than the intended recipient is prohibited.
>> > If you have received this message in error, please notify the sender
>> > immediately by return e-mail and securely discard this message.
>> >  
>> >  
>> > 
>> > -Original Message-
>> > From: Zoran Avtarovski [mailto:zo...@sparecreative.com]
>> > Sent: Thursday, March 05, 2009 3:49 PM
>> > To: Struts Users Mailing List
>> > Subject: Display BigDecimal Format
>> > 
>> > Our forms have some currency and and we need to display to 2 decimal points
>> > when the data is prepopulated.
>> > 
>> > At the moment is displays as a single decimal point. I could specify all >>
the
>> > relevant fields in a package.properties file but I¹d like to do it across
>> > the board for big decimals.
>> > 
>> > Do I have to create a custom type converter or is there a property I could
>> > set.
>> > 
>> > Z.
>> > 
>> > 
>> > 
>> > No virus found in this incoming message.
>> > Checked by AVG - www.avg.com
>> > Version: 8.0.237 / Virus Database: 270.11.8/1984 - Release Date: 03/04/09
>> > 19:17:00
>> > 
>> > 
>> > -
>> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> > For additional commands, e-mail: user-h...@struts.apache.org
>> > 
> 
> 




Re: Date time picker

2009-03-05 Thread Zoran Avtarovski
It’s one of plugins in the plugin repository:

http://code.google.com/p/struts2jscalendarplugin/

It’s not the best implementation of the time but it works and time was of
the essence. It uses dropdowns for the time. I’ve had to modify the code a
little because of some locale specific issues, let me know if you have any
issues I can send you the updated stuff.

I’m tracking development of the jQuery based date/time wigit. It looks
impressive but far from ready for primetime.

Z.
> 
> 
> Zoran
> 
> where did you find jscalendar?
> how does it render both date and time?
> 
> Martin 
> __
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official business
> of Sender. This transmission is of a confidential nature and Sender does not
> endorse distribution to any party other than intended recipient. Sender does
> not necessarily endorse content contained within this transmission.
> 
> 
> 
> 
>> > Date: Thu, 5 Mar 2009 21:13:18 +1100
>> > Subject: Re: Date time picker
>> > From: zo...@sparecreative.com
>> > To: user@struts.apache.org
>> > 
>> > No need. I found the plugin for jscalendar which does exactly what I need
>> > and dropped in without a hitch.
>> > 
>> > Z.
>>> > > 
>>> > > 
>>> > > Hi,
>>> > > 
>>> > > I¹m hoping somebody can help.
>>> > > 
>>> > > I need a date and time picker. The dojo based one is either a date or
>>> time
>>> > > picker, but not both.
>>> > > 
>>> > > Does anybody know of a good date and time picker I can use or
>>> suggestions on
>>> > > how to easily combine the dojo date and time picker to combine.
>>> > > 
>>> > > Z.
>> > 
>> > 
> 
> _
> Windows Live™ Contacts: Organize your contact list.
> http://windowslive.com/connect/post/marcusatmicrosoft.spaces.live.com-Blog-cns
> !503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009




Re: Display BigDecimal Format

2009-03-05 Thread Zoran Avtarovski
Thanks Seshagari,

But I¹d have to do this in every action and on every form. I might just
write a customConverter for BigDecimals and place it in my xwork properties
file.

Z.
> 
> Hi
> 
> Follows  anapest code,  in  your action class. Me be resolved  your problem.
> // Round two decimal function
> double roundTwoDecimals(double amout) {
> DecimalFormat twoCurrencyDecimalForm = new
> DecimalFormat(getText("#.##"));
> return Double.valueOf(twoCurrencyDecimalForm.format(amout));
> }
> 
> Thank you,
> Seshagiri V
> seshagi...@kensium.com.
>  
> US Main: 877 KENSIUM (536.7486)
> US Fax:   312.242.3029
>  
> Kensium
> 200 S Wacker Dr, Suite 3100
> Chicago, IL 60606
>  
> Confidentiality Note:
> -
> The information contained in this e-mail is strictly confidential and for
> the intended use of the addressee only. Any disclosure, use or copying of
> the information by anyone other than the intended recipient is prohibited.
> If you have received this message in error, please notify the sender
> immediately by return e-mail and securely discard this message.
>  
>  
> 
> -Original Message-
> From: Zoran Avtarovski [mailto:zo...@sparecreative.com]
> Sent: Thursday, March 05, 2009 3:49 PM
> To: Struts Users Mailing List
> Subject: Display BigDecimal Format
> 
> Our forms have some currency and and we need to display to 2 decimal points
> when the data is prepopulated.
> 
> At the moment is displays as a single decimal point. I could specify all the
> relevant fields in a package.properties file but I¹d like to do it across
> the board for big decimals.
> 
> Do I have to create a custom type converter or is there a property I could
> set.
> 
> Z.
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.237 / Virus Database: 270.11.8/1984 - Release Date: 03/04/09
> 19:17:00
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 




Display BigDecimal Format

2009-03-05 Thread Zoran Avtarovski
Our forms have some currency and and we need to display to 2 decimal points
when the data is prepopulated.

At the moment is displays as a single decimal point. I could specify all the
relevant fields in a package.properties file but I¹d like to do it across
the board for big decimals.

Do I have to create a custom type converter or is there a property I could
set.

Z.




Re: Date time picker

2009-03-05 Thread Zoran Avtarovski
No need. I found the plugin for jscalendar which does exactly what I need
and dropped in without a hitch.

Z.
> 
> 
> Hi,
> 
> I¹m hoping somebody can help.
> 
> I need a date and time picker. The dojo based one is either a date or time
> picker, but not both.
> 
> Does anybody know of a good date and time picker I can use or suggestions on
> how to easily combine the dojo date and time picker to combine.
> 
> Z.




Date time picker

2009-03-04 Thread Zoran Avtarovski
Hi,

I¹m hoping somebody can help.

I need a date and time picker. The dojo based one is either a date or time
picker, but not both.

Does anybody know of a good date and time picker I can use or suggestions on
how to easily combine the dojo date and time picker to combine.

Z.


Tooltips Not working in 2.1.6

2009-01-20 Thread Zoran Avtarovski
I¹ve just upgraded an app from 2.0.xx to 2.1.6 and found that the s:select
tag is incorrectly rendering the tooltip html.

I¹ve gone back to defaults and this is what¹s being produced::

Payment Type:
 
  alt=" Tooltip copy goes here."



You¹ll notice that the img tag is closed before the alt parameter. It looks
like it¹s an error in the freemarker template that needs to be rectified.

Z.


Re: smart URLs

2008-12-10 Thread Zoran Avtarovski
Not to be rude, but I don¹t think the smart url plugin exists anymore. I had
the impression it was folded into the convention plugin. As far as mapping
params I¹m not sure it does what Anders was after. Somebody with more
experience with the convention plugin can answer that better.

Z.
> 
> the question is how to implement smart url :)
> 
> so is there a relevan example or is this plugins not ready yet
> 
> f
> 
> On Thu, Dec 11, 2008 at 4:05 AM, Martin Gainty <[EMAIL PROTECTED]> wrote:
> 
>> >
>> >
>> > was wondering what encryption to use when clear-text params are coming
>> > across the wire
>> >
>> > thanks,
>> > Martin
>> > __
>> > Disclaimer and confidentiality note
>> > Everything in this e-mail and any attachments relates to the official
>> > business of Sender. This transmission is of a confidential nature and
>> Sender
>> > does not endorse distribution to any party other than intended recipient.
>> > Sender does not necessarily endorse content contained within this
>> > transmission.
>> >
>> >
>> >
>> >
>>> > > Date: Thu, 11 Dec 2008 07:47:52 +1100
>>> > > Subject: Re: smart URLs
>>> > > From: [EMAIL PROTECTED]
>>> > > To: user@struts.apache.org
>>> > >
>>> > > We¹ve been using UrlRewrite ( http://tuckey.org/urlrewrite/) for a while
>>> > > with absolutely no issues.
>>> > >
>>> > > Z.
 > > >
 > > >
 > > > For a CMS project I require the following functionality:
 > > >
 > > > Translate/map a URL like
 > > > 'http://www.mydomain.com/marketnews/asiapacific/latest' into an 
action
>> > with
 > > > request parameters 'marketnews', 'asiapacific', 'latest'.
 > > >
 > > > Background:
 > > >
 > > > I have a virtual file/folder system in a database and want to map a
URL
>> > into
 > > > the file system to retrieve content.
 > > >
 > > > Alternatively, I have used this method in the past:
 > > >
 > > >
>> > http://www.mydomain.com/content.action?path=marketnews/asiapacific/latest
 > > >
 > > >
 > > > Thank you for suggestions and comments.
 > > >
 > > > Anders
>>> > >
>>> > >
>> >
>> > _
>> > Send e-mail faster without improving your typing skills.
>> >
>> > 
>> http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_12
>> 2008
>> >
> 
> 




  1   2   3   >