Author Login
Post Reply
user Digest 16 Mar 2008 17:38:59 -0000 Issue 7929
Topics (messages 184295 through 184312):
Re: Exception in Validation
184295 by: Dave Newton
184296 by: aum strut
184297 by: Dave Newton
184298 by: Martin Gainty
184299 by: Dave Newton
184302 by: aum strut
184303 by: Lukasz Lenart
184304 by: aum strut
184305 by: Lukasz Lenart
184309 by: aum strut
184310 by: Dave Newton
184311 by: aum strut
184312 by: aum strut
Re: redirection problem
184300 by: Martin Gainty
Wildcard mapping should not suck (but does)
184301 by: stanlick
Re: Multiple Actions for a single page. Is this possible
184306 by: ravi_eze
Re: [struts] Wildcard mapping should not suck (but does)
184307 by: Dale Newfield
184308 by: stanlick
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_184295.ezm (zipped)--- aum strut <aum.struts@(protected):
> TestExample.java. i have two files namely validators.xml
Why are you creating a validators.xml?
That aside, you don't have a grammar in the validators.xml, which is exactly
what the error message states.
Dave

Attachment:
user_184296.ezm (zipped)Hi Dave,
Thanks for the rply..
i have already removed validators.xml
i am not sure about the two points:
1) i am only using the two fields in my input form:
namely Name and password.
the name of the action is TestExample i have created a
TestExample-validation.xml file with following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="name">
<field-validator type="requiredstring">
<message>You must enter a value for Name</message>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message>You must enter a valid password</message>
</field-validator>
</field>
</validators>
what is meant by grammer not defined?? as i am not getting it.
2) can u plz specify the exact location for the above XML file.
-aum
On 3/15/08, Dave Newton <newton.dave@(protected):
>
> --- aum strut <aum.struts@(protected):
> > TestExample.java. i have two files namely validators.xml
>
> Why are you creating a validators.xml?
>
> That aside, you don't have a grammar in the validators.xml, which is
> exactly
> what the error message states.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184297.ezm (zipped)--- aum strut <aum.struts@(protected):
> what is meant by grammer not defined?? as i am not getting it.
Are you still getting the error after removing validators.xml?
If not, it probably means that the XML parser was expecting there to be an
XML grammar (like a DTD) specified in the XML file.
If you're still getting the error then repost the file as it is now.
> 2) can u plz specify the exact location for the above XML file.
In the same package the action is in.
Dave

Attachment:
user_184298.ezm (zipped)sounds as if you might possibly a Speech to Text engine you're working with?
check the referenced DTD is a valid 'grammar DTD'
http://www.w3.org/TR/2001/WD-speech-grammar-20010820/#AppB
(or post it here and we can check for you..)
Martin-
----- Original Message -----
From: "Dave Newton" <newton.dave@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Saturday, March 15, 2008 1:08 PM
Subject: Re: Exception in Validation
> --- aum strut <aum.struts@(protected):
> > TestExample.java. i have two files namely validators.xml
>
> Why are you creating a validators.xml?
>
> That aside, you don't have a grammar in the validators.xml, which is
exactly
> what the error message states.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184299.ezm (zipped)--- Martin Gainty <mgainty@(protected):
> sounds as if you might possibly a Speech to Text engine you're working
> with? check the referenced DTD is a valid 'grammar DTD'
> http://www.w3.org/TR/2001/WD-speech-grammar-20010820/#AppB
?!
The validators.xml didn't have a doctype with a DTD in it. Some XML parsers
will complain about that, and the exception message (no grammar found, or
something like that) tends to point me in that direction, particularly since
the exception occurred on a form submission with validation.
Dave

Attachment:
user_184302.ezm (zipped)Hi Dave,
I have removed validators.xml.
i have put the TestExample-validation.xml in the same folder where my action
is placed.
now it is not giving me any error but validation is not working at all.
belw is snap shop of my TestExample-validation.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="name">
<field-validator type="requiredstring">
<message>You must enter a value for Name</message>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message>You must enter a valid password</message>
</field-validator>
</field>
</validators>
i have only tow fildes namely:
1) Name
2)Password
any pointer about the problem will be much appriciated.
--aum
On 3/16/08, Dave Newton <newton.dave@(protected):
>
> --- Martin Gainty <mgainty@(protected):
> > sounds as if you might possibly a Speech to Text engine you're working
> > with? check the referenced DTD is a valid 'grammar DTD'
> > http://www.w3.org/TR/2001/WD-speech-grammar-20010820/#AppB
>
> ?!
>
> The validators.xml didn't have a doctype with a DTD in it. Some XML
> parsers
> will complain about that, and the exception message (no grammar found, or
> something like that) tends to point me in that direction, particularly
> since
> the exception occurred on a form submission with validation.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184303.ezm (zipped)Hi,
How do you start your project? With maven2 maybe? The xml file have to
be in the same output directory, next to compiled class. If you use
maven2, put your xml in to folder resources with the same path as for
action class.
Regards
--
Lukasz
http://www.linkedin.com/in/lukaszlenart

Attachment:
user_184304.ezm (zipped)i am using myeclipse for the development purpose
and putting the file in the same folderwhere action class mean .java class
is placed..
its neithergiving me any error or exception nor doing any validation
On 3/16/08, Lukasz Lenart <lukasz.lenart@(protected):
>
> Hi,
>
> How do you start your project? With maven2 maybe? The xml file have to
> be in the same output directory, next to compiled class. If you use
> maven2, put your xml in to folder resources with the same path as for
> action class.
>
>
> Regards
> --
> Lukasz
>
> http://www.linkedin.com/in/lukaszlenart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184305.ezm (zipped)Ok, check if xml file is in WebRoot/WEB-INF/classes/<path>
Regards
--
Lukasz
http://www.linkedin.com/in/lukaszlenart

Attachment:
user_184309.ezm (zipped)yes it is there in the same folder
structure is
1)WebRoot\WEB-INF\classes\TestExample-validation
where as my class file for the action is in
2)WebRoot\WEB-INF\classes\aum
and if i will put it in the aum folder it is giving error.while it is
neithergiving any error nor performing validation when placed in the path
mentioned in point 1.
--aum
On 3/16/08, Lukasz Lenart <lukasz.lenart@(protected):
>
> Ok, check if xml file is in WebRoot/WEB-INF/classes/<path>
>
>
> Regards
> --
> Lukasz
>
> http://www.linkedin.com/in/lukaszlenart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184310.ezm (zipped)--- aum strut <aum.struts@(protected):
> structure is
> 1)WebRoot\WEB-INF\classes\TestExample-validation
>
> where as my class file for the action is in
>
> 2)WebRoot\WEB-INF\classes\aum
>
> and if i will put it in the aum folder it is giving error.while it is
> neithergiving any error nor performing validation when placed in the path
> mentioned in point 1.
The path in (1) is wrong: it needs to be in the SAME PACKAGE as the action
class.
Please post the precise error message you're getting.
Dave

Attachment:
user_184311.ezm (zipped)
Attachment:
user_184312.ezm (zipped)
Attachment:
user_184300.ezm (zipped)a test harness
import
com.mockobjects.dynamic.C;
com.opensymphony.xwork2.ActionInvocation invocation=
(
com.opensymphony.xwork2.ActionInvocation) new
Mock(
com.opensymphony.xwork2.ActionInvocation.class).proxy();
org.apache.struts2.dispatcher.HttpHeaderResult result=new
org.apache.struts2.dispatcher.HttpHeaderResult();
com.mockobjects.dynamic.Mock responseMock = new
com.mockobjects.dynamic.Mock(
javax.servlet.http.HttpServletResponse.class);
javax.servlet.http.HttpServletResponse response=
(
javax.servlet.http.HttpServletResponse) responseMock.proxy();
org.apache.struts2.ServletActionContext.setResponse(response);
XWorkConverter.getInstance().setObjectTypeDeterminer(com.opensymphony.xwork2
util.ObjectTypeDeterminerFactory.getInstance());
//parameters
java.util.Map params = new
java.util.HashMap();
params.put("headers.ajax", "${ajax}");
//values..
java.util.Map values = new
java.util.HashMap();
values.put("ajax", "ajax");
//push the values into context stack
com.opensymphony.xwork2.ActionContext.getContext().getValueStack().push(valu
es);
//make OGNL accessible
com.opensymphony.xwork2.util.OgnlUtil.setProperties(params, result);
//populate MockObject with a header
responseMock.expect("addHeader", C.args(C.eq("ajax"),
C.eq("ajax")));
//execute
result.execute(invocation);
//end server code
//client side
//some dojo javascript to test client functionality..
var headers=http.getAllResponseHeaders();
var ret={};
ret.toString=function()
{
return headers;
};
var key_value=headers.split(/[\r\n]+/g);
for(var i=0;i<key_value.length;i++)
{
var pair=key_value[i].match(/^([^:]+)\s*:\s*(.+)$/i);
if(pair)
{
key=pair[1];
value=pair[2];
}
anyone else?
Martin
----- Original Message -----
From: "Jeromy Evans" <jeromy.evans@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Saturday, March 15, 2008 5:50 AM
Subject: Re: redirection problem
> This discussion should give you some ideas:
>
> http://www.nabble.com/Interceptors-with-Ajax-Actions-td15706322.html
>
>
> matthieu martin wrote:
> > Hi all.
> >
> > I am handling login issue through an interceptor. Basically it looks in
the
> > session if a user entry exists before letting you go through to the
> > administration panels. This works fine.
> >
> > In my admin, I use a lot of Ajax (with dojo) so I never have a single
full
> > page reload. I use submits or anchor tags to do that. Those tags use the
> > "targets" parameter to know which part of the page is to be refreshed.
> >
> > And here is my problem :
> >
> > I click on a <s:a> or a <s:submit> tag, my interceptor catches the
request,
> > sees that I am not logged in anymore, and does the redirection towards
the
> > login page ... inside the div specified as a target !
> >
> > I understand very well this matter, and it's all too logical.
Nevertheless,
> > I've been turning this issue upside down for days now and I can't figure
a
> > way to refresh the whole page when I'm not logged in anymore, or only
> > refresh the div I want when my interceptor says everything's fine.
> >
> > Is there a way to break to target parameter so that I could simply
redirect
> > toward an action which would refresh the whole page ?
> >
> > Does anyone have an idea ?
> >
> > I'm sort of out of solutions ....
> >
> > Matthieu
> >
> >
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG.
> > Version: 7.5.519 / Virus Database: 269.21.7/1329 - Release Date:
14/03/2008 12:33 PM
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184301.ezm (zipped)
I am writing what should have been the simplest three page wizard ever. It
involves a single wildcard action mapping
<action name="wizard_*" class="acme.action.wizard.Wizard" method="{1}">
<interceptor-ref name="starterStack">
session
</interceptor-ref>
<result name="input">/pages/wizard/${currentPage}.jsp</result>
<result>/pages/wizard/${currentPage}.jsp</result>
</action>
and four pages
pageOne.jsp, pageTwo.jsp, pageThree.jsp, and thanks.jsp.
Three pages need to be validated so I created
Wizard-wizard_pageTwo-validation.xml [validate page1]
Wizard-wizard_pageThree-validation.xml [validate page2]
Wizard-wizard_pagedone-validation.xml [validates page3]
After hours of messing around with web pages coded as follows:
<html>
<body>
<H2>Page One</H2>
<s:form>
blah, blah, blah
<s:submit method="pageTwo" key="next"/>
</s:form>
</body>
</html>
I discovered the method attribute of the <s:submit /> tag ignores the
validation completely! After reading through the DefaultActionMapper source
code I discovered the METHOD_PREFIX case of the PrefixTrie logic does not
handle this case correctly so I started looking for the one-off technique.
I modified my pages by changing the <s:submit /> tag as follows
<s:submit action="wizard_pageTwo" key="next"/>
Now the validations are being considered, however pages 2, and 3 do not
output any error messages associated with the fields failing their
validations. The navigation to a successive page is prevented (which is
correct) but the user has no idea what is wrong! I have looked over the
files a dozen times and cannot figure this one out. Does anyone have any
clues?
Thanks,
Scott
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184306.ezm (zipped)
hi,
We have a form in c.jsp which by some event makes an ajax call fetching
b.jsp, a.jsp and rendering it. Now the requirement is that
(1) i want to get this b.jsp by calling some other action class.
(2) Once its rendered and i submit the page c.jsp the consecutive action
class should be able to get all the entries made even in the b.jsp & a.jsp
(obtained by ajax call)
i am not sure how action chanining/ s:action can help me.
any hlep / pointers?
regards,
ravi
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184307.ezm (zipped)stanlick wrote:
> I discovered the method attribute of the <s:submit /> tag ignores the
> validation completely!
Not only this, but it's also a potential security hole, and might be
going away or being made to require more configuration in the future.
Why are you specifying the action in the submit tag instead of the form
tag? (Even though you are using a single action definition, there
really are multiple actions in play here.)
-Dale

Attachment:
user_184308.ezm (zipped)
I had been using only the method attribute on the <s:submit/> tag until
discovering it was causing to water to run uphill when it came to the
validators. I started experimenting and landed on moving the method
settings over to the action on the tag. I toyed around with deferring to
the action attribute on the <s:form/> tag at one point but didn't see any
change.
So do you see any reason why my field errors are not being generated in the
HTML from the <s:textfield/> tags?
Scott
DNewfield wrote:
>
> stanlick wrote:
>> I discovered the method attribute of the <s:submit /> tag ignores the
>> validation completely!
>
> Not only this, but it's also a potential security hole, and might be
> going away or being made to require more configuration in the future.
> Why are you specifying the action in the submit tag instead of the form
> tag? (Even though you are using a single action definition, there
> really are multiple actions in play here.)
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.