You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gokul balasubramanian <go...@rediffmail.com> on 2006/04/06 14:58:45 UTC
Validation
Guys,
I am yet to find a solution for this problem. I validate a form and if validation returned errors, which it does in this case y is the action still being called? even worse the errors are displayed on the action page than on the input page. baffles me. how do i tackle this problem?
Gokul
Re: Sharing the action form by different actions
Posted by Wendy Smoak <ws...@gmail.com>.
On 4/6/06, Carl Smith <cc...@yahoo.com> wrote:
> It is practical to share the same action form by different
> actions, For example (I only listed two actions sharing the same form here,
> but the questions apply for multiple actions sharing the same form):
Sure. I have an app that uses a single session-scoped form bean.
It's a front end for accounting reports, and as the user moves around
and requests different reports, the app naturally "remembers" which
accounts and date ranges s/he was working with.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Sharing the action form by different actions
Posted by Carl Smith <cc...@yahoo.com>.
Thank you Michael for the reply. I like the answer, which agree with what I thought, but can you explain it in a little detail? The website you attached doesn't clearly explain your answer "No".
Thanks.
Michael Jouravlev <jm...@gmail.com> wrote:
On 4/6/06, Carl Smith wrote:
> It is practical to share the same action form by different
> actions, For example (I only listed two actions sharing the same form here,
> but the questions apply for multiple actions sharing the same form):
>
>
>
> > scope="session" name="sharedForm" validate="false">
>
>
> > scope="request" name="sharedForm" validate="true" input="/View.jsp">
>
http://wiki.apache.org/struts/DataEntryForm
> Then the question is:is it a good practice to set up the sharedForm into different
> scope(session or request) for different actions, as what was shown in the above example?
No.
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
Re: Sharing the action form by different actions
Posted by Michael Jouravlev <jm...@gmail.com>.
On 4/6/06, Carl Smith <cc...@yahoo.com> wrote:
> It is practical to share the same action form by different
> actions, For example (I only listed two actions sharing the same form here,
> but the questions apply for multiple actions sharing the same form):
>
> <form-bean name ="sharedForm" type="myclassPath.SharedForm"/>
>
> <action path="/displayViewAction" type="myclasspath.DisplayViewAction"
> scope="session" name="sharedForm" validate="false">
> </action>
>
> <action path="/saveDataAction" type="myclasspath.SaveDataAction"
> scope="request" name="sharedForm" validate="true" input="/View.jsp">
> </action>
http://wiki.apache.org/struts/DataEntryForm
> Then the question is:is it a good practice to set up the sharedForm into different
> scope(session or request) for different actions, as what was shown in the above example?
No.
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Sharing the action form by different actions
Posted by Ted Husted <te...@gmail.com>.
On 4/7/06, Carl Smith <cc...@yahoo.com> wrote:
> Hello folks, I got two replies, can someone else offer some more insights on this topic?
I've written many applications that only used one ActionForm class,
and just validated it differently. I find it useful to have a single
object that represents a "normalized" view of the user interface. The
validations follow what logical name you give the form-bean, not the
binary class.
Many organizations use session scope to save trips to the databse
server. It's all a matter of how you want to allocate your resources.
In this case, it would appear that one form is using request scope
since the operation may not be completed. The session scope version
evidentally represents the current state, while the request scope
version represents a proposed state change. In that case, the
properties might be the same, but the data would be different.
In my experience, the greatest degree of confusion comes about by
repeating the same facts in different places in the same application.
If the choice is having the same set of properties on different
ActionForm classes *versus* sharing the same set of properites through
a base class, I would opt for sharing and avoid Repeating Myself.
-Ted.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Sharing the action form by different actions
Posted by Carl Smith <cc...@yahoo.com>.
Hello folks, I got two replies, can someone else offer some more insights on this topic?
Thanks.
It is practical to share the same action form by different
actions, For example (I only listed two actions sharing the same form here,
but the questions apply for multiple actions sharing the same form):
scope="session" name="sharedForm" validate="false">
scope="request" name="sharedForm" validate="true" input="/View.jsp">
Then the question is:is it a good practice to set up the sharedForm into different
scope(session or request) for different actions, as what was shown in the above example?
I believe this is a very good topic for Struts community and especially for those developed Struts framework. I appreciate your inputs very much!
P.S. I have discussed this with a small group - company level, and the conclusion seems to be:
No, this is not a good practice, since your putting the same shared action form will be confusing, and in practice saving the data into two duplicate form beans is not efficient and will cause errors.
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.
Sharing the action form by different actions
Posted by Carl Smith <cc...@yahoo.com>.
It is practical to share the same action form by different
actions, For example (I only listed two actions sharing the same form here,
but the questions apply for multiple actions sharing the same form):
<form-bean name ="sharedForm" type="myclassPath.SharedForm"/>
<action path="/displayViewAction" type="myclasspath.DisplayViewAction"
scope="session" name="sharedForm" validate="false">
</action>
<action path="/saveDataAction" type="myclasspath.SaveDataAction"
scope="request" name="sharedForm" validate="true" input="/View.jsp">
</action>
Then the question is:is it a good practice to set up the sharedForm into different
scope(session or request) for different actions, as what was shown in the above example?
I believe this is a very good topic for Struts community and especially for those developed Struts framework. I appreciate your inputs very much!
P.S. I have discussed this with a small group - company level, and the conclusion seems to be:
No, this is not a good practice, since your putting the same shared action form will be confusing, and in practice saving the data into two duplicate form beans is not efficient and will cause errors.
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
Re: Validation
Posted by vijay venkataraman <vi...@ltp.soft.net>.
Gokul,
Why don't you just pull the source code and debug it. If you had done
that, by now you would have found a solution to your problem.
Thanks,
Vijay Venkataraman
gokul balasubramanian wrote:
>
>Guys,
>
>I am yet to find a solution for this problem. I validate a form and if validation returned errors, which it does in this case y is the action still being called? even worse the errors are displayed on the action page than on the input page. baffles me. how do i tackle this problem?
>
>
>Gokul
>
>
>
>
------------------------------DISCLAIMER------------------------------
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient.
Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each
reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the
individual sender, except where the message states otherwise and the
sender is authorized to state them to be the views of any such entity.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Validation
Posted by Laurie Harper <la...@holoweb.net>.
gokul balasubramanian wrote:
>
> Guys,
>
> I am yet to find a solution for this problem. I validate a form and if validation returned errors, which it does in this case y is the action still being called? even worse the errors are displayed on the action page than on the input page. baffles me. how do i tackle this problem?
Gokul, based on the code you posted previously, we still don't know what
the base class for your form bean is. Note that Struts validation
requires that you use one of the Validator-variant ActionForm base
classes. Maybe you're extending from a plain ActionForm?
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org