You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ricardo Gladwell <ri...@btinternet.com> on 2004/09/16 00:46:16 UTC
and modules
Hi,
I'm experimenting with struts modules, but I've encountered a problem
whereby I have a struts <html:form> referencing an action in my
non-default module. Instead of referencing the correct action, I get a
"Cannot retrieve mapping for action" JspException.
How do I reference an action in another module from a html:form? Unlike
html:link there doesn't seem to be a "module" attribute?
Kind regards...
--
Ricardo Gladwell
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validator question
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Are you sure your destinationName validation is correct - seems to me like
it should always give a validation error if buttonSelected is not "find"? I
think it should be something like the following....
> destinationName is required only when destinationReference is null AND
> the parameter 'buttonSelected' is 'find'
<field property="destinationName" depends="validwhen">
<arg0 key="prompt.destinationName"/>
<var>
<var-name>test</var-name>
<var-value>(*this* != null) or
( (buttonSelected != "find") or
(destinationRef != null))
</var-value>
</var>
</field>
For the destinationReference validation, how about the following...
> destinationReference is ALWAYS required EXCEPT when 'buttonSelected' is
> 'find' and destinationReference is not null
<field property="destinationRef" depends="validwhen">
<arg0 key="prompt.destinationRef"/>
<var>
<var-name>test</var-name>
<var-value>(*this* != null) or
((buttonSelected == "find") and
(destinationName != null))
</var-value>
</var>
</field>
Niall
----- Original Message -----
From: "Marco Mistroni" <mm...@waersystems.com>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>
Sent: Thursday, September 16, 2004 12:13 PM
Subject: Validator question
> Hi all,
> I have following issue with Validator
>
> I have a form that has, between other fields, two fields,
> destinationReference and destinationName.
>
> destinationName is required only when destinationReference is null AND
> the parameter 'buttonSelected' is 'find'
>
> destinationReference is ALWAYS required EXCEPT when 'buttonSelected' is
> 'find' and destinationReference is not null
>
> any hints?
>
> Following the validator guide I have entered following in the
> validation.xml
>
> <field property="destinationName" depends="validwhen">
> <arg0 key="prompt.destinationName"/>
> <var>
> <var-name>test</var-name>
> <var-value>(buttonSelected == "find") and
> ((destinationRef == null) or (*this* != null))</var-value>
> </var>
> </field>
> </form>
>
>
> this works fine for the destinationName field
> I am missing how to specify destinationReference is ALWAYS required
> except
> When destinationName is NOT null and buttonSelected is 'find'
>
> Anyone can help?
>
> Thanx in advance and regards
> marco
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Validator question
Posted by Marco Mistroni <mm...@waersystems.com>.
Hi all,
I have following issue with Validator
I have a form that has, between other fields, two fields,
destinationReference and destinationName.
destinationName is required only when destinationReference is null AND
the parameter 'buttonSelected' is 'find'
destinationReference is ALWAYS required EXCEPT when 'buttonSelected' is
'find' and destinationReference is not null
any hints?
Following the validator guide I have entered following in the
validation.xml
<field property="destinationName" depends="validwhen">
<arg0 key="prompt.destinationName"/>
<var>
<var-name>test</var-name>
<var-value>(buttonSelected == "find") and
((destinationRef == null) or (*this* != null))</var-value>
</var>
</field>
</form>
this works fine for the destinationName field
I am missing how to specify destinationReference is ALWAYS required
except
When destinationName is NOT null and buttonSelected is 'find'
Anyone can help?
Thanx in advance and regards
marco
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: and modules
Posted by Yves Sy <yv...@gmail.com>.
What I usually do is place the login functionality (and all
common/general functionalities for that matter) in the default
struts-config at the root context.
Now if I have a more specific module or section in my app, i create a
sub-context so that all action mappings for that particular submodule
are on the same subcontext and struts-config file. An example is a
user management module where you CRUD users for your app.
Regards,
-Yves-
On Thu, 16 Sep 2004 10:36:21 +0100, Ricardo Gladwell
<ri...@btinternet.com> wrote:
> Hi,
>
> Perhaps I'm misunderstandig the use of modules: I have a default module
> that handles basic webapp functionality (homepage forwarding, layout,
> etc) and other modules handle additional functionality such as user
> management (log in/out, registration, details modifications, etc) henc
> the need to forward actions from the default layer to the user login layer.
>
> Is this the correct approach, or should I stick to putting it all into
> one web application?
>
>
>
> Yves Sy wrote:
> > I would guess its because its not really standard practice to submit a
> > form to a handler from another module. It's kind of a weird flow if
> > you ask me. Usually you'd submit to a handler in your own module and
> > THEN forward to wherever else using SwitchAction.
> >
> > Anyway if the SwitchAction does not work, you can go the usual
> > javascript way of dynamically changing the action attribute's value...
> >
> > <% String url = response.encodeURL(request.getContextPath() +
> > "/another-module/myAction.do"); %>
> > document.myForm.action = '<%= url%>';
> > document.myFormsubmit();
> >
> > Not very elegant but it works.
> >
> > Regards,
> > -Yves-
> >
> > On Thu, 16 Sep 2004 09:30:09 +0100, Ricardo Gladwell
> > <ri...@btinternet.com> wrote:
> >
> >>Hi,
> >>
> >>Thanks for that, I will try to use the switch action to forward onto the
> >>correct module actions. Just out of interest, why doesn't the html:form
> >>tag have a module attribute?
> >>
> >>Yves Sy wrote:
> >>
> >>>Try using SwitchAction
> >>>
> >>>-Regards-
> >>>Yves
> >>>
> >>>
> >>>On Wed, 15 Sep 2004 23:46:16 +0100, Ricardo Gladwell
> >>><ri...@btinternet.com> wrote:
> >>>
> >>>
> >>>>Hi,
> >>>>
> >>>>I'm experimenting with struts modules, but I've encountered a problem
> >>>>whereby I have a struts <html:form> referencing an action in my
> >>>>non-default module. Instead of referencing the correct action, I get a
> >>>>"Cannot retrieve mapping for action" JspException.
> >>>>
> >>>>How do I reference an action in another module from a html:form? Unlike
> >>>>html:link there doesn't seem to be a "module" attribute?
> >>>>
> >>>>Kind regards...
> >>>>
> >>>>--
> >>>>Ricardo Gladwell
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: and modules
Posted by Ricardo Gladwell <ri...@btinternet.com>.
Hi,
Perhaps I'm misunderstandig the use of modules: I have a default module
that handles basic webapp functionality (homepage forwarding, layout,
etc) and other modules handle additional functionality such as user
management (log in/out, registration, details modifications, etc) henc
the need to forward actions from the default layer to the user login layer.
Is this the correct approach, or should I stick to putting it all into
one web application?
Yves Sy wrote:
> I would guess its because its not really standard practice to submit a
> form to a handler from another module. It's kind of a weird flow if
> you ask me. Usually you'd submit to a handler in your own module and
> THEN forward to wherever else using SwitchAction.
>
> Anyway if the SwitchAction does not work, you can go the usual
> javascript way of dynamically changing the action attribute's value...
>
> <% String url = response.encodeURL(request.getContextPath() +
> "/another-module/myAction.do"); %>
> document.myForm.action = '<%= url%>';
> document.myFormsubmit();
>
> Not very elegant but it works.
>
> Regards,
> -Yves-
>
> On Thu, 16 Sep 2004 09:30:09 +0100, Ricardo Gladwell
> <ri...@btinternet.com> wrote:
>
>>Hi,
>>
>>Thanks for that, I will try to use the switch action to forward onto the
>>correct module actions. Just out of interest, why doesn't the html:form
>>tag have a module attribute?
>>
>>Yves Sy wrote:
>>
>>>Try using SwitchAction
>>>
>>>-Regards-
>>>Yves
>>>
>>>
>>>On Wed, 15 Sep 2004 23:46:16 +0100, Ricardo Gladwell
>>><ri...@btinternet.com> wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>I'm experimenting with struts modules, but I've encountered a problem
>>>>whereby I have a struts <html:form> referencing an action in my
>>>>non-default module. Instead of referencing the correct action, I get a
>>>>"Cannot retrieve mapping for action" JspException.
>>>>
>>>>How do I reference an action in another module from a html:form? Unlike
>>>>html:link there doesn't seem to be a "module" attribute?
>>>>
>>>>Kind regards...
>>>>
>>>>--
>>>>Ricardo Gladwell
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: and modules
Posted by Yves Sy <yv...@gmail.com>.
I would guess its because its not really standard practice to submit a
form to a handler from another module. It's kind of a weird flow if
you ask me. Usually you'd submit to a handler in your own module and
THEN forward to wherever else using SwitchAction.
Anyway if the SwitchAction does not work, you can go the usual
javascript way of dynamically changing the action attribute's value...
<% String url = response.encodeURL(request.getContextPath() +
"/another-module/myAction.do"); %>
document.myForm.action = '<%= url%>';
document.myFormsubmit();
Not very elegant but it works.
Regards,
-Yves-
On Thu, 16 Sep 2004 09:30:09 +0100, Ricardo Gladwell
<ri...@btinternet.com> wrote:
> Hi,
>
> Thanks for that, I will try to use the switch action to forward onto the
> correct module actions. Just out of interest, why doesn't the html:form
> tag have a module attribute?
>
> Yves Sy wrote:
> > Try using SwitchAction
> >
> > -Regards-
> > Yves
> >
> >
> > On Wed, 15 Sep 2004 23:46:16 +0100, Ricardo Gladwell
> > <ri...@btinternet.com> wrote:
> >
> >>Hi,
> >>
> >>I'm experimenting with struts modules, but I've encountered a problem
> >>whereby I have a struts <html:form> referencing an action in my
> >>non-default module. Instead of referencing the correct action, I get a
> >>"Cannot retrieve mapping for action" JspException.
> >>
> >>How do I reference an action in another module from a html:form? Unlike
> >>html:link there doesn't seem to be a "module" attribute?
> >>
> >>Kind regards...
> >>
> >>--
> >>Ricardo Gladwell
> >>
> >>---------------------------------------------------------------------
> >>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
>
>
--
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: and modules
Posted by Ricardo Gladwell <ri...@btinternet.com>.
Hi,
Thanks for that, I will try to use the switch action to forward onto the
correct module actions. Just out of interest, why doesn't the html:form
tag have a module attribute?
Yves Sy wrote:
> Try using SwitchAction
>
> -Regards-
> Yves
>
>
> On Wed, 15 Sep 2004 23:46:16 +0100, Ricardo Gladwell
> <ri...@btinternet.com> wrote:
>
>>Hi,
>>
>>I'm experimenting with struts modules, but I've encountered a problem
>>whereby I have a struts <html:form> referencing an action in my
>>non-default module. Instead of referencing the correct action, I get a
>>"Cannot retrieve mapping for action" JspException.
>>
>>How do I reference an action in another module from a html:form? Unlike
>>html:link there doesn't seem to be a "module" attribute?
>>
>>Kind regards...
>>
>>--
>>Ricardo Gladwell
>>
>>---------------------------------------------------------------------
>>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: and modules
Posted by Yves Sy <yv...@gmail.com>.
Try using SwitchAction
-Regards-
Yves
On Wed, 15 Sep 2004 23:46:16 +0100, Ricardo Gladwell
<ri...@btinternet.com> wrote:
> Hi,
>
> I'm experimenting with struts modules, but I've encountered a problem
> whereby I have a struts <html:form> referencing an action in my
> non-default module. Instead of referencing the correct action, I get a
> "Cannot retrieve mapping for action" JspException.
>
> How do I reference an action in another module from a html:form? Unlike
> html:link there doesn't seem to be a "module" attribute?
>
> Kind regards...
>
> --
> Ricardo Gladwell
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: and modules
Posted by Hubert Rabago <hr...@gmail.com>.
I don't think submitting a form to a separate module is allowed by the
Struts tags.
Actions are specific to each module. IIRC, You can define the same
path in different modules and they will be treated as different
mappings. You can even define forms with the same form name in
different modules and they will be treated as different form bean
configurations as well.
You can hack your way around it, though, by manipulating the <form>
tag using javascript, but then you'd have the problem of how to access
the correct form through Struts tags.
Hubert
On Wed, 15 Sep 2004 23:46:16 +0100, Ricardo Gladwell
<ri...@btinternet.com> wrote:
> Hi,
>
> I'm experimenting with struts modules, but I've encountered a problem
> whereby I have a struts <html:form> referencing an action in my
> non-default module. Instead of referencing the correct action, I get a
> "Cannot retrieve mapping for action" JspException.
>
> How do I reference an action in another module from a html:form? Unlike
> html:link there doesn't seem to be a "module" attribute?
>
> Kind regards...
>
> --
> Ricardo Gladwell
>
> ---------------------------------------------------------------------
> 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