Dojo, input=file and struts2 problem

2008-10-09 Thread Jeroen Simons
I have a very weird problem and I hope somebody can tell me where to  
look for a solution.


Using the code below everything works as expected. On form submission  
an ajax call is made to the alert() method which simply forwards to  
alert.jsp which alerts the filled in text and a dom reference of the  
form.


As soon as i add a input type=file or s:file to my form, the  
alert does not have a reference to the form anymore and the 2nd alert  
fails.


Thanks,

Jeroen

This is my code:

@Namespace(value = /ajax)
@Results({
@Result(name = success, value = test.jsp),
@Result(name = alert, value = alert.jsp)
})
public class TestAction extends ActionSupport {

public String alert() throws Exception {
return alert;
}

private String text;

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}
}

alert.jsp:

script type=text/javascript
alert(${text});
alert(document.getElementById(testForm));
/script

test.jsp:

%@ taglib prefix=s uri=/struts-tags%
html
head
s:head theme=ajax /
/head
body

s:form id=testForm name=testForm  
onsubmit=dojo.event.topic.publish('alert_text');return false;   
enctype=multipart/form-data

Text: s:textfield name=text /
br /
s:submit  /
/s:form

s:url id=url action=test method=alert namespace=/ajax /
s:div executeScripts=true showLoadingText=false  
id=testdiv href=%{url} theme=ajax

   listenTopics=alert_text formId=testForm /

/body
/html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



FileUpload + Token interceptor problem

2008-09-30 Thread Jeroen Simons

Hi,

I have a problem when using the token and fileUpload interceptor  
together (Struts 2.0.11.2).


When I put fileUpload before token in my interceptor stack and I  
upload a file larger than the maximum allowed I get 2 error messages:


*  the request was rejected because its size (14544755) exceeds  
the configured maximum (2097152)
* The form has already been processed or no token was supplied,  
please try again.


When I put token before fileUpload in my interceptor stack and I  
upload a file larger than the maximum allowed I get 1 error messages:


* The form has already been processed or no token was supplied,  
please try again.


Does someone know how to get just the one error message when  
uploading a file larger than maximum ?

And only get the token error message when posting the form twice ?

Thanks!

Jeroen




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



I18n problem with annotation validation

2008-09-24 Thread Jeroen Simons

Hi,

I have a i18n problem when validating a field in my action. (Struts  
2.0.11.2)


My validation:
@RequiredStringValidator(
fieldName = user.username, key = error.required, message = )

My resource bundle reads this:
error.required=${getText(fieldName)} is required.

To have a localised fieldName in my error.required message I have to  
specify a key/value in my resource bundle like this:

user.username=Username.

This will result in an error message called Username is required.

This is not really convenient. I will then have to specify a lot of  
double entries in my resource bundle (unless I use more than 1  
bundle). I could have another form with a field called username and I  
will need to specify another field called username=Username or  
username=${getText('user.username')}


Is there a solution for passing on args to key=error.required and  
then use:

error.required={0} is required.

I tried already using the message in @RequiredStringValidator

@RequiredStringValidator(
	fieldName = user.username, key = error.required, message =  
prompt.username)


error.required=${getText(message)} is required.

This does not seem to work.

Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]