You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by PC Leung <pc...@gmail.com> on 2004/08/25 16:54:33 UTC
how to use DispatchAction?
my setup DispatchAction does not show a token when the form first displays.
When I click submit button to create record, it shows error messages
of handler. What does needs to be done?
my flow likes this
UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
UserMaint.jsp constructs:
<html:link page="/AddUserProfile.jsp?method=setup">
<bean:message key="userMaint.addUserProfile"/>
</html:link>
AddUserProfile.jsp constructs:
<html:form action="/addUserProfile?method=create" focus="firstName">
<html:hidden property="action"/>
<html:submit><bean:message
key="addUserProfileForm.submit"/></html:submit>
AddUserProfileAction.java constructs:
public final class AddUserProfileAction extends DispatchAction {
public ActionForward setup (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
saveToken(request);
return (mapping.getInputForward());
}
public ActionForward create (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
ActionErrors errors = new ActionErrors();
if (!isTokenValid(request, true)) {
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("Duplicated Submission"));
}
MessageResources messages = getResources(request);
if (checking_is_ok) {
ActionMessages actionMessages = new ActionMessages();
ActionMessage actionMessage = new ActionMessage("recordAdded");
actionMessages.add(Constants.statusLine, actionMessage);
saveMessages (request, actionMessages);
saveToken(request);
return mapping.findForward("success");
}
if (!errors.isEmpty()) {
saveErrors(request, errors);
saveToken(request);
return (mapping.getInputForward());
}
return mapping.findForward("failure");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to use DispatchAction?
Posted by PC Leung <pc...@gmail.com>.
After adding the following to struts-config.xml, error message disappears.
parameter="methodToCall"
However I still cannot avoid duplicated submission.
It seems that
<tml:link page="/AddUserProfile.jsp?method=setup">
does not create a token when the form displays at the first time.
On Wed, 25 Aug 2004 22:54:33 +0800, PC Leung <pc...@gmail.com> wrote:
> my setup DispatchAction does not show a token when the form first displays.
> When I click submit button to create record, it shows error messages
> of handler. What does needs to be done?
>
> my flow likes this
> UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
>
> UserMaint.jsp constructs:
> <html:link page="/AddUserProfile.jsp?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
>
> AddUserProfile.jsp constructs:
>
> <html:form action="/addUserProfile?method=create" focus="firstName">
> <html:hidden property="action"/>
> <html:submit><bean:message
> key="addUserProfileForm.submit"/></html:submit>
>
> AddUserProfileAction.java constructs:
>
> public final class AddUserProfileAction extends DispatchAction {
>
> public ActionForward setup (ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception {
> HttpSession session = request.getSession();
> saveToken(request);
> return (mapping.getInputForward());
> }
>
> public ActionForward create (ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception {
> HttpSession session = request.getSession();
> ActionErrors errors = new ActionErrors();
> if (!isTokenValid(request, true)) {
> errors.add(ActionErrors.GLOBAL_ERROR,
> new ActionError("Duplicated Submission"));
> }
> MessageResources messages = getResources(request);
> if (checking_is_ok) {
> ActionMessages actionMessages = new ActionMessages();
> ActionMessage actionMessage = new ActionMessage("recordAdded");
> actionMessages.add(Constants.statusLine, actionMessage);
> saveMessages (request, actionMessages);
> saveToken(request);
> return mapping.findForward("success");
> }
> if (!errors.isEmpty()) {
> saveErrors(request, errors);
> saveToken(request);
> return (mapping.getInputForward());
> }
> return mapping.findForward("failure");
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to use DispatchAction?
Posted by Rick Reumann <st...@reumann.net>.
> <html:link page="/userProfileAction?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
Sorry forgot to add the .do or whatever you have setup to foward to
Struts ActionServlet. If using the common .do it would be ..
<html:link page="/userProfileAction.do?method=setup">
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
How long does it take to master appfuse?
Posted by struts Dude <sc...@slingshot.co.nz>.
Hi
How long does it take to master appfuse.?
Appfuse looks powerful but daunting to learn.
It uses hibernate, xdoclet, junit, cactus, spring
.. whatever, each technology can fill a book.
Do I need to learn J2EE to get full benefit of
appfuse?
Can I get much out of appfuse if I don't use J2EE
for development? Another way of saying this is
, is using appfuse overkill for a simple web app
that doesn't use J2EE?
Just a side question, can eclipse validate dtd like
intellij?
Thanks
Duuuude
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Why not use MappingDispatchAction in 1.2? Was: how to use
DispatchAction?
Posted by Nathan Maves <Na...@Sun.COM>.
On a bit of a side note...
I would suggest using MappingDispatchAction in the 1.2 builds. This
has made the use of dispatch actions much much easier. It allows you
to move the "method" parameter into the action mapping itself. This
way you do not need to send the parameter in the request.
Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to use DispatchAction?
Posted by PC Leung <pc...@gmail.com>.
Yes. UserMaint.jsp does not have an entry in strus-config.xml
because UserMaint.jsp does not contain a form for user to input data.
struts-config.xml does contain entry of AddUserProfile.
Should I transform the UserMaint.jsp to a form?
UserMaint.jsp (contains links only) calls
AddUserProfile.jsp which links with
AddUserProfileAction.java (it contains DispatchAction)
and AddUserProfileForm.java
On Thu, 26 Aug 2004 00:09:16 -0400, Rick Reumann <st...@reumann.net> wrote:
> PC Leung wrote:
>
> > Do you mean my approach is wrong?
> > Originally UserMaint.jsp contains links only.
> > Do I need to transform it as a form?
>
> As Bill asked earlier, what does you struts-config file look like. My
> guess is you are not getting to your action class because you haven't
> set up a mapping for it. Look at the sample apps and examples that show
> how to set up your mappings in your struts-config.
>
> For example you might want something like...
>
> <action path="/userProfileAction"
> type="package.path.UserProfileAction"
> name="userProfileForm"
> scope="request"
> validate="false"
> parameter="method"
> >
> <forward name="to_form" path="/WEB-INF/jsp/form.jsp"/>
> <forward name="success" path="/WEB-INF/jsp/foobar.jsp"/>
> </action>
>
> Your link then would be...
>
> <html:link page="/userProfileAction?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
>
>
> --
> Rick
>
>
>
> ---------------------------------------------------------------------
> 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: how to use DispatchAction?
Posted by Rick Reumann <st...@reumann.net>.
PC Leung wrote:
> Do you mean my approach is wrong?
> Originally UserMaint.jsp contains links only.
> Do I need to transform it as a form?
As Bill asked earlier, what does you struts-config file look like. My
guess is you are not getting to your action class because you haven't
set up a mapping for it. Look at the sample apps and examples that show
how to set up your mappings in your struts-config.
For example you might want something like...
<action path="/userProfileAction"
type="package.path.UserProfileAction"
name="userProfileForm"
scope="request"
validate="false"
parameter="method"
>
<forward name="to_form" path="/WEB-INF/jsp/form.jsp"/>
<forward name="success" path="/WEB-INF/jsp/foobar.jsp"/>
</action>
Your link then would be...
<html:link page="/userProfileAction?method=setup">
<bean:message key="userMaint.addUserProfile"/>
</html:link>
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to use DispatchAction?
Posted by PC Leung <pc...@gmail.com>.
Do you mean my approach is wrong?
Originally UserMaint.jsp contains links only.
Do I need to transform it as a form?
On Wed, 25 Aug 2004 23:08:24 -0400, Bill Siggelkow
<bi...@bellsouth.net> wrote:
> Well, passing a dispatch parameter to a JSP is not going to do anything
> unless on the JSP you explicitly pull that request parameter and stick
> it somewhere on the form. (This sounds like what you are trying to do --
> it sounds like you are trying to pass the method to dispatch to through
> the AddUserProfile.jsp).
>
> Typically, the dispatch parameter is set on the form that submits to the
> DispatchAction subclass using the help of JavaScript.
>
>
>
> PC Leung wrote:
>
> > UserMaint.jsp (contains links only) calls
> > AddUserProfile.jsp which links with
> > AddUserProfileAction.java (it contains DispatchAction)
> > and AddUserProfileForm.java
> >
> > UserMaint.jsp constructs originally like this:
> > <html:link page="/AddUserProfile.jsp?method=setup">
> > <bean:message key="userMaint.addUserProfile"/>
> > </html:link>
> >
> > Do you suggest me to change the coding to the following?
> > <html:link page="/AddUserProfile.do?method=setup">
> > <bean:message key="userMaint.addUserProfile"/>
> > </html:link>
> >
> >
> >
> > On Wed, 25 Aug 2004 22:09:55 -0400, Bill Siggelkow
> > <bi...@bellsouth.net> wrote:
> >
> >>PC -- I am not sure what you mean by "AddUserProfileAction.java
> >>(AddUserProfile.jsp)"? Do you mean that the Action forwards to the JSP?
> >>Or do you mean that the JSP submits to the Action?
> >>
> >>Anyway, if you want the link to be to the Action it would be like this:
> >>
> >><html:link page="/AddUserProfile.do?method=setup">
> >> <bean:message key="userMaint.addUserProfile"/>
> >></html:link>
> >>
> >>Notice the ".do" on the page attribute.
> >>
> >>
> >>
> >>PC Leung wrote:
> >>
> >>>My first web page is page contains links only. No Form nor Action.
> >>>
> >>>UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
> >>>
> >>>UserMaint.jsp constructs:
> >>> <html:link page="/AddUserProfile.jsp?method=setup">
> >>> <bean:message key="userMaint.addUserProfile"/>
> >>> </html:link>
> >>>
> >>>The link becomes http://.../AddUserProfile.jsp.do?method=setup
> >>>
> >>>Does it mean that it cannot invoke the setup DispatchAction?
> >>>
> >>>public final class AddUserProfileAction extends DispatchAction {
> >>>
> >>> public ActionForward setup (ActionMapping mapping,
> >>> ActionForm form,
> >>> HttpServletRequest request,
> >>> HttpServletResponse response)
> >>> throws Exception {
> >>> HttpSession session = request.getSession();
> >>> saveToken(request);
> >>> return (mapping.getInputForward());
> >>> }
> >>>
> >>>On Wed, 25 Aug 2004 14:49:32 -0400, Bill Siggelkow
> >>><bi...@bellsouth.net> wrote:
> >>>
> >>>
> >>>>I am not quite sure I am following this (it would help to see the
> >>>>relevant action mappings from your struts-config.xml but it sounds like
> >>>>you may not be saving the token *in the action preceding the JSP that
> >>>>contains the form*.
> >>>>
> >>>>
> >>>>
> >>>>PC Leung wrote:
> >>>>
> >>>>
> >>>>
> >>>>>Error message is solved.
> >>>>>but the form does not display with token when it displays
> >>>>>at the first time.
> >>>>>I think the following line does not work properly.
> >>>>>
> >>>>>UserMaint.jsp constructs:
> >>>>> <html:link page="/AddUserProfile.jsp?method=setup">
> >>>>>
> >>>>>In the setup DispatchAction, I try to saveToken().
> >>>>>
> >>>>>On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>At 10:54 PM +0800 8/25/04, PC Leung wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>my setup DispatchAction does not show a token when the form first displays.
> >>>>>>>When I click submit button to create record, it shows error messages
> >>>>>>>of handler. What does needs to be done?
> >>>>>>
> >>>>>>What are the error messages?
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>AddUserProfile.jsp constructs:
> >>>>>>>
> >>>>>>><html:form action="/addUserProfile?method=create" focus="firstName">
> >>>>>>><html:hidden property="action"/>
> >>>>>>><html:submit><bean:message
> >>>>>>>key="addUserProfileForm.submit"/></html:submit>
> >>>>>>
> >>>>>>here you should probably pass "method=create" as a hidden form field;
> >>>>>>I don't think the html form tag will handle an action specified like
> >>>>>>that correctly.
> >>>>>>
> >>>>>>Joe
> >>>>>>
> >>>>>>--
> >>>>>>Joe Germuska
> >>>>>>Joe@Germuska.com
> >>>>>>http://blog.germuska.com
> >>>>>>"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
> >>>>>>back; I'll know I'm in the wrong place."
> >>>>>> - Carlos Santana
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>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: how to use DispatchAction?
Posted by Bill Siggelkow <bi...@bellsouth.net>.
Well, passing a dispatch parameter to a JSP is not going to do anything
unless on the JSP you explicitly pull that request parameter and stick
it somewhere on the form. (This sounds like what you are trying to do --
it sounds like you are trying to pass the method to dispatch to through
the AddUserProfile.jsp).
Typically, the dispatch parameter is set on the form that submits to the
DispatchAction subclass using the help of JavaScript.
PC Leung wrote:
> UserMaint.jsp (contains links only) calls
> AddUserProfile.jsp which links with
> AddUserProfileAction.java (it contains DispatchAction)
> and AddUserProfileForm.java
>
> UserMaint.jsp constructs originally like this:
> <html:link page="/AddUserProfile.jsp?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
>
> Do you suggest me to change the coding to the following?
> <html:link page="/AddUserProfile.do?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
>
>
>
> On Wed, 25 Aug 2004 22:09:55 -0400, Bill Siggelkow
> <bi...@bellsouth.net> wrote:
>
>>PC -- I am not sure what you mean by "AddUserProfileAction.java
>>(AddUserProfile.jsp)"? Do you mean that the Action forwards to the JSP?
>>Or do you mean that the JSP submits to the Action?
>>
>>Anyway, if you want the link to be to the Action it would be like this:
>>
>><html:link page="/AddUserProfile.do?method=setup">
>> <bean:message key="userMaint.addUserProfile"/>
>></html:link>
>>
>>Notice the ".do" on the page attribute.
>>
>>
>>
>>PC Leung wrote:
>>
>>>My first web page is page contains links only. No Form nor Action.
>>>
>>>UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
>>>
>>>UserMaint.jsp constructs:
>>> <html:link page="/AddUserProfile.jsp?method=setup">
>>> <bean:message key="userMaint.addUserProfile"/>
>>> </html:link>
>>>
>>>The link becomes http://.../AddUserProfile.jsp.do?method=setup
>>>
>>>Does it mean that it cannot invoke the setup DispatchAction?
>>>
>>>public final class AddUserProfileAction extends DispatchAction {
>>>
>>> public ActionForward setup (ActionMapping mapping,
>>> ActionForm form,
>>> HttpServletRequest request,
>>> HttpServletResponse response)
>>> throws Exception {
>>> HttpSession session = request.getSession();
>>> saveToken(request);
>>> return (mapping.getInputForward());
>>> }
>>>
>>>On Wed, 25 Aug 2004 14:49:32 -0400, Bill Siggelkow
>>><bi...@bellsouth.net> wrote:
>>>
>>>
>>>>I am not quite sure I am following this (it would help to see the
>>>>relevant action mappings from your struts-config.xml but it sounds like
>>>>you may not be saving the token *in the action preceding the JSP that
>>>>contains the form*.
>>>>
>>>>
>>>>
>>>>PC Leung wrote:
>>>>
>>>>
>>>>
>>>>>Error message is solved.
>>>>>but the form does not display with token when it displays
>>>>>at the first time.
>>>>>I think the following line does not work properly.
>>>>>
>>>>>UserMaint.jsp constructs:
>>>>> <html:link page="/AddUserProfile.jsp?method=setup">
>>>>>
>>>>>In the setup DispatchAction, I try to saveToken().
>>>>>
>>>>>On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>>>At 10:54 PM +0800 8/25/04, PC Leung wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>my setup DispatchAction does not show a token when the form first displays.
>>>>>>>When I click submit button to create record, it shows error messages
>>>>>>>of handler. What does needs to be done?
>>>>>>
>>>>>>What are the error messages?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>AddUserProfile.jsp constructs:
>>>>>>>
>>>>>>><html:form action="/addUserProfile?method=create" focus="firstName">
>>>>>>><html:hidden property="action"/>
>>>>>>><html:submit><bean:message
>>>>>>>key="addUserProfileForm.submit"/></html:submit>
>>>>>>
>>>>>>here you should probably pass "method=create" as a hidden form field;
>>>>>>I don't think the html form tag will handle an action specified like
>>>>>>that correctly.
>>>>>>
>>>>>>Joe
>>>>>>
>>>>>>--
>>>>>>Joe Germuska
>>>>>>Joe@Germuska.com
>>>>>>http://blog.germuska.com
>>>>>>"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
>>>>>>back; I'll know I'm in the wrong place."
>>>>>> - Carlos Santana
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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: how to use DispatchAction?
Posted by PC Leung <pc...@gmail.com>.
UserMaint.jsp (contains links only) calls
AddUserProfile.jsp which links with
AddUserProfileAction.java (it contains DispatchAction)
and AddUserProfileForm.java
UserMaint.jsp constructs originally like this:
<html:link page="/AddUserProfile.jsp?method=setup">
<bean:message key="userMaint.addUserProfile"/>
</html:link>
Do you suggest me to change the coding to the following?
<html:link page="/AddUserProfile.do?method=setup">
<bean:message key="userMaint.addUserProfile"/>
</html:link>
On Wed, 25 Aug 2004 22:09:55 -0400, Bill Siggelkow
<bi...@bellsouth.net> wrote:
> PC -- I am not sure what you mean by "AddUserProfileAction.java
> (AddUserProfile.jsp)"? Do you mean that the Action forwards to the JSP?
> Or do you mean that the JSP submits to the Action?
>
> Anyway, if you want the link to be to the Action it would be like this:
>
> <html:link page="/AddUserProfile.do?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
>
> Notice the ".do" on the page attribute.
>
>
>
> PC Leung wrote:
> > My first web page is page contains links only. No Form nor Action.
> >
> > UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
> >
> > UserMaint.jsp constructs:
> > <html:link page="/AddUserProfile.jsp?method=setup">
> > <bean:message key="userMaint.addUserProfile"/>
> > </html:link>
> >
> > The link becomes http://.../AddUserProfile.jsp.do?method=setup
> >
> > Does it mean that it cannot invoke the setup DispatchAction?
> >
> > public final class AddUserProfileAction extends DispatchAction {
> >
> > public ActionForward setup (ActionMapping mapping,
> > ActionForm form,
> > HttpServletRequest request,
> > HttpServletResponse response)
> > throws Exception {
> > HttpSession session = request.getSession();
> > saveToken(request);
> > return (mapping.getInputForward());
> > }
> >
> > On Wed, 25 Aug 2004 14:49:32 -0400, Bill Siggelkow
> > <bi...@bellsouth.net> wrote:
> >
> >>I am not quite sure I am following this (it would help to see the
> >>relevant action mappings from your struts-config.xml but it sounds like
> >>you may not be saving the token *in the action preceding the JSP that
> >>contains the form*.
> >>
> >>
> >>
> >>PC Leung wrote:
> >>
> >>
> >>>Error message is solved.
> >>>but the form does not display with token when it displays
> >>>at the first time.
> >>>I think the following line does not work properly.
> >>>
> >>>UserMaint.jsp constructs:
> >>> <html:link page="/AddUserProfile.jsp?method=setup">
> >>>
> >>>In the setup DispatchAction, I try to saveToken().
> >>>
> >>>On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
> >>>
> >>>
> >>>>At 10:54 PM +0800 8/25/04, PC Leung wrote:
> >>>>
> >>>>
> >>>>>my setup DispatchAction does not show a token when the form first displays.
> >>>>>When I click submit button to create record, it shows error messages
> >>>>>of handler. What does needs to be done?
> >>>>
> >>>>What are the error messages?
> >>>>
> >>>>
> >>>>
> >>>>>AddUserProfile.jsp constructs:
> >>>>>
> >>>>> <html:form action="/addUserProfile?method=create" focus="firstName">
> >>>>> <html:hidden property="action"/>
> >>>>> <html:submit><bean:message
> >>>>>key="addUserProfileForm.submit"/></html:submit>
> >>>>
> >>>>here you should probably pass "method=create" as a hidden form field;
> >>>>I don't think the html form tag will handle an action specified like
> >>>>that correctly.
> >>>>
> >>>>Joe
> >>>>
> >>>>--
> >>>>Joe Germuska
> >>>>Joe@Germuska.com
> >>>>http://blog.germuska.com
> >>>>"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
> >>>>back; I'll know I'm in the wrong place."
> >>>> - Carlos Santana
> >>
> >>
> >>---------------------------------------------------------------------
> >>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: how to use DispatchAction?
Posted by Bill Siggelkow <bi...@bellsouth.net>.
PC -- I am not sure what you mean by "AddUserProfileAction.java
(AddUserProfile.jsp)"? Do you mean that the Action forwards to the JSP?
Or do you mean that the JSP submits to the Action?
Anyway, if you want the link to be to the Action it would be like this:
<html:link page="/AddUserProfile.do?method=setup">
<bean:message key="userMaint.addUserProfile"/>
</html:link>
Notice the ".do" on the page attribute.
PC Leung wrote:
> My first web page is page contains links only. No Form nor Action.
>
> UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
>
> UserMaint.jsp constructs:
> <html:link page="/AddUserProfile.jsp?method=setup">
> <bean:message key="userMaint.addUserProfile"/>
> </html:link>
>
> The link becomes http://.../AddUserProfile.jsp.do?method=setup
>
> Does it mean that it cannot invoke the setup DispatchAction?
>
> public final class AddUserProfileAction extends DispatchAction {
>
> public ActionForward setup (ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception {
> HttpSession session = request.getSession();
> saveToken(request);
> return (mapping.getInputForward());
> }
>
> On Wed, 25 Aug 2004 14:49:32 -0400, Bill Siggelkow
> <bi...@bellsouth.net> wrote:
>
>>I am not quite sure I am following this (it would help to see the
>>relevant action mappings from your struts-config.xml but it sounds like
>>you may not be saving the token *in the action preceding the JSP that
>>contains the form*.
>>
>>
>>
>>PC Leung wrote:
>>
>>
>>>Error message is solved.
>>>but the form does not display with token when it displays
>>>at the first time.
>>>I think the following line does not work properly.
>>>
>>>UserMaint.jsp constructs:
>>> <html:link page="/AddUserProfile.jsp?method=setup">
>>>
>>>In the setup DispatchAction, I try to saveToken().
>>>
>>>On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
>>>
>>>
>>>>At 10:54 PM +0800 8/25/04, PC Leung wrote:
>>>>
>>>>
>>>>>my setup DispatchAction does not show a token when the form first displays.
>>>>>When I click submit button to create record, it shows error messages
>>>>>of handler. What does needs to be done?
>>>>
>>>>What are the error messages?
>>>>
>>>>
>>>>
>>>>>AddUserProfile.jsp constructs:
>>>>>
>>>>> <html:form action="/addUserProfile?method=create" focus="firstName">
>>>>> <html:hidden property="action"/>
>>>>> <html:submit><bean:message
>>>>>key="addUserProfileForm.submit"/></html:submit>
>>>>
>>>>here you should probably pass "method=create" as a hidden form field;
>>>>I don't think the html form tag will handle an action specified like
>>>>that correctly.
>>>>
>>>>Joe
>>>>
>>>>--
>>>>Joe Germuska
>>>>Joe@Germuska.com
>>>>http://blog.germuska.com
>>>>"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
>>>>back; I'll know I'm in the wrong place."
>>>> - Carlos Santana
>>
>>
>>---------------------------------------------------------------------
>>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: how to use DispatchAction?
Posted by PC Leung <pc...@gmail.com>.
My first web page is page contains links only. No Form nor Action.
UserMaint.jsp ---> AddUserProfileAction.java (AddUserProfile.jsp)
UserMaint.jsp constructs:
<html:link page="/AddUserProfile.jsp?method=setup">
<bean:message key="userMaint.addUserProfile"/>
</html:link>
The link becomes http://.../AddUserProfile.jsp.do?method=setup
Does it mean that it cannot invoke the setup DispatchAction?
public final class AddUserProfileAction extends DispatchAction {
public ActionForward setup (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
saveToken(request);
return (mapping.getInputForward());
}
On Wed, 25 Aug 2004 14:49:32 -0400, Bill Siggelkow
<bi...@bellsouth.net> wrote:
> I am not quite sure I am following this (it would help to see the
> relevant action mappings from your struts-config.xml but it sounds like
> you may not be saving the token *in the action preceding the JSP that
> contains the form*.
>
>
>
> PC Leung wrote:
>
> > Error message is solved.
> > but the form does not display with token when it displays
> > at the first time.
> > I think the following line does not work properly.
> >
> > UserMaint.jsp constructs:
> > <html:link page="/AddUserProfile.jsp?method=setup">
> >
> > In the setup DispatchAction, I try to saveToken().
> >
> > On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
> >
> >>At 10:54 PM +0800 8/25/04, PC Leung wrote:
> >>
> >>>my setup DispatchAction does not show a token when the form first displays.
> >>>When I click submit button to create record, it shows error messages
> >>>of handler. What does needs to be done?
> >>
> >>What are the error messages?
> >>
> >>
> >>>AddUserProfile.jsp constructs:
> >>>
> >>> <html:form action="/addUserProfile?method=create" focus="firstName">
> >>> <html:hidden property="action"/>
> >>> <html:submit><bean:message
> >>>key="addUserProfileForm.submit"/></html:submit>
> >>
> >>here you should probably pass "method=create" as a hidden form field;
> >>I don't think the html form tag will handle an action specified like
> >>that correctly.
> >>
> >>Joe
> >>
> >>--
> >>Joe Germuska
> >>Joe@Germuska.com
> >>http://blog.germuska.com
> >>"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
> >>back; I'll know I'm in the wrong place."
> >> - Carlos Santana
>
>
> ---------------------------------------------------------------------
> 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: how to use DispatchAction?
Posted by Bill Siggelkow <bi...@bellsouth.net>.
I am not quite sure I am following this (it would help to see the
relevant action mappings from your struts-config.xml but it sounds like
you may not be saving the token *in the action preceding the JSP that
contains the form*.
PC Leung wrote:
> Error message is solved.
> but the form does not display with token when it displays
> at the first time.
> I think the following line does not work properly.
>
> UserMaint.jsp constructs:
> <html:link page="/AddUserProfile.jsp?method=setup">
>
> In the setup DispatchAction, I try to saveToken().
>
> On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
>
>>At 10:54 PM +0800 8/25/04, PC Leung wrote:
>>
>>>my setup DispatchAction does not show a token when the form first displays.
>>>When I click submit button to create record, it shows error messages
>>>of handler. What does needs to be done?
>>
>>What are the error messages?
>>
>>
>>>AddUserProfile.jsp constructs:
>>>
>>> <html:form action="/addUserProfile?method=create" focus="firstName">
>>> <html:hidden property="action"/>
>>> <html:submit><bean:message
>>>key="addUserProfileForm.submit"/></html:submit>
>>
>>here you should probably pass "method=create" as a hidden form field;
>>I don't think the html form tag will handle an action specified like
>>that correctly.
>>
>>Joe
>>
>>--
>>Joe Germuska
>>Joe@Germuska.com
>>http://blog.germuska.com
>>"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
>>back; I'll know I'm in the wrong place."
>> - Carlos Santana
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to use DispatchAction?
Posted by PC Leung <pc...@gmail.com>.
Error message is solved.
but the form does not display with token when it displays
at the first time.
I think the following line does not work properly.
UserMaint.jsp constructs:
<html:link page="/AddUserProfile.jsp?method=setup">
In the setup DispatchAction, I try to saveToken().
On Wed, 25 Aug 2004 10:19:04 -0500, Joe Germuska <jo...@germuska.com> wrote:
> At 10:54 PM +0800 8/25/04, PC Leung wrote:
> >my setup DispatchAction does not show a token when the form first displays.
> >When I click submit button to create record, it shows error messages
> >of handler. What does needs to be done?
>
> What are the error messages?
>
> >AddUserProfile.jsp constructs:
> >
> > <html:form action="/addUserProfile?method=create" focus="firstName">
> > <html:hidden property="action"/>
> > <html:submit><bean:message
> >key="addUserProfileForm.submit"/></html:submit>
>
> here you should probably pass "method=create" as a hidden form field;
> I don't think the html form tag will handle an action specified like
> that correctly.
>
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
> back; I'll know I'm in the wrong place."
> - Carlos Santana
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to use DispatchAction?
Posted by Joe Germuska <Jo...@Germuska.com>.
At 10:54 PM +0800 8/25/04, PC Leung wrote:
>my setup DispatchAction does not show a token when the form first displays.
>When I click submit button to create record, it shows error messages
>of handler. What does needs to be done?
What are the error messages?
>AddUserProfile.jsp constructs:
>
> <html:form action="/addUserProfile?method=create" focus="firstName">
> <html:hidden property="action"/>
> <html:submit><bean:message
>key="addUserProfileForm.submit"/></html:submit>
here you should probably pass "method=create" as a hidden form field;
I don't think the html form tag will handle an action specified like
that correctly.
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn
back; I'll know I'm in the wrong place."
- Carlos Santana