Struts2 redirect-action with post params
Hello, I am trying to redirect to an action when the default index page is navigated to. However, I want to include the post params so they are sent to the action. Here's what I've got so far: This is the action that I want to redirect to. If I call it directly, it works as expected. action name=submitXmlLicenseRequest class=net.toltech.webapps.activation.SubmitXmlLicenseRequestAction interceptor-ref name=sessionScopeDefaultStack / #{ 'licenseRequest' : 'xmlLicenseRequest' } result name=error/WEB-INF/jsp/submitXmlLicenseRequest-error.jsp/result result name=success type=chainsubmitLicenseRequest/result /action This is the redirect action. it redirects to the action, but the post parameter isn't set. action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-actionsubmitXmlLicenseRequest/result /action Here are a few different ways I've tried to get it to work. All of these end up giving me a Premature end of file Fatal Error. action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-actionsubmitXmlLicenseRequest?licenseRequest=${licenseRequest}/result /action action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-actionsubmitXmlLicenseRequest?licenseRequest=${Parameters.licenseRequest}/result /action action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-action submitXmlLicenseRequest ${licenseRequest} /result /action action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-action submitXmlLicenseRequest ${Parameters.licenseRequest} /result /action Thanks for any suggestions! Kelly -- View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24207810.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 redirect-action with post params
Using the named parameter (parameters) that Struts2 places on the OGNL stack should work for you: action name=index class=com.opensymphony.xwork2.ActionSupport result type=redirect-action param name=actionNamesubmitXmlLicenseRequest/param param name=licenseRequest${#parameters.licenseRequest}/param /result /action Brice On Jun 25, 2009 11:36am, Kelly.Graus kelly.gr...@toltech.net wrote: Hello, I am trying to redirect to an action when the default index page is navigated to. However, I want to include the post params so they are sent to the action. Here's what I've got so far: This is the action that I want to redirect to. If I call it directly, it works as expected. class=net.toltech.webapps.activation.SubmitXmlLicenseRequestAction #{ 'licenseRequest' : 'xmlLicenseRequest' } name=error/WEB-INF/jsp/submitXmlLicenseRequest-error.jsp submitLicenseRequest This is the redirect action. it redirects to the action, but the post parameter isn't set. type=redirect-actionsubmitXmlLicenseRequest Here are a few different ways I've tried to get it to work. All of these end up giving me a Premature end of file Fatal Error. type=redirect-actionsubmitXmlLicenseRequest?licenseRequest=${licenseRequest} type=redirect-actionsubmitXmlLicenseRequest?licenseRequest=${Parameters.licenseRequest} submitXmlLicenseRequest ${licenseRequest} submitXmlLicenseRequest ${Parameters.licenseRequest} Thanks for any suggestions! Kelly -- View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24207810.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 redirect-action with post params
Hi Brice, I tried that, I still am receiving a [Fatal Error] Premature end of file error, and the licenseRequest parameter is not being set. Any ideas as to why this wouldn't work? Thanks! Kelly brice.roncace wrote: Using the named parameter (parameters) that Struts2 places on the OGNL stack should work for you: action name=index class=com.opensymphony.xwork2.ActionSupport result type=redirect-action submitXmlLicenseRequest ${#parameters.licenseRequest} /result /action Brice -- View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24208402.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 redirect-action with post params
On Thu, Jun 25, 2009 at 1:36 PM, Kelly.Graus kelly.gr...@toltech.netwrote: This is the redirect action. it redirects to the action, but the post parameter isn't set. action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-actionsubmitXmlLicenseRequest/result /action Which version of struts are you using, redirect-action was renamed to redirectAction at some point. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher
Re: Struts2 redirect-action with post params
Hi Wes, I am using Struts 2.0.11.2. I tried it using redirectAction, but I am still receiving the same error. Kelly Wes Wannemacher wrote: On Thu, Jun 25, 2009 at 1:36 PM, Kelly.Graus kelly.gr...@toltech.netwrote: This is the redirect action. it redirects to the action, but the post parameter isn't set. action name=index class=com.opensymphony.xwork2.ActionSupport result name=success type=redirect-actionsubmitXmlLicenseRequest/result /action Which version of struts are you using, redirect-action was renamed to redirectAction at some point. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher -- View this message in context: http://www.nabble.com/Struts2-redirect-action-with-post-params-tp24207810p24210254.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts2 redirect action
I am having trouble getting a redirectAction to work. I am using struts2-portlet-plugin-2.1.1-SNAPSHOT, i have also tried using struts-2.0.11with no luck. Any advice? Here are my configs: WEB-INF/index.jsp % String redirectURL = view/index.action; response.sendRedirect(redirectURL); % struts.xml --- struts include file=struts-portlet-default.xml / package name=default extends=struts-portlet-default namespace=/view action name=index class= com.health.management.vitals.action.IndexAction result name=advisor type=redirectAction param name=actionNameadvisorView/param /result result name=consumer type=redirectAction param name=actionNameconsumerView/param /result /action action name=advisorView class= com.health.management.vitals.action.AdvisorViewAction result/WEB-INF/view/advisor.jsp/result /action action name=consumerView class= com.health.management.vitals.action.ConsumerViewAction result/WEB-INF/view/consumer.jsp/result /action /package /struts
Re: struts2 redirect action
Are you running this in a portlet container? Your index.jsp and the redirect url does not make sense i a portal server (unless you are embedding it in some way)? Please provide some more information. Nils-H On Jan 15, 2008 6:38 PM, Brian Relph [EMAIL PROTECTED] wrote: I am having trouble getting a redirectAction to work. I am using struts2-portlet-plugin-2.1.1-SNAPSHOT, i have also tried using struts-2.0.11with no luck. Any advice? Here are my configs: WEB-INF/index.jsp % String redirectURL = view/index.action; response.sendRedirect(redirectURL); % struts.xml --- struts include file=struts-portlet-default.xml / package name=default extends=struts-portlet-default namespace=/view action name=index class= com.health.management.vitals.action.IndexAction result name=advisor type=redirectAction param name=actionNameadvisorView/param /result result name=consumer type=redirectAction param name=actionNameconsumerView/param /result /action action name=advisorView class= com.health.management.vitals.action.AdvisorViewAction result/WEB-INF/view/advisor.jsp/result /action action name=consumerView class= com.health.management.vitals.action.ConsumerViewAction result/WEB-INF/view/consumer.jsp/result /action /package /struts - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 redirect action
My WEB-INF/index.jsp is used so that i can use the same installation as both a portlet and a servlet. Websphere comes with an embedded portlet container as well as a servlet that can serve portlets as servlets, so i can install my webapp a single time and have it accessible both in and out of my portal. I may have led you astray by including that file in my post - the redirect from there is working fine. I am testing using the JettyPlutoLauncher class and the maven-pluto-plugin / maven-jetty-plugin. When accessing my portlet at http://localhost/portlet/view/index, control goes into my index action and i return consumer - the logs show: 5227707 [btpool0-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean 'org.apache.struts2.portlet.result.PortletActionRedirectResult' instantiated via constructor [public org.apache.struts2.portlet.result.PortletActionRedirectResult()] 5227722 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - after Locale=en_US 5227722 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept } but the page remains blank. If i instead access http://localhost/portlet/pluto/index.jsp, again, control goes into my index action, i return consumer and the logs show: 316389 [btpool0-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean 'org.apache.struts2.portlet.result.PortletActionRedirectResult' instantiated via constructor [public org.apache.struts2.portlet.result.PortletActionRedirectResult()] 5316389 [btpool0-1] DEBUG org.apache.struts2.portlet.result.PortletResult - Executing result in Render phase 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletEntityImpl - Retrieved cross context: [EMAIL PROTECTED] /portlet,file:/C:/workspaces/hin-portal-test/healthe-health-management-vitals/src/main/webapp/} 5316389 [btpool0-1] DEBUG org.apache.struts2.portlet.result.PortletResult - Location: /view/consumerView.action 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletContextImpl- PortletRequestDispatcher requested: /view/consumerView.action 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletRequestDispatcherImpl - Named dispatcher created. 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletRequestDispatcherImpl - Request dispatcher created. 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.RenderRequestImpl - Render request's included mode: true 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.RenderRequestImpl - No query string appended to the included request. 5316405 [btpool0-1] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Could not find property [Pluto_/portlet.HealtheHealthManagementVitals!_org.mortbay.jetty.included] 5316405 [btpool0-1] DEBUG org.apache.pluto.internal.impl.RenderRequestImpl - Render request's included mode: false 5316405 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - after Locale=en_US 5316405 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept } 5316405 [btpool0-1] DEBUG org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher - Leaving render 5316405 [btpool0-1] DEBUG org.apache.pluto.core.PortletContainerImpl - Portlet Container [Pluto Portal Driver]: Portlet rendered for: HealtheHealthManagementVitals 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports mode [view] 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports mode [edit] 5316405 [btpool0-1] INFO org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl - Portlet mode 'edit' not found for portletId: '/portlet.HealtheHealthManagementVitals!' 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports mode [help] 5316405 [btpool0-1] INFO org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl - Portlet mode 'help' not found for portletId: '/portlet.HealtheHealthManagementVitals!' 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletWindowStateAnchorTag - Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletWindowStateAnchorTag - Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports window state [minimized] 5316405
Re: struts2 redirect action
Hm I usually experience this behaviour when the JSPs aren't found... Other than that, redirectAction runs just fine in my sample applications. Have you tried launching in debug mode and step through the code? Can you show your portlet.xml file? Nils-H On Jan 15, 2008 7:58 PM, Brian Relph [EMAIL PROTECTED] wrote: My WEB-INF/index.jsp is used so that i can use the same installation as both a portlet and a servlet. Websphere comes with an embedded portlet container as well as a servlet that can serve portlets as servlets, so i can install my webapp a single time and have it accessible both in and out of my portal. I may have led you astray by including that file in my post - the redirect from there is working fine. I am testing using the JettyPlutoLauncher class and the maven-pluto-plugin / maven-jetty-plugin. When accessing my portlet at http://localhost/portlet/view/index, control goes into my index action and i return consumer - the logs show: 5227707 [btpool0-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean 'org.apache.struts2.portlet.result.PortletActionRedirectResult' instantiated via constructor [public org.apache.struts2.portlet.result.PortletActionRedirectResult()] 5227722 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - after Locale=en_US 5227722 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept } but the page remains blank. If i instead access http://localhost/portlet/pluto/index.jsp, again, control goes into my index action, i return consumer and the logs show: 316389 [btpool0-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean 'org.apache.struts2.portlet.result.PortletActionRedirectResult' instantiated via constructor [public org.apache.struts2.portlet.result.PortletActionRedirectResult()] 5316389 [btpool0-1] DEBUG org.apache.struts2.portlet.result.PortletResult - Executing result in Render phase 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletEntityImpl - Retrieved cross context: [EMAIL PROTECTED] /portlet,file:/C:/workspaces/hin-portal-test/healthe-health-management-vitals/src/main/webapp/} 5316389 [btpool0-1] DEBUG org.apache.struts2.portlet.result.PortletResult - Location: /view/consumerView.action 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletContextImpl- PortletRequestDispatcher requested: /view/consumerView.action 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletRequestDispatcherImpl - Named dispatcher created. 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.PortletRequestDispatcherImpl - Request dispatcher created. 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.RenderRequestImpl - Render request's included mode: true 5316389 [btpool0-1] DEBUG org.apache.pluto.internal.impl.RenderRequestImpl - No query string appended to the included request. 5316405 [btpool0-1] WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Could not find property [Pluto_/portlet.HealtheHealthManagementVitals!_org.mortbay.jetty.included] 5316405 [btpool0-1] DEBUG org.apache.pluto.internal.impl.RenderRequestImpl - Render request's included mode: false 5316405 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - after Locale=en_US 5316405 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept } 5316405 [btpool0-1] DEBUG org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher - Leaving render 5316405 [btpool0-1] DEBUG org.apache.pluto.core.PortletContainerImpl - Portlet Container [Pluto Portal Driver]: Portlet rendered for: HealtheHealthManagementVitals 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports mode [view] 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports mode [edit] 5316405 [btpool0-1] INFO org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl - Portlet mode 'edit' not found for portletId: '/portlet.HealtheHealthManagementVitals!' 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Evaluated portletId to: /portlet.HealtheHealthManagementVitals! 5316405 [btpool0-1] DEBUG org.apache.pluto.driver.tags.PortletModeAnchorTag- Testing if PortletWindowConfig [/portlet.HealtheHealthManagementVitals!] supports mode [help] 5316405 [btpool0-1] INFO org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl - Portlet mode 'help' not found for
Re: struts2 redirect action
I have debugged through my own code, but not too deeply through the struts2 code. I did notice when running it with struts 2.0.11, that there was a warning that the actionMapper property of the PortletActionRedirectResult was not set b/c the bean could not be found. Would something in the web.xml affect it? I noticed in the portlet archetype, that it is empty. I have included that as well. portlet.xml ?xml version=1.0 encoding=UTF-8? portlet-app version=1.0 xmlns= http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd; id=healthehealthmanagementvitals portlet id=HealtheHealthManagementVitals description xml:lang=EN Healthe Health Management Vitals Portlet /description portlet-nameHealtheHealthManagementVitals/portlet-name display-name xml:lang=ENHealtheHealthManagementVitals/display-name portlet-class org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher /portlet-class !-- The namespace for the actions configured for view mode -- init-param nameviewNamespace/name value/view/value /init-param !-- The default action to invoke in view mode. -- init-param namedefaultViewAction/name valueindex/value /init-param expiration-cache0/expiration-cache supports mime-typetext/html/mime-type portlet-modeview/portlet-mode /supports supported-localeen/supported-locale portlet-info titleHealthe Health Management Vitals Portlet/title short-titleHealtheHealthManagementVitals/short-title keywordsstruts 2,portlet,healthe,health,management,vitals/keywords /portlet-info security-role-ref role-nameRole_Consumers/role-name /security-role-ref /portlet /portlet-app web.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app id=healthe-health-management-vitals display-namehealthe-health-management-vitals-war/display-name context-param param-namecontextConfigLocation/param-name param-value/WEB-INF/applicationContext*.xml/param-value /context-param listener listener-class org.springframework.web.context.ContextLoaderListener /listener-class /listener welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list security-constraint id=SecurityConstraint_1 web-resource-collection id=WebResourceCollection_1 web-resource-nameHealthe Health Management Vitals/web-resource-name url-pattern/HealtheHealthManagementVitals/*/url-pattern /web-resource-collection auth-constraint id=AuthConstraint_1 role-nameRole_Consumers/role-name /auth-constraint /security-constraint security-role role-nameRole_Consumers/role-name /security-role /web-app On 1/15/08, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: Hm I usually experience this behaviour when the JSPs aren't found... Other than that, redirectAction runs just fine in my sample applications. Have you tried launching in debug mode and step through the code? Can you show your portlet.xml file? Nils-H On Jan 15, 2008 7:58 PM, Brian Relph [EMAIL PROTECTED] wrote: My WEB-INF/index.jsp is used so that i can use the same installation as both a portlet and a servlet. Websphere comes with an embedded portlet container as well as a servlet that can serve portlets as servlets, so i can install my webapp a single time and have it accessible both in and out of my portal. I may have led you astray by including that file in my post - the redirect from there is working fine. I am testing using the JettyPlutoLauncher class and the maven-pluto-plugin / maven-jetty-plugin. When accessing my portlet at http://localhost/portlet/view/index, control goes into my index action and i return consumer - the logs show: 5227707 [btpool0-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean 'org.apache.struts2.portlet.result.PortletActionRedirectResult' instantiated via constructor [public org.apache.struts2.portlet.result.PortletActionRedirectResult()] 5227722 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - after Locale=en_US 5227722 [btpool0-1] DEBUG com.opensymphony.xwork2.interceptor.I18nInterceptor - intercept } but the page remains blank. If i instead access http://localhost/portlet/pluto/index.jsp, again, control goes into my index action, i return consumer and the logs show: 316389 [btpool0-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Bean 'org.apache.struts2.portlet.result.PortletActionRedirectResult' instantiated via constructor [public org.apache.struts2.portlet.result.PortletActionRedirectResult()] 5316389 [btpool0-1] DEBUG
Re: struts2 redirect action
I just realized that the proposed solution won't do what you want it to do either, since you obviously want the other action to run before the jsps are dispatched... So, you either have to re-structure your code a bit and invoke the other actions directly (either manually or by specifying it as the default action in portlet.xml), or you could try playing with the chain result to see if that does the trick. Nils-H On Jan 15, 2008 11:32 PM, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: I think I have figured out the problem. The problem is that redirectAction doesn't really do what you think it does, not when used in the render phase. I should probably implement a check for this, as you can't do a sendRedirect in a portlet. redirectAction in a portlet should only be used after executing an action in the action phase (I need to document this). So...with that in mind, you should change your configuration: struts.xml action name=index class=com.cerner.healthe.health.management.vitals.action.IndexAction result name=advisor/WEB-INF/view/advisor.jsp/result result name=consumer/WEB-INF/view/consumer.jsp/result /action Then make sure you use the redirectAction result type only when your action has been executed in the action phase (form submit, or s:url created with the attribute 'portletUrlType' set to 'action'). Hope that made sense... Nils-H On Jan 15, 2008 8:45 PM, Brian Relph [EMAIL PROTECTED] wrote: I have debugged through my own code, but not too deeply through the struts2 code. I did notice when running it with struts 2.0.11, that there was a warning that the actionMapper property of the PortletActionRedirectResult was not set b/c the bean could not be found. Would something in the web.xml affect it? I noticed in the portlet archetype, that it is empty. I have included that as well. portlet.xml ?xml version=1.0 encoding=UTF-8? portlet-app version=1.0 xmlns= http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd; id=healthehealthmanagementvitals portlet id=HealtheHealthManagementVitals description xml:lang=EN Healthe Health Management Vitals Portlet /description portlet-nameHealtheHealthManagementVitals/portlet-name display-name xml:lang=ENHealtheHealthManagementVitals/display-name portlet-class org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher /portlet-class !-- The namespace for the actions configured for view mode -- init-param nameviewNamespace/name value/view/value /init-param !-- The default action to invoke in view mode. -- init-param namedefaultViewAction/name valueindex/value /init-param expiration-cache0/expiration-cache supports mime-typetext/html/mime-type portlet-modeview/portlet-mode /supports supported-localeen/supported-locale portlet-info titleHealthe Health Management Vitals Portlet/title short-titleHealtheHealthManagementVitals/short-title keywordsstruts 2,portlet,healthe,health,management,vitals/keywords /portlet-info security-role-ref role-nameRole_Consumers/role-name /security-role-ref /portlet /portlet-app web.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app id=healthe-health-management-vitals display-namehealthe-health-management-vitals-war/display-name context-param param-namecontextConfigLocation/param-name param-value/WEB-INF/applicationContext*.xml/param-value /context-param listener listener-class org.springframework.web.context.ContextLoaderListener /listener-class /listener welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list security-constraint id=SecurityConstraint_1 web-resource-collection id=WebResourceCollection_1 web-resource-nameHealthe Health Management Vitals/web-resource-name url-pattern/HealtheHealthManagementVitals/*/url-pattern /web-resource-collection auth-constraint id=AuthConstraint_1 role-nameRole_Consumers/role-name /auth-constraint /security-constraint security-role role-nameRole_Consumers/role-name /security-role /web-app On 1/15/08, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: Hm I usually experience this behaviour when the JSPs aren't found... Other than that, redirectAction runs just fine in my sample applications. Have you tried launching in debug mode and step through the code? Can you show your portlet.xml file? Nils-H On Jan 15, 2008 7:58 PM, Brian Relph [EMAIL
Re: struts2 redirect action
Thank you so much for you help. Yes, we do want the other action to execute before reaching the jsp ... as i was refactoring the code, i read your next response, and yes, the chain result is exactly the fix for me. I think action chaining is in general frowned on, but for my initial login, i think it fits perfectly. Again, thanks for you time looking at it! On 1/15/08, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: I just realized that the proposed solution won't do what you want it to do either, since you obviously want the other action to run before the jsps are dispatched... So, you either have to re-structure your code a bit and invoke the other actions directly (either manually or by specifying it as the default action in portlet.xml), or you could try playing with the chain result to see if that does the trick. Nils-H On Jan 15, 2008 11:32 PM, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: I think I have figured out the problem. The problem is that redirectAction doesn't really do what you think it does, not when used in the render phase. I should probably implement a check for this, as you can't do a sendRedirect in a portlet. redirectAction in a portlet should only be used after executing an action in the action phase (I need to document this). So...with that in mind, you should change your configuration: struts.xml action name=index class=com.cerner.healthe.health.management.vitals.action.IndexAction result name=advisor/WEB-INF/view/advisor.jsp/result result name=consumer/WEB-INF/view/consumer.jsp/result /action Then make sure you use the redirectAction result type only when your action has been executed in the action phase (form submit, or s:url created with the attribute 'portletUrlType' set to 'action'). Hope that made sense... Nils-H On Jan 15, 2008 8:45 PM, Brian Relph [EMAIL PROTECTED] wrote: I have debugged through my own code, but not too deeply through the struts2 code. I did notice when running it with struts 2.0.11, that there was a warning that the actionMapper property of the PortletActionRedirectResult was not set b/c the bean could not be found. Would something in the web.xml affect it? I noticed in the portlet archetype, that it is empty. I have included that as well. portlet.xml ?xml version=1.0 encoding=UTF-8? portlet-app version=1.0 xmlns= http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd; id=healthehealthmanagementvitals portlet id=HealtheHealthManagementVitals description xml:lang=EN Healthe Health Management Vitals Portlet /description portlet-nameHealtheHealthManagementVitals/portlet-name display-name xml:lang=ENHealtheHealthManagementVitals/display-name portlet-class org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher /portlet-class !-- The namespace for the actions configured for view mode -- init-param nameviewNamespace/name value/view/value /init-param !-- The default action to invoke in view mode. -- init-param namedefaultViewAction/name valueindex/value /init-param expiration-cache0/expiration-cache supports mime-typetext/html/mime-type portlet-modeview/portlet-mode /supports supported-localeen/supported-locale portlet-info titleHealthe Health Management Vitals Portlet/title short-titleHealtheHealthManagementVitals/short-title keywordsstruts 2,portlet,healthe,health,management,vitals/keywords /portlet-info security-role-ref role-nameRole_Consumers/role-name /security-role-ref /portlet /portlet-app web.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app id=healthe-health-management-vitals display-namehealthe-health-management-vitals-war/display-name context-param param-namecontextConfigLocation/param-name param-value/WEB-INF/applicationContext*.xml/param-value /context-param listener listener-class org.springframework.web.context.ContextLoaderListener /listener-class /listener welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list security-constraint id=SecurityConstraint_1 web-resource-collection id=WebResourceCollection_1 web-resource-nameHealthe Health Management Vitals/web-resource-name url-pattern/HealtheHealthManagementVitals/*/url-pattern /web-resource-collection auth-constraint id=AuthConstraint_1
Struts2 redirect action result type and URI query string
Hi, I want to do a redirection to an action based on the result name of some other action. The problem is that I want to pass a number of parameters that I don't know in advance how many they are (neither their values). I have only a query string available (like ?p1=v1p2=v2ord=1 ...). I have the name and namespace of my action. Can I somehow append the query string to the URI generated by the result element? My code is the following: action name=login class=action.Login result name=success type=redirect-action param name=actionName${actionName}/param param name=namespace${actionNameSpace}/param param name=parsetrue/param /result /action Thank you, -- Filipe David Manana, [EMAIL PROTECTED] Obvious facts are like secrets to those not trained to see them.
Re: Struts2 redirect-action params with ognl-expression values
Thanks for Julien and Dave's reply. To Julien:I've try the method you suggust,it didnot work either. To Dave: the id attribute included in the form upload post via a hidden form field 2007/10/26, Dave Newton [EMAIL PROTECTED]: Is the id attribute included in the form upload post via a hidden form field or other means? d. - Original Message From: Andvar Woo [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, October 26, 2007 6:17:22 AM Subject: Struts2 redirect-action params with ognl-expression values Hi.all. Recently,I'v encounter a problem. The problem comes as follows: *First invoke a MdfNews Action with a news id param to init some variables,then goes* *to a newsModify.jsp page ,something like http://www.comanyName.com/news/MdfNews.action?id=123*http://www.comanyname.com/news/MdfNews.action?id=123* class=com.forlink.wps.news.action.NewsMdfAction name=success/WEB-INF/template/newsinfo/newsModify.jsp /WEB-INF/template/newsinfo/error.jsp *then modify the news info,post info to MdfNewsInfo Action* class=com.forlink.wps.news.action.NewsMdfInfoAction 10485760 List.action * ModNews.action?id=${id} *The id value got at ModNews.action is nothing,not even 0.* *Does anyone hnows why?Many Thanks* - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts2 redirect-action params with ognl-expression values
Did you try this ? result name=input type=redirect-action param name=actionNameModNews/param param name=id${id}/param /result Julien -Message d'origine- De : Andvar Woo [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 octobre 2007 12:17 À : Struts Users Mailing List Objet : Struts2 redirect-action params with ognl-expression values Hi.all. Recently,I'v encounter a problem. The problem comes as follows: *First invoke a MdfNews Action with a news id param to init some variables,then goes* *to a newsModify.jsp page ,something like http://www.comanyName.com/news/MdfNews.action?id=123* action name=MdfNews class=com.forlink.wps.news.action.NewsMdfAction result name=success/WEB-INF/template/newsinfo/newsModify.jsp/result result name=error/WEB-INF/template/newsinfo/error.jsp/result /action *then modify the news info,post info to MdfNewsInfo Action* action name=MdfNewsInfo class=com.forlink.wps.news.action.NewsMdfInfoAction interceptor-ref name =fileUploadStack param name=maximumSize10485760/param /interceptor-ref interceptor-ref name=defaultStack/ result name=success type=redirectList.action/result !-- *if you upload a attachment whose size exceeds 10M,then goes to input result;but the id param* *passed couldnot be assigned value of the ${id} expression* *--* result name=input type=redirect-action ModNews.action?id=${id} /result /action *The id value got at ModNews.action is nothing,not even 0.* *Does anyone hnows why?Many Thanks* This e-mail, any attachments and the information contained therein (this message) are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited. -- Ce message électronique et tous les fichiers joints ainsi que les informations contenues dans ce message ( ci après le message ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2 redirect-action params with ognl-expression values
Hi.all. Recently,I'v encounter a problem. The problem comes as follows: *First invoke a MdfNews Action with a news id param to init some variables,then goes* *to a newsModify.jsp page ,something like http://www.comanyName.com/news/MdfNews.action?id=123* action name=MdfNews class=com.forlink.wps.news.action.NewsMdfAction result name=success/WEB-INF/template/newsinfo/newsModify.jsp/result result name=error/WEB-INF/template/newsinfo/error.jsp/result /action *then modify the news info,post info to MdfNewsInfo Action* action name=MdfNewsInfo class=com.forlink.wps.news.action.NewsMdfInfoAction interceptor-ref name =fileUploadStack param name=maximumSize10485760/param /interceptor-ref interceptor-ref name=defaultStack/ result name=success type=redirectList.action/result !-- *if you upload a attachment whose size exceeds 10M,then goes to input result;but the id param* *passed couldnot be assigned value of the ${id} expression* *--* result name=input type=redirect-action ModNews.action?id=${id} /result /action *The id value got at ModNews.action is nothing,not even 0.* *Does anyone hnows why?Many Thanks*