You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Brian Pontarelli <br...@pontarelli.com> on 2007/04/24 02:01:03 UTC
[S2] Validation aliases seem broken
I'm trying to put together a form that uses the bang notation for action
methods and for whatever reason I can't seem to get the aliased
validation XML files to work and have to resort to some fairly nasty
@SkipValidation hacks. Anyone see this also or is there a patch for it
in a version later than 2.0.6?
Here's my example form and action:
<struts:form action="newsPersist!save">
<struts:textarea name="news.article" label="Article body"
labelposition="top" required="true"/>
<struts:textfield name="news.date" label="Post date"
labelposition="top" required="true"/>
<struts:submit name="Submit" value="Submit"/>
</struts:form>
public class NewsPersist extends BaseAction {
private Integer id;
private News news;
@Inject
public NewsPersist(JPAService jpaService, Configuration configuration) {
super(catapultBeanService, configuration);
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public News getNews() {
return news;
}
public void setNews(News news) {
this.news = news;
}
@SkipValidation
public String add() {
return "form";
}
@SkipValidation
public String edit() {
news = jpaService.getById(News.class, id);
if (news == null) {
addActionError("News item was removed.");
return "notFound";
}
return "form";
}
public String save() {
jpaService.persist(news);
return "success";
}
}
And finally, I have a single validation file named:
NewsPersist-validation.xml
What I figured would work was an XML file named:
NewsPersist-save-validation.xml
This doesn't seem to work however. Any ideas?
-bp
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [S2] Validation aliases seem broken
Posted by Brian Pontarelli <br...@pontarelli.com>.
Okay, this doesn't appear to work, unless I'm missing something. I
changed the name a few times and each time it seems as though it is
validating even though I'm not calling the specific action. Here are the
names I've tried:
NewsPersist-newsPersist!save-validation.xml
NewsPersist!save-validation.xml
Any other thoughts? I can start looking into the code and see what is
happening if no one knows.
Thanks
-bp
Brian Pontarelli wrote:
>
> Haha. Freudian click for sure.
>
> Thanks. I know in WebWork it was the action name and had nothing to do
> with the method, so this does make some sense actually, since the
> action name is Action!method. Just a something I was pondering.... Why
> is the class name in the file at all? Really it is the validation for
> an action.... Hmmmmm..... It does make it lexical and in the same
> package as the action class.... Hmmmm...
>
> BTW, I'm going to be faxing in my contributor agreement and I'm hoping
> to be able to contribute to the documentation. I'd like to see two
> types of documentation for things like this, a tutorial style that is
> verbose and has an example that is worked through and then a reference
> for older hats that just want to see all the variations.
>
> -bp
>
>
> Dave Newton wrote:
>> Oops, sorry; meant to not send this.
>>
>> --- Dave Newton <ne...@yahoo.com> wrote:
>>
>>
>>> --- Brian Pontarelli <br...@pontarelli.com> wrote:
>>>
>>>> And finally, I have a single validation file
>>>>
>>> named:
>>>
>>>> NewsPersist-validation.xml
>>>>
>>>> What I figured would work was an XML file named:
>>>>
>>>> NewsPersist-save-validation.xml
>>>>
>>>> This doesn't seem to work however. Any ideas?
>>>>
>>> Check the archives for a previous thread on this
>>> subject with Ted piping in and telling me I had been
>>> telling everyone the wrong thing :/
>>>
>>> The "alias" is more than just the method name (which
>>> I
>>> think is wrong :) but the entire name of the action
>>> as
>>> specified in the config file, like
>>> NewPersist-newPersist!save-validation.xml.
>>>
>>> Hmm. I wonder if I got that right.
>>>
>>> d.
>>>
>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Tired of spam? Yahoo! Mail has the best spam
>>> protection around http://mail.yahoo.com
>>>
>>>
>> ---------------------------------------------------------------------
>>
>>> To unsubscribe, e-mail:
>>> dev-unsubscribe@struts.apache.org
>>> For additional commands, e-mail:
>>> dev-help@struts.apache.org
>>>
>>>
>>>
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>> For additional commands, e-mail: dev-help@struts.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [S2] Validation aliases seem broken
Posted by Brian Pontarelli <br...@pontarelli.com>.
Haha. Freudian click for sure.
Thanks. I know in WebWork it was the action name and had nothing to do
with the method, so this does make some sense actually, since the action
name is Action!method. Just a something I was pondering.... Why is the
class name in the file at all? Really it is the validation for an
action.... Hmmmmm..... It does make it lexical and in the same package
as the action class.... Hmmmm...
BTW, I'm going to be faxing in my contributor agreement and I'm hoping
to be able to contribute to the documentation. I'd like to see two types
of documentation for things like this, a tutorial style that is verbose
and has an example that is worked through and then a reference for older
hats that just want to see all the variations.
-bp
Dave Newton wrote:
> Oops, sorry; meant to not send this.
>
> --- Dave Newton <ne...@yahoo.com> wrote:
>
>
>> --- Brian Pontarelli <br...@pontarelli.com> wrote:
>>
>>> And finally, I have a single validation file
>>>
>> named:
>>
>>> NewsPersist-validation.xml
>>>
>>> What I figured would work was an XML file named:
>>>
>>> NewsPersist-save-validation.xml
>>>
>>> This doesn't seem to work however. Any ideas?
>>>
>> Check the archives for a previous thread on this
>> subject with Ted piping in and telling me I had been
>> telling everyone the wrong thing :/
>>
>> The "alias" is more than just the method name (which
>> I
>> think is wrong :) but the entire name of the action
>> as
>> specified in the config file, like
>> NewPersist-newPersist!save-validation.xml.
>>
>> Hmm. I wonder if I got that right.
>>
>> d.
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam
>> protection around
>> http://mail.yahoo.com
>>
>>
>>
> ---------------------------------------------------------------------
>
>> To unsubscribe, e-mail:
>> dev-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> dev-help@struts.apache.org
>>
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [S2] Validation aliases seem broken
Posted by Dave Newton <ne...@yahoo.com>.
Oops, sorry; meant to not send this.
--- Dave Newton <ne...@yahoo.com> wrote:
> --- Brian Pontarelli <br...@pontarelli.com> wrote:
> > And finally, I have a single validation file
> named:
> >
> > NewsPersist-validation.xml
> >
> > What I figured would work was an XML file named:
> >
> > NewsPersist-save-validation.xml
> >
> > This doesn't seem to work however. Any ideas?
>
> Check the archives for a previous thread on this
> subject with Ted piping in and telling me I had been
> telling everyone the wrong thing :/
>
> The "alias" is more than just the method name (which
> I
> think is wrong :) but the entire name of the action
> as
> specified in the config file, like
> NewPersist-newPersist!save-validation.xml.
>
> Hmm. I wonder if I got that right.
>
> d.
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> dev-help@struts.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [S2] Validation aliases seem broken
Posted by Dave Newton <ne...@yahoo.com>.
--- Brian Pontarelli <br...@pontarelli.com> wrote:
> And finally, I have a single validation file named:
>
> NewsPersist-validation.xml
>
> What I figured would work was an XML file named:
>
> NewsPersist-save-validation.xml
>
> This doesn't seem to work however. Any ideas?
Check the archives for a previous thread on this
subject with Ted piping in and telling me I had been
telling everyone the wrong thing :/
The "alias" is more than just the method name (which I
think is wrong :) but the entire name of the action as
specified in the config file, like
NewPersist-newPersist!save-validation.xml.
Hmm. I wonder if I got that right.
d.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org