You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Coast <na...@codeczar.com> on 2006/11/21 21:38:14 UTC
problems using httpunit / rhino with struts validator
Hi,
First off, thanks for the validator - saved me countless hours of
writing js.
I've started trying to introduce httpunit integration tests to my
applications and unfortunately with both js and validator enabled, it
barfs in fine style.
httpunit 1.6.2, validator 1.3.0, rhino js-1.6R3.jar
The errors come when trying to execute js created by the validator
resulting in either "undefined_required" or "undefined_maxlength"
Is anyone else seeing these types of errors or can suggest a workaround?
I can disable js by removing the dependency to the rhino js.jar,
however this prevents me from httpunit testing a number of areas of my app.
exception e.g.
Running com.codeczar.security.user.httpunit.SearchUserTest
org.mozilla.javascript.EcmaError: ReferenceError: "undefined_required"
is not defined. (httpunit#762 (eval)#1)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3289)
at
org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1633)
at
org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1572)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3159)
at script(httpunit#762(eval):1)
at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
at
org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.java:2213)
at
org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.java:2078)
at
org.mozilla.javascript.optimizer.OptRuntime.callSpecial(OptRuntime.java:156)
at org.mozilla.javascript.gen.c7._c17(httpunit:762)
at org.mozilla.javascript.gen.c7.call(httpunit)
at
org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
at org.mozilla.javascript.gen.c9._c1(httpunit:9)
at org.mozilla.javascript.gen.c9.call(httpunit)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3082)
at script.x(httpunit)
at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.jav
a:172)
at
com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
at com.meterware.httpunit.WebForm.submit(WebForm.java:69)
at com.meterware.httpunit.WebForm.submit(WebForm.java:58)
at
com.codeczar.security.user.httpunit.CreateUserTest.getResponse(CreateUserTest.java:77)
at
com.codeczar.security.user.httpunit.CreateUserTest.doCreate(CreateUserTest.java:50)
cheers
Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems using httpunit / rhino with struts validator
Posted by Nathan Coast <na...@codeczar.com>.
Thanks Niall,
perfect, you were right, it was an issue with the jcv_retrieveFormName.
I'll post again when I've figured out whether it's caused by rhino,
validator, httpunit or a combination of all three :)
As a workaround I can override the jcv_retrieveFormName(form) in each
jsp to return the correct value:
function jcv_retrieveFormName(form) {
return "SearchKeyForm";
}
the form is xhtml compliant generated by struts so no name attribute
defined:
<form id="SearchKeyForm" method="post"
action="/i18n-admin/i18n-admin/key/SearchKey.do" onsubmit="return
validateSearchKeyForm(this);">
for some reason, jcv_retrieveFormName drops through to the final case
formName = form.name which resolves to 'undefined'
function jcv_retrieveFormName(form) {
// Please refer to Bugs 31534, 35127, 35294, 37315 & 38159
// for the history of the following code
var formName;
if (form.getAttributeNode) {
if (form.getAttributeNode("id") &&
form.getAttributeNode("id").value) {
formName = form.getAttributeNode("id").value;
} else {
formName = form.getAttributeNode("name").value;
}
} else if (form.getAttribute) {
if (form.getAttribute("id")) {
formName = form.getAttribute("id");
} else {
formName = form.attributes["name"];
}
} else {
if (form.id) {
formName = form.id;
} else {
*****
***** This gets executed
*****
formName = form.name;
}
}
return formName;
}
thanks again, had no idea where to look.
cheers
Nathan
Niall Pemberton wrote:
>
> OK I'm making some assumptions here, so correct me if I'm wrong:
> 1) I assume that the form specific validation functions have been
> correctly generated by the <html:javascript> tag - for example if you
> have a form named "foo", you're getting functions like "foo_requred"
> generated? Can you verify this?
yes, this is generated
function validateSearchKeyForm(form) {
if (bCancel) {
return true;
} else {
var formValidationResult;
formValidationResult = validateMaxLength(form);
return (formValidationResult == 1);
}
}
function SearchKeyForm_maxlength () {
this.a0 = new Array("value.key", "Key can not be greater than 250
characters.", new Function ("varName", "this.maxlength='250'; return
this[varName];"));
this.a1 = new Array("value.description", "Description can not be
greater than 250 characters.", new Function ("varName",
"this.maxlength='250'; return this[varName];"));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems using httpunit / rhino with struts validator
Posted by Niall Pemberton <ni...@gmail.com>.
On 11/22/06, Nathan Coast <na...@codeczar.com> wrote:
> Hi Niall,
>
> thanks for the response. Httpunit handles the http/html side of things
> and delegates to mozilla's rhino jar for a 'standards compliant' java
> implementation of js (not sure how compliant or what version). I'm
> thinking either there's a bug in rhino, alternatively commons-validator
> is generating non-compliant js. I posted here as I'm guessing struts
> contains the biggest community of validator users and figured someone
> else might have come across this.
OK I'm making some assumptions here, so correct me if I'm wrong:
1) I assume that the form specific validation functions have been
correctly generated by the <html:javascript> tag - for example if you
have a form named "foo", you're getting functions like "foo_requred"
generated? Can you verify this?
2) The Validator javascript tries to cater for all browser situations
(standard / non-standard) - so if you look at the
jcv_retrieveFormName() function in validateUtilities.js
(http://tinyurl.com/yz5655) - it tries check on the capability of the
browser by checking for getAttribute, getAttribute node etc before
using them to get the name of the form. My guess is that Rhino is
returning "undefined" as a String rather than "false" for one of these
tests. If you can find out the valid way to get the form name from
Rhino, then you could replace the validateUtilities.js script with
your own custom version where the jcv_retrieveFormName() function
works in your Rhino environment. This is my best guess, but I may be
sending you in the wrong direction - so apologies in advance if thats
the case.
Niall
> Unfortunately I can't find any rhino mailing lists or docs. Any
> validator or rhino experts who can point me in the right direction?
>
> cheers
> Nathan
>
> Niall Pemberton wrote:
> > The tags generate functions based on the form's name - looks like it
> > isn't finding the form's name resulting in your "undefined_required".
> >
> > I've not used httpunit, but I guess you need to get http unit to
> > generate the html as a jsp would do and have it parse the form and set
> > up the dom as the browser would - quite how I'm not sure and I guess
> > its easier said than done.
> >
> > Niall
> >
> > On 11/21/06, Nathan Coast <na...@codeczar.com> wrote:
> >> Hi,
> >>
> >> First off, thanks for the validator - saved me countless hours of
> >> writing js.
> >>
> >> I've started trying to introduce httpunit integration tests to my
> >> applications and unfortunately with both js and validator enabled, it
> >> barfs in fine style.
> >>
> >> httpunit 1.6.2, validator 1.3.0, rhino js-1.6R3.jar
> >>
> >> The errors come when trying to execute js created by the validator
> >> resulting in either "undefined_required" or "undefined_maxlength"
> >>
> >> Is anyone else seeing these types of errors or can suggest a workaround?
> >> I can disable js by removing the dependency to the rhino js.jar,
> >> however this prevents me from httpunit testing a number of areas of my
> >> app.
> >>
> >> exception e.g.
> >>
> >> Running com.codeczar.security.user.httpunit.SearchUserTest
> >> org.mozilla.javascript.EcmaError: ReferenceError: "undefined_required"
> >> is not defined. (httpunit#762 (eval)#1)
> >> at
> >> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
> >>
> >> at
> >> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
> >>
> >> at
> >> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3289)
> >>
> >> at
> >> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1633)
> >>
> >> at
> >> org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1572)
> >> at
> >> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3159)
> >> at script(httpunit#762(eval):1)
> >> at
> >> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
> >> at
> >> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
> >>
> >> at
> >> org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.java:2213)
> >> at
> >> org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.java:2078)
> >> at
> >> org.mozilla.javascript.optimizer.OptRuntime.callSpecial(OptRuntime.java:156)
> >>
> >> at org.mozilla.javascript.gen.c7._c17(httpunit:762)
> >> at org.mozilla.javascript.gen.c7.call(httpunit)
> >> at
> >> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
> >> at org.mozilla.javascript.gen.c9._c1(httpunit:9)
> >> at org.mozilla.javascript.gen.c9.call(httpunit)
> >> at
> >> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3082)
> >> at script.x(httpunit)
> >> at
> >> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
> >> at
> >> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
> >>
> >> at
> >> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
> >> at
> >> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
> >> at
> >> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
> >>
> >> at
> >> com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.jav
> >>
> >> a:172)
> >> at
> >> com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
> >>
> >> at
> >> com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
> >>
> >> at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
> >> at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
> >> at com.meterware.httpunit.WebForm.submit(WebForm.java:69)
> >> at com.meterware.httpunit.WebForm.submit(WebForm.java:58)
> >> at
> >> com.codeczar.security.user.httpunit.CreateUserTest.getResponse(CreateUserTest.java:77)
> >>
> >> at
> >> com.codeczar.security.user.httpunit.CreateUserTest.doCreate(CreateUserTest.java:50)
> >>
> >>
> >> cheers
> >> Nathan
> >>
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems using httpunit / rhino with struts validator
Posted by Niall Pemberton <ni...@gmail.com>.
On 11/22/06, Nathan Coast <na...@codeczar.com> wrote:
<snip>
> Unfortunately I can't find any rhino mailing lists or docs. Any
> validator or rhino experts who can point me in the right direction?
</snip>
http://www.mozilla.org/rhino/doc.html
> cheers
> Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems using httpunit / rhino with struts validator
Posted by Nathan Coast <na...@codeczar.com>.
Hi Niall,
thanks for the response. Httpunit handles the http/html side of things
and delegates to mozilla's rhino jar for a 'standards compliant' java
implementation of js (not sure how compliant or what version). I'm
thinking either there's a bug in rhino, alternatively commons-validator
is generating non-compliant js. I posted here as I'm guessing struts
contains the biggest community of validator users and figured someone
else might have come across this.
Unfortunately I can't find any rhino mailing lists or docs. Any
validator or rhino experts who can point me in the right direction?
cheers
Nathan
Niall Pemberton wrote:
> The tags generate functions based on the form's name - looks like it
> isn't finding the form's name resulting in your "undefined_required".
>
> I've not used httpunit, but I guess you need to get http unit to
> generate the html as a jsp would do and have it parse the form and set
> up the dom as the browser would - quite how I'm not sure and I guess
> its easier said than done.
>
> Niall
>
> On 11/21/06, Nathan Coast <na...@codeczar.com> wrote:
>> Hi,
>>
>> First off, thanks for the validator - saved me countless hours of
>> writing js.
>>
>> I've started trying to introduce httpunit integration tests to my
>> applications and unfortunately with both js and validator enabled, it
>> barfs in fine style.
>>
>> httpunit 1.6.2, validator 1.3.0, rhino js-1.6R3.jar
>>
>> The errors come when trying to execute js created by the validator
>> resulting in either "undefined_required" or "undefined_maxlength"
>>
>> Is anyone else seeing these types of errors or can suggest a workaround?
>> I can disable js by removing the dependency to the rhino js.jar,
>> however this prevents me from httpunit testing a number of areas of my
>> app.
>>
>> exception e.g.
>>
>> Running com.codeczar.security.user.httpunit.SearchUserTest
>> org.mozilla.javascript.EcmaError: ReferenceError: "undefined_required"
>> is not defined. (httpunit#762 (eval)#1)
>> at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3289)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1633)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1572)
>> at
>> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3159)
>> at script(httpunit#762(eval):1)
>> at
>> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
>> at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.java:2213)
>> at
>> org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.java:2078)
>> at
>> org.mozilla.javascript.optimizer.OptRuntime.callSpecial(OptRuntime.java:156)
>>
>> at org.mozilla.javascript.gen.c7._c17(httpunit:762)
>> at org.mozilla.javascript.gen.c7.call(httpunit)
>> at
>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
>> at org.mozilla.javascript.gen.c9._c1(httpunit:9)
>> at org.mozilla.javascript.gen.c9.call(httpunit)
>> at
>> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3082)
>> at script.x(httpunit)
>> at
>> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
>> at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
>>
>> at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
>> at
>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
>> at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
>>
>> at
>> com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.jav
>>
>> a:172)
>> at
>> com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
>>
>> at
>> com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
>>
>> at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
>> at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
>> at com.meterware.httpunit.WebForm.submit(WebForm.java:69)
>> at com.meterware.httpunit.WebForm.submit(WebForm.java:58)
>> at
>> com.codeczar.security.user.httpunit.CreateUserTest.getResponse(CreateUserTest.java:77)
>>
>> at
>> com.codeczar.security.user.httpunit.CreateUserTest.doCreate(CreateUserTest.java:50)
>>
>>
>> cheers
>> Nathan
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems using httpunit / rhino with struts validator
Posted by Nathan Coast <na...@codeczar.com>.
fyi, with httpunit to make a request which then returns you a httpunit
dom, with which you can then programmatically set values in input
fields, click links, submit forms, click buttons etc. Any action which
makes a call to the server returns you a new dom.
Niall Pemberton wrote:
> The tags generate functions based on the form's name - looks like it
> isn't finding the form's name resulting in your "undefined_required".
>
> I've not used httpunit, but I guess you need to get http unit to
> generate the html as a jsp would do and have it parse the form and set
> up the dom as the browser would - quite how I'm not sure and I guess
> its easier said than done.
>
> Niall
>
> On 11/21/06, Nathan Coast <na...@codeczar.com> wrote:
>> Hi,
>>
>> First off, thanks for the validator - saved me countless hours of
>> writing js.
>>
>> I've started trying to introduce httpunit integration tests to my
>> applications and unfortunately with both js and validator enabled, it
>> barfs in fine style.
>>
>> httpunit 1.6.2, validator 1.3.0, rhino js-1.6R3.jar
>>
>> The errors come when trying to execute js created by the validator
>> resulting in either "undefined_required" or "undefined_maxlength"
>>
>> Is anyone else seeing these types of errors or can suggest a workaround?
>> I can disable js by removing the dependency to the rhino js.jar,
>> however this prevents me from httpunit testing a number of areas of my
>> app.
>>
>> exception e.g.
>>
>> Running com.codeczar.security.user.httpunit.SearchUserTest
>> org.mozilla.javascript.EcmaError: ReferenceError: "undefined_required"
>> is not defined. (httpunit#762 (eval)#1)
>> at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3289)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1633)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1572)
>> at
>> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3159)
>> at script(httpunit#762(eval):1)
>> at
>> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
>> at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
>>
>> at
>> org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.java:2213)
>> at
>> org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.java:2078)
>> at
>> org.mozilla.javascript.optimizer.OptRuntime.callSpecial(OptRuntime.java:156)
>>
>> at org.mozilla.javascript.gen.c7._c17(httpunit:762)
>> at org.mozilla.javascript.gen.c7.call(httpunit)
>> at
>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
>> at org.mozilla.javascript.gen.c9._c1(httpunit:9)
>> at org.mozilla.javascript.gen.c9.call(httpunit)
>> at
>> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3082)
>> at script.x(httpunit)
>> at
>> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
>> at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
>>
>> at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
>> at
>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
>> at
>> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
>>
>> at
>> com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.jav
>>
>> a:172)
>> at
>> com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
>>
>> at
>> com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
>>
>> at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
>> at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
>> at com.meterware.httpunit.WebForm.submit(WebForm.java:69)
>> at com.meterware.httpunit.WebForm.submit(WebForm.java:58)
>> at
>> com.codeczar.security.user.httpunit.CreateUserTest.getResponse(CreateUserTest.java:77)
>>
>> at
>> com.codeczar.security.user.httpunit.CreateUserTest.doCreate(CreateUserTest.java:50)
>>
>>
>> cheers
>> Nathan
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problems using httpunit / rhino with struts validator
Posted by Niall Pemberton <ni...@gmail.com>.
The tags generate functions based on the form's name - looks like it
isn't finding the form's name resulting in your "undefined_required".
I've not used httpunit, but I guess you need to get http unit to
generate the html as a jsp would do and have it parse the form and set
up the dom as the browser would - quite how I'm not sure and I guess
its easier said than done.
Niall
On 11/21/06, Nathan Coast <na...@codeczar.com> wrote:
> Hi,
>
> First off, thanks for the validator - saved me countless hours of
> writing js.
>
> I've started trying to introduce httpunit integration tests to my
> applications and unfortunately with both js and validator enabled, it
> barfs in fine style.
>
> httpunit 1.6.2, validator 1.3.0, rhino js-1.6R3.jar
>
> The errors come when trying to execute js created by the validator
> resulting in either "undefined_required" or "undefined_maxlength"
>
> Is anyone else seeing these types of errors or can suggest a workaround?
> I can disable js by removing the dependency to the rhino js.jar,
> however this prevents me from httpunit testing a number of areas of my app.
>
> exception e.g.
>
> Running com.codeczar.security.user.httpunit.SearchUserTest
> org.mozilla.javascript.EcmaError: ReferenceError: "undefined_required"
> is not defined. (httpunit#762 (eval)#1)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
> at
> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3289)
> at
> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1633)
> at
> org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1572)
> at
> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3159)
> at script(httpunit#762(eval):1)
> at
> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
> at
> org.mozilla.javascript.ScriptRuntime.evalSpecial(ScriptRuntime.java:2213)
> at
> org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.java:2078)
> at
> org.mozilla.javascript.optimizer.OptRuntime.callSpecial(OptRuntime.java:156)
> at org.mozilla.javascript.gen.c7._c17(httpunit:762)
> at org.mozilla.javascript.gen.c7.call(httpunit)
> at
> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:95)
> at org.mozilla.javascript.gen.c9._c1(httpunit:9)
> at org.mozilla.javascript.gen.c9.call(httpunit)
> at
> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3082)
> at script.x(httpunit)
> at
> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2248)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
> at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
> at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
> at
> com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.jav
> a:172)
> at
> com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
> at
> com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
> at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
> at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
> at com.meterware.httpunit.WebForm.submit(WebForm.java:69)
> at com.meterware.httpunit.WebForm.submit(WebForm.java:58)
> at
> com.codeczar.security.user.httpunit.CreateUserTest.getResponse(CreateUserTest.java:77)
> at
> com.codeczar.security.user.httpunit.CreateUserTest.doCreate(CreateUserTest.java:50)
>
> cheers
> Nathan
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org