Re: Action without a form
This should work. I've used the same construct before. Make sure that myObj != null in the Action and that you are referencing request.getAttribute(label) in the JSP. -Carl Rachell, Morgan wrote: In a JSP page, I have a link that calls an Action. Usually, this is done with a submit button within a form, but I need it to be a link. Apparently, this introduces a problem, since I'm not using a form. Basically, I want to click a link, execute an Action which puts some object in request scope, then forward to some results page. Here's the link: [ jsp snippet ] ... A href=/GetUsersAction.doList Users/A In my struts-cfg.xml, I have action path=/GetUsersAction type=GetUsersAction forward name=ViewUsers path=/ViewUsers.jsp/forward /action In the GetUsersAction class, I put an object in request scope with request.setAttribute( label, myObj ), and then call return (mapping.findForward(ViewUsers)); I believe that this Action class is not being called since no log messages are displayed in the console and myObj is not availabe in the ViewUsers JSP. However the request is forwarded to the ViewUsers.jsp file. (This part doesn't make sense.) Is it possible for me to call an action from a link without a form, or do I need to use a dummy form? Or do I need to change my stuts-cfg.xml somehow? Thanks in advance. Morgan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action without a form
You should also build your Action using a package so struts/Web Container knows exactly where to look. Do some debugging to see if the Action is actually called at all. Example struts-config.xml ActionMapping with package action path=/GetUsersAction type=app.GetUsersAction forward name=ViewUsers path=/Viewusers.jsp/ /action --Sloan In a JSP page, I have a link that calls an Action. Usually, this is done with a submit button within a form, but I need it to be a link. Apparently, this introduces a problem, since I'm not using a form. Basically, I want to click a link, execute an Action which puts some object in request scope, then forward to some results page. Here's the link: [ jsp snippet ] ... A href=/GetUsersAction.doList Users/A In my struts-cfg.xml, I have action path=/GetUsersAction type=GetUsersAction forward name=ViewUsers path=/ViewUsers.jsp/forward /action In the GetUsersAction class, I put an object in request scope with request.setAttribute( label, myObj ), and then call return (mapping.findForward(ViewUsers)); I believe that this Action class is not being called since no log messages are displayed in the console and myObj is not availabe in the ViewUsers JSP. However the request is forwarded to the ViewUsers.jsp file. (This part doesn't make sense.) Is it possible for me to call an action from a link without a form, or do I need to use a dummy form? Or do I need to change my stuts-cfg.xml somehow? Thanks in advance. Morgan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sloan Bowman www.nashlinux.com www.q3networks.com www.aboutgoodlettsville.com www.spudibby.com --- Windows 95/NT - 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action without a form
I'm not sure exactly what you want. It's easy to not have a form bean associated with an action. In struts-config.xml define your action like this: action type=com.yourcorp.YourAction path=/index/ Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Action without a form Date: Thu, 12 Sep 2002 15:55:28 -0500 Hello, I am trying to invoke an action class without having a form-bean associated with it. I know that it works with html:link tag and forward. but, can I use a button or href or something like that to be able to do this. Can somebody shed some light over this. An example would be greatly appreciated. Thank you, Prasad. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form
Thank you Dave for your reply. My question is how would you call or invoke that action from your jsp. I know we can use html:link and forward for that but I need to do it from a button or a menu item or from a javacript etc. Thank you, Prasad. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:02 PM To: [EMAIL PROTECTED] Subject: Re: Action without a form I'm not sure exactly what you want. It's easy to not have a form bean associated with an action. In struts-config.xml define your action like this: action type=com.yourcorp.YourAction path=/index/ Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Action without a form Date: Thu, 12 Sep 2002 15:55:28 -0500 Hello, I am trying to invoke an action class without having a form-bean associated with it. I know that it works with html:link tag and forward. but, can I use a button or href or something like that to be able to do this. Can somebody shed some light over this. An example would be greatly appreciated. Thank you, Prasad. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form
You invoke it just like any other url. a href=/app/someAction.domy link/a You give it the url that the action is mapped to to invoke it. Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] CC: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Action without a form Date: Thu, 12 Sep 2002 16:06:55 -0500 Thank you Dave for your reply. My question is how would you call or invoke that action from your jsp. I know we can use html:link and forward for that but I need to do it from a button or a menu item or from a javacript etc. Thank you, Prasad. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:02 PM To: [EMAIL PROTECTED] Subject: Re: Action without a form I'm not sure exactly what you want. It's easy to not have a form bean associated with an action. In struts-config.xml define your action like this: action type=com.yourcorp.YourAction path=/index/ Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Action without a form Date: Thu, 12 Sep 2002 15:55:28 -0500 Hello, I am trying to invoke an action class without having a form-bean associated with it. I know that it works with html:link tag and forward. but, can I use a button or href or something like that to be able to do this. Can somebody shed some light over this. An example would be greatly appreciated. Thank you, Prasad. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form
Thank you Dave, Here is the corresponding part of struts-config.xml file. action-mappings action path=/logoff type=com.csc.fs.crm.rrr.tc.authorization.LogoffAction forward name=SUCCESS path=/authorization/logon.jsp/ forward name=FAILURE path=/authorization/errors.jsp/ /action /action-mappings So, how should my href=. look like. Can I just say href=/logoff or do I have to give a specific path. If I say just /logoff the system is looking in the current directory of the jsp and says it can't find it. Can you help me with this. Thank you very much, Prasad. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:13 PM To: [EMAIL PROTECTED] Subject: RE: Action without a form You invoke it just like any other url. a href=/app/someAction.domy link/a You give it the url that the action is mapped to to invoke it. Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] CC: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Action without a form Date: Thu, 12 Sep 2002 16:06:55 -0500 Thank you Dave for your reply. My question is how would you call or invoke that action from your jsp. I know we can use html:link and forward for that but I need to do it from a button or a menu item or from a javacript etc. Thank you, Prasad. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:02 PM To: [EMAIL PROTECTED] Subject: Re: Action without a form I'm not sure exactly what you want. It's easy to not have a form bean associated with an action. In struts-config.xml define your action like this: action type=com.yourcorp.YourAction path=/index/ Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Action without a form Date: Thu, 12 Sep 2002 15:55:28 -0500 Hello, I am trying to invoke an action class without having a form-bean associated with it. I know that it works with html:link tag and forward. but, can I use a button or href or something like that to be able to do this. Can somebody shed some light over this. An example would be greatly appreciated. Thank you, Prasad. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form
Note that the html:link tag will do URL rewriting for you. So, to take advantage of that in your case, you might consider using the html:rewrite tag in your link, like this: a href=html:rewrite forward=forward.foo/my link/a Where you've defined forward.foo in your struts-config.xml like this: forward name=forward.foo path=/app/someAction.do/ chris -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:13 PM To: [EMAIL PROTECTED] Subject: RE: Action without a form You invoke it just like any other url. a href=/app/someAction.domy link/a You give it the url that the action is mapped to to invoke it. Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] CC: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Action without a form Date: Thu, 12 Sep 2002 16:06:55 -0500 Thank you Dave for your reply. My question is how would you call or invoke that action from your jsp. I know we can use html:link and forward for that but I need to do it from a button or a menu item or from a javacript etc. Thank you, Prasad. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:02 PM To: [EMAIL PROTECTED] Subject: Re: Action without a form I'm not sure exactly what you want. It's easy to not have a form bean associated with an action. In struts-config.xml define your action like this: action type=com.yourcorp.YourAction path=/index/ Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Action without a form Date: Thu, 12 Sep 2002 15:55:28 -0500 Hello, I am trying to invoke an action class without having a form-bean associated with it. I know that it works with html:link tag and forward. but, can I use a button or href or something like that to be able to do this. Can somebody shed some light over this. An example would be greatly appreciated. Thank you, Prasad. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form
That's the best way to do it. Dave From: Bartley, Chris P [PCS] [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: Action without a form Date: Thu, 12 Sep 2002 16:22:03 -0500 Note that the html:link tag will do URL rewriting for you. So, to take advantage of that in your case, you might consider using the html:rewrite tag in your link, like this: a href=html:rewrite forward=forward.foo/my link/a Where you've defined forward.foo in your struts-config.xml like this: forward name=forward.foo path=/app/someAction.do/ chris -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:13 PM To: [EMAIL PROTECTED] Subject: RE: Action without a form You invoke it just like any other url. a href=/app/someAction.domy link/a You give it the url that the action is mapped to to invoke it. Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] CC: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: Action without a form Date: Thu, 12 Sep 2002 16:06:55 -0500 Thank you Dave for your reply. My question is how would you call or invoke that action from your jsp. I know we can use html:link and forward for that but I need to do it from a button or a menu item or from a javacript etc. Thank you, Prasad. -Original Message- From: David Graham [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:02 PM To: [EMAIL PROTECTED] Subject: Re: Action without a form I'm not sure exactly what you want. It's easy to not have a form bean associated with an action. In struts-config.xml define your action like this: action type=com.yourcorp.YourAction path=/index/ Dave From: Challa, Prasad V [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: Action without a form Date: Thu, 12 Sep 2002 15:55:28 -0500 Hello, I am trying to invoke an action class without having a form-bean associated with it. I know that it works with html:link tag and forward. but, can I use a button or href or something like that to be able to do this. Can somebody shed some light over this. An example would be greatly appreciated. Thank you, Prasad. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Action without a form.
Use an usual HTML form. Adolfo From: Jennings, Christofer J. [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: Action without a form. Date: Mon, 15 Apr 2002 12:05:17 -0700 I'd like to have an action without an associated form. Any suggestions? Many thanks, boz _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form.
I don't use form here. action path=/jobopp/sortOpportunity type=SortJobOppAction scope=request forward name=success path=/jobopp/listSetup.do / /action -Original Message- From: Adolfo Miguelez [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 3:09 PM To: [EMAIL PROTECTED] Subject: Re: Action without a form. Use an usual HTML form. Adolfo From: Jennings, Christofer J. [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: Action without a form. Date: Mon, 15 Apr 2002 12:05:17 -0700 I'd like to have an action without an associated form. Any suggestions? Many thanks, boz _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form.
I guess what you mean by this is that you don't want a form bean associated with your action mapping, but you still want to pass data either through another bean or in the request? Could you clarify? -Original Message- From: Jennings, Christofer J. [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 3:05 PM To: 'Struts Users Mailing List' Subject: Action without a form. I'd like to have an action without an associated form. Any suggestions? Many thanks, boz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Action without a form.
Yes, it is null. -Original Message- From: Jennings, Christofer J. [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 4:14 PM To: 'Struts Users Mailing List' Subject: RE: Action without a form. Does this result in null being passed for the ActionForm parameter of perform? ,boz -Original Message- From: Leonardo Maciel [mailto:[EMAIL PROTECTED]] I don't use form here. action path=/jobopp/sortOpportunity type=SortJobOppAction scope=request forward name=success path=/jobopp/listSetup.do / /action -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]