Re: How to forward....
Hi Rafael, instead forward name="success" path="/MainMenu.class" write forward name="success" path="/MainMenu.do". Best greetingsgus. , Paweł Wiel 2009/12/16 Rafael Muneton : > > Hello: > > > > I am trying to develop a small application that contains a Login.jsp, in case > of failure the controller must redirect to Login.jsp again; in case of > success the controller must redirect to a Java application ,MainMenu.class. > > > > I think this is done in struts-config.xml file: > > > > > > > "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" > > "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";> > > > > > > > > > > > > > type="jhtp5.jsp.LoginForm"/> > > > > > > > > > > > type="jhtp5.jsp.LoginAction" > > name="loginForm" > > scope="request" > > input="/login.jsp" > > validate="true"> > > > > > > > > > > > > > parameter="ApplicationResources"/> > > > > > > Is this OK?? > > What is the right way to do it > > Any help is welcome. > > > > Vangelis > > _ > Windows Live: Make it easier for your friends to see what you’re up to on > Facebook. > http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
How to forward....
Hello: I am trying to develop a small application that contains a Login.jsp, in case of failure the controller must redirect to Login.jsp again; in case of success the controller must redirect to a Java application ,MainMenu.class. I think this is done in struts-config.xml file: http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";> Is this OK?? What is the right way to do it Any help is welcome. Vangelis _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
Re:Re: How to forward request in struts 2.1.6?
by the idea of Convention-plugin(CodeBehind-plugin)--"Zero Config",it provides: Action location by package naming conventions Result (JSP, FreeMarker, etc) location by naming conventions Class name to URL naming convention Package name to namespace convention SEO compliant URLs (i.e. my-action rather than MyAction) the normal mappings don't work in the REST-plugin environment. 在2009-05-01,"Dave Newton" 写道: >xnpeng wrote: >> public class PublishController extends PublishAction implements Preparable { >> private static String message_url = "/post/message/"; >> private static String affair_url = "/post/affair/"; >> private static String business_url = "/post/business/"; >> private static String activity_url = "/post/activity/"; >> private static String announce_url = "/post/announce/"; >> private static String house_url = "/post/house/"; >> private static String case_url = "/post/case/"; >> private static String scenery_url = "/post/scenery/"; >> private static String poll_url = "/post/poll/"; >> >> if (category != null) { >> if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) { >> ServletActionContext.getResponse() >> >> .sendRedirect(ServletActionContext.getRequest().getContextPath() + >> message_url + "new"); >> } else if >> (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) { >> ServletActionContext.getResponse() >> >> .sendRedirect(ServletActionContext.getRequest().getContextPath() + >> affair_url + "new"); > > [...snip...] > >I'm not sure I understand the issue either, but man, isn't this what >maps were made for?! > >Dave > > >- >To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >For additional commands, e-mail: user-h...@struts.apache.org >
Re: How to forward request in struts 2.1.6?
xnpeng wrote: public class PublishController extends PublishAction implements Preparable { private static String message_url = "/post/message/"; private static String affair_url = "/post/affair/"; private static String business_url = "/post/business/"; private static String activity_url = "/post/activity/"; private static String announce_url = "/post/announce/"; private static String house_url = "/post/house/"; private static String case_url = "/post/case/"; private static String scenery_url = "/post/scenery/"; private static String poll_url = "/post/poll/"; if (category != null) { if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + message_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + affair_url + "new"); > [...snip...] I'm not sure I understand the issue either, but man, isn't this what maps were made for?! Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re:Re: Re: How to forward request in struts 2.1.6?
so many thanks. forgive my poor english. there are some words in this document: http://struts.apache.org/2.1.6/docs/rest-plugin.html Also, notice we aren't returning the usual "success" result code in either method. This allows us to use the special features of the Codebehind Plugin to intuitively select the result template to process when this resource is accessed with the .xhtml extension. In this case, we can provide a customized XHTML view of the resource by creating /orders-show.jsp and /orders-update.jsp for the respective methods. my code is like this: package com.xunan.sitexa.rest; import com.opensymphony.xwork2.Preparable; import com.xunan.sitexa.action.PublishAction; import com.xunan.sitexa.post.data.Category; import com.xunan.sitexa.post.service.CategoryService; import org.apache.struts2.ServletActionContext; import org.apache.struts2.rest.DefaultHttpHeaders; import org.apache.struts2.rest.HttpHeaders; import javax.servlet.ServletException; import java.io.IOException; /** * User: xnpeng * Date: 2009-4-21 * Time: 20:02:50 */ public class PublishController extends PublishAction implements Preparable { private static String message_url = "/post/message/"; private static String affair_url = "/post/affair/"; private static String business_url = "/post/business/"; private static String activity_url = "/post/activity/"; private static String announce_url = "/post/announce/"; private static String house_url = "/post/house/"; private static String case_url = "/post/case/"; private static String scenery_url = "/post/scenery/"; private static String poll_url = "/post/poll/"; public void prepare() { site = getHome(); } public HttpHeaders index() throws IOException { String cateId = ServletActionContext.getRequest().getParameter("cateId"); if (cateId != null && !cateId.equals("")) category = CategoryService.getCategory(cateId); if (category != null) { if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + message_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.AFFAIR)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + affair_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.BUSINESS)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + business_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.ACTIVITY)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + activity_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.ANNOUNCE)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + announce_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.HOUSE)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + house_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.CASE)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + case_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.SCENERY)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + scenery_url + "new"); } else if (category.getCateId().equalsIgnoreCase(Category.POLL)) { ServletActionContext.getResponse() .sendRedirect(ServletActionContext.getRequest().getContextPath() + poll_url + "new"); } } return new DefaultHttpHeaders(""); } public HttpHeaders show() throws IOException, ServletException { String cateId = ServletActionContext.getRequest().getParameter("cateId"); if (cateId != null && !cateId.equals("")) category = CategoryService.getCategory(cateId); String id = ServletActionContext.getRequest().getParameter("id"); if (category != null && id != null) { if (category.getCateId().equalsIgnoreCase(Category.MESSAGE)) { ServletActionContext.getServletContext().getRequestDispatcher(message_url + id + "/show") .forward(ServletActionContext.getRequest(), ServletActionContext.getResponse()); } else if (category.getCa
Re: Re: How to forward request in struts 2.1.6?
I'm not sure I understand your problem. Maybe you can give an example? I would be surprised if you couldn't handle this with regular Struts 2 results. http://struts.apache.org/2.1.6/docs/result-types.html http://struts.apache.org/2.1.6/docs/result-configuration.html http://struts.apache.org/2.1.6/docs/parameters-in-configuration-results.html Nils-H 2009/4/30 xnpeng : > thanks for your reply. > the result types cannot do my jobs in struts2+rest environment. in this > environment, the "success","error",... did not work, only "index","show" ,... > are the default result types. I can manage this. > > my situation is, I need to forward request to action conditionally,ie,depend > on "category" in action class. > > > > > 在2009-04-29,"Nils-Helge Garli Hegvik" 写道: >>Why do you need to do it manually with the request dispatcher? Can't >>you use any of the available result types? >> >>http://struts.apache.org/2.1.6/docs/result-types.html >> >>Nils-H >> >>2009/4/29 xnpeng : >>> from: >>> >>> ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse()); >>> >>> I want to forward request to http://localhost:8080/post/message/3166, >>> >>> but it always throws out exception says requested resource not exist. >>> >>> when replace the string with "/index.jsp",it can work correctly. >>> >>> so, anyone who can help? I just want to forward request to an ACTION other >>> than jsp file. >>> >>> thanks. >> >>- >>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>For additional commands, e-mail: user-h...@struts.apache.org >> > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re:Re: How to forward request in struts 2.1.6?
thanks for your reply. the result types cannot do my jobs in struts2+rest environment. in this environment, the "success","error",... did not work, only "index","show" ,... are the default result types. I can manage this. my situation is, I need to forward request to action conditionally,ie,depend on "category" in action class. 在2009-04-29,"Nils-Helge Garli Hegvik" 写道: >Why do you need to do it manually with the request dispatcher? Can't >you use any of the available result types? > >http://struts.apache.org/2.1.6/docs/result-types.html > >Nils-H > >2009/4/29 xnpeng : >> from: >> >> ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse()); >> >> I want to forward request to http://localhost:8080/post/message/3166, >> >> but it always throws out exception says requested resource not exist. >> >> when replace the string with "/index.jsp",it can work correctly. >> >> so, anyone who can help? I just want to forward request to an ACTION other >> than jsp file. >> >> thanks. > >- >To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >For additional commands, e-mail: user-h...@struts.apache.org >
Re: How to forward request in struts 2.1.6?
Why do you need to do it manually with the request dispatcher? Can't you use any of the available result types? http://struts.apache.org/2.1.6/docs/result-types.html Nils-H 2009/4/29 xnpeng : > from: > > ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse()); > > I want to forward request to http://localhost:8080/post/message/3166, > > but it always throws out exception says requested resource not exist. > > when replace the string with "/index.jsp",it can work correctly. > > so, anyone who can help? I just want to forward request to an ACTION other > than jsp file. > > thanks. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
How to forward request in struts 2.1.6?
from: ServletActionContext.getServletContext().getRequestDispatcher("/post/message/"+id).forward(ServletActionContext.getRequest(),ServletActionContext.getResponse()); I want to forward request to http://localhost:8080/post/message/3166, but it always throws out exception says requested resource not exist. when replace the string with "/index.jsp",it can work correctly. so, anyone who can help? I just want to forward request to an ACTION other than jsp file. thanks.
Re: [S2] How to forward to another struts mapping
You can do it in two ways - 1. Action chaining using result type="chain" - But as a rule, action chaining is not recommended. 2. Using Redirect-after-post pattern. You'll need to define result type="redirectAction". For example, if you need to redirect from ActionA to ActionB, your struts2 config will look like - ActionB While redirecting, you'll need to persist any data that is needed for subsequest request temporarily on the server side (flash scope in popular lingo :^) ) . You might want take a look at the Scope plugin which provides such support out of the box. - Omkar alexworden wrote: > > Hi, > > I'm trying to process a request to URL-A with Action-A, then display a > home page of URL-B in Struts 2. However, in order to display the view of > URL-B, I need to invoke Action-B first. I also want any ActionErrors from > Action-A to be present in the view of URL-B. > > How do I do this? It used to be simple in Struts-1, but I can't figure it > out for Struts2. > > Thanks, > > Alex > -- View this message in context: http://www.nabble.com/-S2--How-to-forward-to-another-struts-mapping-tf4846285.html#a13873782 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] How to forward to another struts mapping
Hi, I'm trying to process a request to URL-A with Action-A, then display a home page of URL-B in Struts 2. However, in order to display the view of URL-B, I need to invoke Action-B first. I also want any ActionErrors from Action-A to be present in the view of URL-B. How do I do this? It used to be simple in Struts-1, but I can't figure it out for Struts2. Thanks, Alex -- View this message in context: http://www.nabble.com/-S2--How-to-forward-to-another-struts-mapping-tf4846285.html#a13865418 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Login implementation, how to forward user to original destination?
There's no perfect solution. You should choose a first-win or last-win strategy. Paul On 10/1/07, Anton Pussep <[EMAIL PROTECTED]> wrote: > > First of all thanks a lot for the fast reply. > > The problem with storing something in the session is it that if the user > tried to access two different pages at once in separate windows and had > to login in both, he will be forwarded in both to the last page he tried > to access. I think this is a quite realistic scenario, for example if a > user was logged in and used the service in separate windows, but was > kicked out by the system because he was inactive for a while. Any way to > do that? > > Best, > Anton > > Paul Benedict wrote: > > Anton, > > > > Acegi Security does something similar. The original requests (yes -- the > > actual request object) is stored in the session when the user's > credentials > > are challenged. If they then succeed at the login page, the original > request > > is taken from the session and forwarded along. > > > > Paul > > > > On 9/30/07, Anton Pussep <[EMAIL PROTECTED]> wrote: > >> I spent quite a few hours today trying to forward the user to his > >> original destination when he has to login in between. > >> > >> I have an interceptor (Authentication) that is called before an action > >> and it forwards to Login.action if the user is not logged in. The > >> problem is that if Login.action returns SUCCESS the struts.xml maps it > >> to a static page (index.jsp) and not the page originally requested by > >> the user. > >> > >> My current solution is it that the Authentication interceptor saves the > >> requested URL as a session attribute and Login.action reads it and > makes > >> a getResponse().sendForward(requestedURL). However, I am not happy with > >> this solution and I guess there are some much better solutions out > >> there. Would be great if you could suggest me a better way to do that. > >> > >> Best regards, > >> Anton > >> > >> - > >> 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: Login implementation, how to forward user to original destination?
First of all thanks a lot for the fast reply. The problem with storing something in the session is it that if the user tried to access two different pages at once in separate windows and had to login in both, he will be forwarded in both to the last page he tried to access. I think this is a quite realistic scenario, for example if a user was logged in and used the service in separate windows, but was kicked out by the system because he was inactive for a while. Any way to do that? Best, Anton Paul Benedict wrote: > Anton, > > Acegi Security does something similar. The original requests (yes -- the > actual request object) is stored in the session when the user's credentials > are challenged. If they then succeed at the login page, the original request > is taken from the session and forwarded along. > > Paul > > On 9/30/07, Anton Pussep <[EMAIL PROTECTED]> wrote: >> I spent quite a few hours today trying to forward the user to his >> original destination when he has to login in between. >> >> I have an interceptor (Authentication) that is called before an action >> and it forwards to Login.action if the user is not logged in. The >> problem is that if Login.action returns SUCCESS the struts.xml maps it >> to a static page (index.jsp) and not the page originally requested by >> the user. >> >> My current solution is it that the Authentication interceptor saves the >> requested URL as a session attribute and Login.action reads it and makes >> a getResponse().sendForward(requestedURL). However, I am not happy with >> this solution and I guess there are some much better solutions out >> there. Would be great if you could suggest me a better way to do that. >> >> Best regards, >> Anton >> >> - >> 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: Login implementation, how to forward user to original destination?
Anton, Acegi Security does something similar. The original requests (yes -- the actual request object) is stored in the session when the user's credentials are challenged. If they then succeed at the login page, the original request is taken from the session and forwarded along. Paul On 9/30/07, Anton Pussep <[EMAIL PROTECTED]> wrote: > > I spent quite a few hours today trying to forward the user to his > original destination when he has to login in between. > > I have an interceptor (Authentication) that is called before an action > and it forwards to Login.action if the user is not logged in. The > problem is that if Login.action returns SUCCESS the struts.xml maps it > to a static page (index.jsp) and not the page originally requested by > the user. > > My current solution is it that the Authentication interceptor saves the > requested URL as a session attribute and Login.action reads it and makes > a getResponse().sendForward(requestedURL). However, I am not happy with > this solution and I guess there are some much better solutions out > there. Would be great if you could suggest me a better way to do that. > > Best regards, > Anton > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Login implementation, how to forward user to original destination?
I spent quite a few hours today trying to forward the user to his original destination when he has to login in between. I have an interceptor (Authentication) that is called before an action and it forwards to Login.action if the user is not logged in. The problem is that if Login.action returns SUCCESS the struts.xml maps it to a static page (index.jsp) and not the page originally requested by the user. My current solution is it that the Authentication interceptor saves the requested URL as a session attribute and Login.action reads it and makes a getResponse().sendForward(requestedURL). However, I am not happy with this solution and I guess there are some much better solutions out there. Would be great if you could suggest me a better way to do that. Best regards, Anton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward to a page out of .war file
If you configure your web applications so that the context is shared then you will be able to get resources from the other web applications. See for more details the documentation for the web application context configuration (context.xml). As Struts uses standard RequestDispatcher, then you should get what you need. Best, Aram Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 94 635063 E-mail: [EMAIL PROTECTED]
Re: How to forward to a page out of .war file
can't you use a redirect? i think you can't forward outside the same context (but i'm not sure, maybe some servlet containers can do it). El lun, 10-09-2007 a las 17:45 -0700, [EMAIL PROTECTED] escribió: > Hi, > > The present application structure has multiple .war files in a .ear file. > Now my login module is part of 1.war and on a successful validation i want > to forward in struts-config.xml to a page in 2.war file. > > How do i achieve this? > > Thank you -- Jorge Martin Cuervo Outsourcing Emarketplace deFacto Powered by Standards email <[EMAIL PROTECTED]> voice +34 985 129 820 voice +34 660 026 384 DE FACTO STANDARDS, S.L., le informa que su dirección de correo electrónico, así como el resto de los datos de carácter personal que nos facilite, serán objeto de tratamiento automatizado en nuestros ficheros, con la finalidad del envío de información comercial y/o personal por vía electrónica. Vd. podrá en cualquier momento ejercer el derecho de acceso, rectificación, cancelación y oposición en los términos establecidos en la Ley Orgánica de Protección de Datos de Carácter Personal (LOPD. 15/1999), dirigiendo un escrito a C/ Gutiérrez Herrero (Centro De Empresas 'La Curtidora'), 52 - oficina 207 - 33402 AVILES (Asturias), o a nuestra dirección de correo electrónico ([EMAIL PROTECTED]). También informamos que la información incluida en este e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario arriba mencionado. Si Usted lee este mensaje y no es el destinatario indicado, le informamos que está totalmente prohibida cualquier utilización, divulgación, distribución y/o reproducción de esta comunicación sin autorización expresa en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos nos lo notifique inmediatamente por esta misma vía y proceda a su eliminación. This e-mail contains information that will be added to our computerised guest data base and will be trated in the strict confidence. If you wish to access, correct, oppose or cancel your details, as specified the Law 15/99, December 13th, please send a certified letter to this effect to DE FACTO STANDARDS, S.L.., (C/ Gutiérrez Herrero (Centro De Empresas 'La Curtidora'), 52 - oficina 207 33402 AVILES (Asturias) SPAIN). If you read this message, and is not the destinatary, we informal you that is forbidden anything utility, distribution, divulgation or reproduction of this communication without express authorization, of the present law. If you received this message for mistake, we proud in order to the present law, immediate communication to us, and please erase this e-mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to forward to a page out of .war file
Hi, The present application structure has multiple .war files in a .ear file. Now my login module is part of 1.war and on a successful validation i want to forward in struts-config.xml to a page in 2.war file. How do i achieve this? Thank you
RE: how to forward some action from javascritp
> hi, > I have used that it is working, but the problem is I need to > re-load the page freame newly. In my present case, Iam getting data from > database. All the values will be displayed on the textbox's. > When i used the code which u have given it is reloading but > the values are not getting lost, I mean the page is getting reloaded but > not getting the textboxes blank. It is carrying previous data. can u help > me rgds this. > Rajam T. wrote: > > > Hi, > > You can use the below given statements in javascripts to forward the > control to the action. > > document.forms[0].action='myAction.do'; > document.forms[0].submit(); > > Thanks & Regards > > Rajam Thirunavukkarasu > > -Original Message- > From: msg2ajay [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 08, 2007 8:47 AM > To: user@struts.apache.org > Subject: how to forward some action from javascritp > > > hi i have to forward to controller with javascritp my script is as below. > > > > function fwd(field){ > var val=field.value; > if(val == 1){ > [b]mypage.do[/b] //<--- this is how i needed > } > } > > > > one > one > one > > > > > thx in Adv > Ajay > -- > View this message in context: > http://www.nabble.com/how-to-forward-some-action-from-javascritp-tf4234069.html#a12046424 > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > CAUTION - Disclaimer * > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended > solely for the use of the addressee(s). If you are not the intended > recipient, please notify the sender by e-mail and delete the original > message. Further, you are not to copy, disclose, or distribute this e-mail > or its contents to any other person and any such actions are unlawful. > This e-mail may contain viruses. Infosys has taken every reasonable > precaution to minimize this risk, but is not liable for any damage you may > sustain as a result of any virus in this e-mail. You should carry out your > own virus checks before opening the e-mail or attachment. Infosys reserves > the right to monitor and review the content of all messages sent to or > from this e-mail address. Messages sent to or from this e-mail address may > be stored on the Infosys e-mail system. > ***INFOSYS End of Disclaimer ****INFOSYS*** > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/how-to-forward-some-action-from-javascritp-tf4234069.html#a12065110 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to forward some action from javascritp
Hi, You can use the below given statements in javascripts to forward the control to the action. document.forms[0].action='myAction.do'; document.forms[0].submit(); Thanks & Regards Rajam Thirunavukkarasu -Original Message- From: msg2ajay [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 08, 2007 8:47 AM To: user@struts.apache.org Subject: how to forward some action from javascritp hi i have to forward to controller with javascritp my script is as below. function fwd(field){ var val=field.value; if(val == 1){ [b]mypage.do[/b] //<--- this is how i needed } } one one one thx in Adv Ajay -- View this message in context: http://www.nabble.com/how-to-forward-some-action-from-javascritp-tf4234069.html#a12046424 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS*** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to forward some action from javascritp
hi i have to forward to controller with javascritp my script is as below. function fwd(field){ var val=field.value; if(val == 1){ [b]mypage.do[/b] //<--- this is how i needed } } one one one thx in Adv Ajay -- View this message in context: http://www.nabble.com/how-to-forward-some-action-from-javascritp-tf4234069.html#a12046424 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward to an unknown view in Struts 2?
Sorry for taking so long to get back to everyone on this. This is a side project of mine and things have been hectic with the day job keeping me from this. After doing some experimentation, I've found that your solution below does work Musachy. It just won't access a property in the request attributes as I was trying to do. At least it wouldn't do it the way I was doing it. =) Setting a property in my Struts action class is working perfectly now. Thanks to everyone that responded. On 5/10/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: %{expr} won't work (yet). I modified EditPersonAction on showcase to this: @Result(name="list", value="${next}", type=ServletRedirectResult.class) public class EditPersonAction extends ActionSupport { ... public String getNext() { return "listPeople.action"; } public String execute() throws Exception { persons.addAll(personManager.getPeople()); return "list"; } .. } and it works as expected. Did you configured the initParam actionPackages in your web.xml, like?: struts org.apache.struts2.dispatcher.FilterDispatcher actionPackages org.apache.struts2.showcase.person musachy On 5/9/07, Dave Newton <[EMAIL PROTECTED]> wrote: > > --- Caine Lai <[EMAIL PROTECTED]> wrote: > > @Result(name=Action.SUCCESS, > > value="/resources/${resource}.ftl", > > type=FreemarkerResult.class) > > Am I missing something? > > Did you try using OGNL syntax, like %{resource}.ftl? > > d. > > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: How to forward to an unknown view in Struts 2?
%{expr} won't work (yet). I modified EditPersonAction on showcase to this: @Result(name="list", value="${next}", type=ServletRedirectResult.class) public class EditPersonAction extends ActionSupport { ... public String getNext() { return "listPeople.action"; } public String execute() throws Exception { persons.addAll(personManager.getPeople()); return "list"; } .. } and it works as expected. Did you configured the initParam actionPackages in your web.xml, like?: struts org.apache.struts2.dispatcher.FilterDispatcher actionPackages org.apache.struts2.showcase.person musachy On 5/9/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Caine Lai <[EMAIL PROTECTED]> wrote: > @Result(name=Action.SUCCESS, > value="/resources/${resource}.ftl", > type=FreemarkerResult.class) > Am I missing something? Did you try using OGNL syntax, like %{resource}.ftl? d. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: How to forward to an unknown view in Struts 2?
--- Caine Lai <[EMAIL PROTECTED]> wrote: > @Result(name=Action.SUCCESS, > value="/resources/${resource}.ftl", > type=FreemarkerResult.class) > Am I missing something? Did you try using OGNL syntax, like %{resource}.ftl? d. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward to an unknown view in Struts 2?
Thanks again for your help. So perhaps I'm not understanding how to get this to work. In my action I have this mapping: @Result(name=Action.SUCCESS, value="/resources/${resource}.ftl", type= FreemarkerResult.class) And in my execute method I have: request.setAttribute("resource", "myPage"); The action is trying to forward to "/resources/.ftl". Which tells me it is not resolving ${resource}. Am I missing something? Thanks, Caine On 5/9/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: I haven't tried myself but the annotations for results should work just like regular xml-configured results. musachy On 5/9/07, Caine Lai <[EMAIL PROTECTED]> wrote: > > Thanks Musachy, > > But how would one do this if they were using Struts 2 annotations to map > their action classes? Is it possible? Or am I stuck with using XML for > this one action? > > Thanks, > Caine > > On 5/9/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > > You can use OGNL expressions in the result path, just make sure that you > > use > > ${expression}, instead of %{expression}, like > > > > > > ${forwardTo} > > > > > > musachy > > > > On 5/9/07, Caine Lai <[EMAIL PROTECTED]> wrote: > > > > > > Does anyone know how I can forward to a .jsp file based on a dynamic > > > attribute (request parameter)? > > > > > > I want to write a Struts 2 action that will forward the user to a .jsp > > > dynamically. The flow works like so: > > > > > > 1. A request is made for 'resourceLocator.action?resource=common'. > > > 2. The resourceLocator.action class takes the 'resource' request > > parameter > > > and forwards the user to 'common.jsp'. > > > > > > I'm not able to figure out how this is done in Struts 2, since all > > actions > > > only return a String result which must be mapped. I'm trying to avoid > > > having to map all my resources in this action. > > > > > > Thanks! > > > > > > > > > > > -- > > "Hey you! Would you help me to carry the stone?" Pink Floyd > > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: How to forward to an unknown view in Struts 2?
I haven't tried myself but the annotations for results should work just like regular xml-configured results. musachy On 5/9/07, Caine Lai <[EMAIL PROTECTED]> wrote: Thanks Musachy, But how would one do this if they were using Struts 2 annotations to map their action classes? Is it possible? Or am I stuck with using XML for this one action? Thanks, Caine On 5/9/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > You can use OGNL expressions in the result path, just make sure that you > use > ${expression}, instead of %{expression}, like > > > ${forwardTo} > > > musachy > > On 5/9/07, Caine Lai <[EMAIL PROTECTED]> wrote: > > > > Does anyone know how I can forward to a .jsp file based on a dynamic > > attribute (request parameter)? > > > > I want to write a Struts 2 action that will forward the user to a .jsp > > dynamically. The flow works like so: > > > > 1. A request is made for 'resourceLocator.action?resource=common'. > > 2. The resourceLocator.action class takes the 'resource' request > parameter > > and forwards the user to 'common.jsp'. > > > > I'm not able to figure out how this is done in Struts 2, since all > actions > > only return a String result which must be mapped. I'm trying to avoid > > having to map all my resources in this action. > > > > Thanks! > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: How to forward to an unknown view in Struts 2?
Thanks Musachy, But how would one do this if they were using Struts 2 annotations to map their action classes? Is it possible? Or am I stuck with using XML for this one action? Thanks, Caine On 5/9/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: You can use OGNL expressions in the result path, just make sure that you use ${expression}, instead of %{expression}, like ${forwardTo} musachy On 5/9/07, Caine Lai <[EMAIL PROTECTED]> wrote: > > Does anyone know how I can forward to a .jsp file based on a dynamic > attribute (request parameter)? > > I want to write a Struts 2 action that will forward the user to a .jsp > dynamically. The flow works like so: > > 1. A request is made for 'resourceLocator.action?resource=common'. > 2. The resourceLocator.action class takes the 'resource' request parameter > and forwards the user to 'common.jsp'. > > I'm not able to figure out how this is done in Struts 2, since all actions > only return a String result which must be mapped. I'm trying to avoid > having to map all my resources in this action. > > Thanks! > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: How to forward to an unknown view in Struts 2?
Very good; I thought there had been discussion about that :) --- Musachy Barroso <[EMAIL PROTECTED]> wrote: > I was just leaving a message to Rainer on: > > https://issues.apache.org/struts/browse/WW-1879 > > I submitted the patch just a few minutes before the > xwork build, and he > wasn't sure if it was going to break something else > (coming from me I can > understand that :) ) > > musachy > > On 5/9/07, Dave Newton <[EMAIL PROTECTED]> > wrote: > > > > --- Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > just make sure that you use ${expression}, > instead > > of > > > %{expression} > > > > (Was someone going to make a change for that so > the > > config EL is the same as the normal OGNL? I think > it'd > > be nice and less confusing if they were unified :) > > > > d. > > > > > > > > > > > > > > > It's here! Your new message! > > Get new email alerts with the free Yahoo! Toolbar. > > > http://tools.search.yahoo.com/toolbar/features/mail/ > > > > > - > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > -- > "Hey you! Would you help me to carry the stone?" > Pink Floyd > Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward to an unknown view in Struts 2?
I was just leaving a message to Rainer on: https://issues.apache.org/struts/browse/WW-1879 I submitted the patch just a few minutes before the xwork build, and he wasn't sure if it was going to break something else (coming from me I can understand that :) ) musachy On 5/9/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Musachy Barroso <[EMAIL PROTECTED]> wrote: > just make sure that you use ${expression}, instead of > %{expression} (Was someone going to make a change for that so the config EL is the same as the normal OGNL? I think it'd be nice and less confusing if they were unified :) d. It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: How to forward to an unknown view in Struts 2?
--- Musachy Barroso <[EMAIL PROTECTED]> wrote: > just make sure that you use ${expression}, instead of > %{expression} (Was someone going to make a change for that so the config EL is the same as the normal OGNL? I think it'd be nice and less confusing if they were unified :) d. It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward to an unknown view in Struts 2?
You can use OGNL expressions in the result path, just make sure that you use ${expression}, instead of %{expression}, like ${forwardTo} musachy On 5/9/07, Caine Lai <[EMAIL PROTECTED]> wrote: Does anyone know how I can forward to a .jsp file based on a dynamic attribute (request parameter)? I want to write a Struts 2 action that will forward the user to a .jsp dynamically. The flow works like so: 1. A request is made for 'resourceLocator.action?resource=common'. 2. The resourceLocator.action class takes the 'resource' request parameter and forwards the user to 'common.jsp'. I'm not able to figure out how this is done in Struts 2, since all actions only return a String result which must be mapped. I'm trying to avoid having to map all my resources in this action. Thanks! -- "Hey you! Would you help me to carry the stone?" Pink Floyd
How to forward to an unknown view in Struts 2?
Does anyone know how I can forward to a .jsp file based on a dynamic attribute (request parameter)? I want to write a Struts 2 action that will forward the user to a .jsp dynamically. The flow works like so: 1. A request is made for 'resourceLocator.action?resource=common'. 2. The resourceLocator.action class takes the 'resource' request parameter and forwards the user to 'common.jsp'. I'm not able to figure out how this is done in Struts 2, since all actions only return a String result which must be mapped. I'm trying to avoid having to map all my resources in this action. Thanks!
How to Forward Request Parmeters in Struts
Hi, In struts, I have an action Act1 that forwards to a display page Page1. On that page there is a submit button whose action act2 forwards to display page Page2. I need to modify Page1 in such a way that I add an additional submit button whose action Act1A forwards to display page Page1A. On page Page1A there is a button whose action is the same as in the previous flow, Act2, but the request parameters from Page1 and Page1a I'd like to forward to Act 2. What is the best way to handle this? My action, Act1a returns null, but when I'm losing the request parameters from page 1. How do I forward the request parameters from page 1 while maintaining the request parameters from page1a to action2? I hope that this makes sense. Thanks for your assistance. - Get your email and more, right on the new Yahoo.com
Re: How to forward from one action to another, with modified parameters?
Dakota Jack wrote the following on 1/7/2006 10:09 AM: In my opinion, Eric, this is a bad solution. There are lots of reasons this is bad. Rather than go through them, I would suggest you just add the logic in /search.do?query=42 at the point you get the failure form /retrieve.do?id=42. I agree with Jack here. The code to get back your Collection of objects based on "id 42" should be about one line. Then maybe another to populate the request so you aren't really saving maybe lines of code forwarding to another action. So for example if whatever action is processing your /retrieve.do?id=42 simply do something like... retrieveAction(..) --> String forwardName = "success"; Item item = service.getItemFromDB( 42 ); if ( item == null ) { Collection items = service.performSearch( 42 ); request.setAttribute("items", items ); forwardName = "itemNotFound"; }else { //probably put item in scope request.setAttribute("item", item ); } return (mapping.findForward(forwardName )); -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward from one action to another, with modified parameters?
In my opinion, Eric, this is a bad solution. There are lots of reasons this is bad. Rather than go through them, I would suggest you just add the logic in /search.do?query=42 at the point you get the failure form /retrieve.do?id=42. On 1/7/06, Eric Jain <[EMAIL PROTECTED]> wrote: > > If a request for > >/retrieve.do?id=42 > > fails (e.g. couldn't find item in database), I'd like to say > >request.setStatus(HttpServletResponse.SC_NOT_FOUND); >request.setAttribute("warning", "Not your lucky day."); > > and forward (not redirect) the request to > >/search.do?query=42 > > Can this behavior be accomplishing with Struts? Currently I'm using > request.getRequestDispatcher(...).forward(...) with a modified > HttpServletRequest, but there must be a better way (TM)... > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~
How to forward from one action to another, with modified parameters?
If a request for /retrieve.do?id=42 fails (e.g. couldn't find item in database), I'd like to say request.setStatus(HttpServletResponse.SC_NOT_FOUND); request.setAttribute("warning", "Not your lucky day."); and forward (not redirect) the request to /search.do?query=42 Can this behavior be accomplishing with Struts? Currently I'm using request.getRequestDispatcher(...).forward(...) with a modified HttpServletRequest, but there must be a better way (TM)... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to forward to next pages?-help urgent
I have jsp1 with 2 buttons.(OneAction, OneForm) along with it. One.do defined action. I have defined in struts.config to forward to jsp1 with tiles definition. I have jsp2 with 2 buttons.(TwoAction, TwoForm defined with it.)Two.do defined action. I have defined in struts.config to forward to jsp2 with tiles definition. My question is: How to define forward in struts config for above two? I have jsp3 with 2 buttons.(ThreeAction,ThreeForm). I have defined Three.do for this. One of the button here is taking me back to jsp1(One.do) How do I do this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Forward out of struts to a URL from an Action
In struts you can redirect(not forward) to other page or site. In your action instead of mapping.findforward use following code ActionForward toAction= new ActionForward (); ActionForward fromAction = mapping.findForward("targetURL"); toAction.setPath(fromAction.getPath()); toAction.setRedirect(true); return toAction; Please note targetURL is defined in your struts config file. The above code acts as redirect and not as forward. Also you can add queryStrings to URL (if required). Please write me if you need any addtional info. Michael Oliver wrote: I would like to forward the user out of struts to a URL after an action executes without additional user input, what is the best way in Struts? I can use a page that has a redirect javascript in it, but is there a facility in Struts to do this? Michael Oliver CTO Alarius Systems LLC 3325 N. Nellis Blvd, #1 Las Vegas, NV 89115 Phone:(702)643-7425 Fax:(520)844-1036 *Note new email changed from [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Forward out of struts to a URL from an Action
Configure an Action Mapping like so: http://www.omnytex.com"; redirect="true" /> That's all. If you need it to be a little more dynamic, like I notice you said it was on the same server, if it might be moved from server to server, than get a reference to the forward above in your Action, then construct the path dynamically there before returning it. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, January 27, 2005 3:11 pm, [EMAIL PROTECTED] said: > Hi Michael, > > have a look in your struts-config.xml. > > path = "/ViewSettings.do" > redirect = "true"/> > > > Greets Mark > > Michael Oliver wrote: > >>I would like to forward the user out of struts to a URL after an action >>executes without additional user input, what is the best way in Struts? >>I can use a page that has a redirect javascript in it, but is there a >>facility in Struts to do this? >> >> >> >>Michael Oliver >> >>CTO >> >>Alarius Systems LLC >> >>3325 N. Nellis Blvd, #1 >> >>Las Vegas, NV 89115 >> >>Phone:(702)643-7425 >> >>Fax:(520)844-1036 >> >>*Note new email changed from [EMAIL PROTECTED] >> >> >> >> >> >> > > > > - > 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: How to Forward out of struts to a URL from an Action
From: "Michael Oliver" <[EMAIL PROTECTED]> > Thanks except in your example your forward isn't "outside" it is to an > action in that struts application, I want to go to a URL outside the > application, elsewhere on the same server but not to an action or jsp > page. Do the redirect yourself, and return null from execute(). -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Forward out of struts to a URL from an Action
Thanks except in your example your forward isn't "outside" it is to an action in that struts application, I want to go to a URL outside the application, elsewhere on the same server but not to an action or jsp page. I tried Path="/myhtml/somehtml.html" and it threw a Configuration Frozen exception. Michael Oliver CTO Alarius Systems LLC 3325 N. Nellis Blvd, #1 Las Vegas, NV 89115 Phone:(702)643-7425 Fax:(520)844-1036 *Note new email changed from [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, January 27, 2005 12:11 PM To: Struts Users Mailing List Subject: Re: How to Forward out of struts to a URL from an Action Hi Michael, have a look in your struts-config.xml. Greets Mark Michael Oliver wrote: >I would like to forward the user out of struts to a URL after an action >executes without additional user input, what is the best way in Struts? >I can use a page that has a redirect javascript in it, but is there a >facility in Struts to do this? > > > >Michael Oliver > >CTO > >Alarius Systems LLC > >3325 N. Nellis Blvd, #1 > >Las Vegas, NV 89115 > >Phone:(702)643-7425 > >Fax:(520)844-1036 > >*Note new email changed from [EMAIL PROTECTED] > > > > > > - 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: How to Forward out of struts to a URL from an Action
Hi Michael, have a look in your struts-config.xml. Greets Mark Michael Oliver wrote: I would like to forward the user out of struts to a URL after an action executes without additional user input, what is the best way in Struts? I can use a page that has a redirect javascript in it, but is there a facility in Struts to do this? Michael Oliver CTO Alarius Systems LLC 3325 N. Nellis Blvd, #1 Las Vegas, NV 89115 Phone:(702)643-7425 Fax:(520)844-1036 *Note new email changed from [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Forward out of struts to a URL from an Action
Your action should choose a forward with its redirect attribute set to true: Thanks, Paul -Original Message- From: Michael Oliver [mailto:[EMAIL PROTECTED] Sent: Thursday, January 27, 2005 2:54 PM To: struts-user@jakarta.apache.org Subject: How to Forward out of struts to a URL from an Action I would like to forward the user out of struts to a URL after an action executes without additional user input, what is the best way in Struts? I can use a page that has a redirect javascript in it, but is there a facility in Struts to do this? Michael Oliver CTO Alarius Systems LLC 3325 N. Nellis Blvd, #1 Las Vegas, NV 89115 Phone:(702)643-7425 Fax:(520)844-1036 *Note new email changed from [EMAIL PROTECTED] -- Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to Forward out of struts to a URL from an Action
I would like to forward the user out of struts to a URL after an action executes without additional user input, what is the best way in Struts? I can use a page that has a redirect javascript in it, but is there a facility in Struts to do this? Michael Oliver CTO Alarius Systems LLC 3325 N. Nellis Blvd, #1 Las Vegas, NV 89115 Phone:(702)643-7425 Fax:(520)844-1036 *Note new email changed from [EMAIL PROTECTED]
RE: How to forward to an Action in one web app, from the Action ofa different web app
Thanks for the prompt, and on point, input. After playing with redirects, I think I'll be able to implement the functionality I desire. -Original Message- From: Craig McClanahan [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 6:46 PM To: Struts Users Mailing List Subject: Re: How to forward to an Action in one web app, from the Action ofa different web app Frank L. Bowar wrote: >I have 3 different Struts (1.1) web applications all running in the >same Tomcat (4.1) server. When the user presses a button on a form of >one of the applications, tied to a Struts Action, I would like that >Action to be able to forward control to an Action within a different >web application, which would build the page and display it to the user. >I would like this new application to be able to "remember" who called >it, and at some point, when the user presses a button that says "Return >to original application", the new application will forward the user >back to the original application at/near the point where they first >left it. > > > I'm not following Tomcat development closely any longer, but I seem to recall that cross-context request dispatcher calls were fraught with problems up until very recent releases of 5.0.x. To make matters more intricate in your case, 4.1 is now in maintenance mode, so it's unlikely that a bug report against it would get much attention either. If you can try this against 5.0.19 or later, I wouldn't be surprised if it works. As a fallback, consider using redirects instead of forwards. Craig PS: Anyone who is running Tomcat 4.x and has the ability to upgrade should really look at this ... 5.x is more stable, faster, backwards compatible (for Servlet 2.3 / JSP 1.2 based applications), plus it enables you to use JSP 2.0 for new stuff. - 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: How to forward to an Action in one web app, from the Action of a different web app
Frank L. Bowar wrote: I have 3 different Struts (1.1) web applications all running in the same Tomcat (4.1) server. When the user presses a button on a form of one of the applications, tied to a Struts Action, I would like that Action to be able to forward control to an Action within a different web application, which would build the page and display it to the user. I would like this new application to be able to "remember" who called it, and at some point, when the user presses a button that says "Return to original application", the new application will forward the user back to the original application at/near the point where they first left it. I'm not following Tomcat development closely any longer, but I seem to recall that cross-context request dispatcher calls were fraught with problems up until very recent releases of 5.0.x. To make matters more intricate in your case, 4.1 is now in maintenance mode, so it's unlikely that a bug report against it would get much attention either. If you can try this against 5.0.19 or later, I wouldn't be surprised if it works. As a fallback, consider using redirects instead of forwards. Craig PS: Anyone who is running Tomcat 4.x and has the ability to upgrade should really look at this ... 5.x is more stable, faster, backwards compatible (for Servlet 2.3 / JSP 1.2 based applications), plus it enables you to use JSP 2.0 for new stuff. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to forward to an Action in one web app, from the Action of a different web app
I have 3 different Struts (1.1) web applications all running in the same Tomcat (4.1) server. When the user presses a button on a form of one of the applications, tied to a Struts Action, I would like that Action to be able to forward control to an Action within a different web application, which would build the page and display it to the user. I would like this new application to be able to "remember" who called it, and at some point, when the user presses a button that says "Return to original application", the new application will forward the user back to the original application at/near the point where they first left it. In my Current Action.execute() method, I'm doing: MyAction.execute() ... //Get the servlet context of the application I want to switch to. ServletContext newContext = session.getServletContext().getContext("/webmaint"); //The new ServletContext seems to be correct. //I can find JSP resources but I really want to forward to an Action in the new application!! RequestDispatcher rd = newContext.getRequestDispatcher("/MainFrameSet.jsp"); rd.forward(request, response); return(null); The following exception is generated when I execute this action code: org.apache.jasper.JasperException at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:254) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc her.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp atcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat cher.java:356) at org.mappcor.accred.ui.maint.MaintAction.performExecute(MaintAction.java: 342) at org.mappcor.jsptools.StrutsBaseAction.execute(StrutsBaseAction.java:117) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr ocessor.java:465) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 7) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa lve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:78 1) at org.apache
Re: How to forward from one LookupDispatchAction to another LDA
Riyad Kalla wrote: booya I really appreciate the code snippets and explination! I hadn't gotten involved in ActionForwards and appreciate you shedding light on the situation for me. No problems Riyad! I'm glad to give back to this list after sucking it dry for three months ;-) -- bOOyah - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward from one LookupDispatchAction to another LDA
booya I really appreciate the code snippets and explination! I hadn't gotten involved in ActionForwards and appreciate you shedding light on the situation for me. Best, Riyad On Friday 23 April 2004 09:34 am, bOOyah wrote: > Riyad Kalla wrote: > > > > > Does anyone know how I would be able to forward from one method in an > > LDA to another method in the same LDA (or any other LDA for that > > matter...)? > > I do exactly this in my own apps. I use Struts forward Actions in my > struts-config. What about something like this? (I'm assuming your > exsiting Struts forwards and 'showList' method work): > > Struts-Config.xml: > = > > ... > > > > > >parameter="/processMyProducts.do?method=showList" > type="org.apache.struts.actions.ForwardAction"/> > > > Your Action class: > = > public ActionForward execute(/* the usual args */) { > ActionForward forward = new ActionForward("defaultErrHandler"); > > String method= request.getParameter("method"); > > if (method!= null && !method.equals("")) { > if (method.equalsIgnoreCase("showList")) { > forward = showList(mapping, form, request, response); > } > else { > forward = super.execute(mapping, form, request, response); > } > } > return forward; > } > ... > public ActionForward moveDown(/* the usual args */) { > ... > // Success! Now refresh the re-ordered list: > return mapping.FindForward("successShowList"); > } > > public ActionForward showList(/* the usual args */) { > // hit the DB for the new list and forward to the JSP > // etc. > } > > To summarise: > (1) The 'moveDown' handler is called. > (2) It looks up "successShowList" thereby forwarding to > "/forward/product/showList". > (4) "/forward/product/showList" forwards back into your Struts Action > class with a 'method' parameter called 'showList' causing your existing > 'showList' method to execute. > > > That's all off the top of my head Riyad. But I use that approach all > the time. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward from one LookupDispatchAction to another LDA
Riyad Kalla wrote: UPDATE: Upgraded my Struts install to nightly build and now the code snippet below works. I'm still curious if anyone knows how one LDA can forward to another (or the same) LDA, even if it takes manually setting the parameter value (how?) protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return showList(mapping, form, request, response); } I have also used this in the past, but without execution errors (I'm using Struts 1.1 stable). But as you've rightly spotted, you are limited to only being able to forward to another method in the same Action. I, too, felt this was an 'ugly' solution because the Struts Controller is bypassed and you cannot change your mind about unchaining those actions without editing Java. I read somewhere authoritative that ActionForward was created for just this purpose; you chain the actions in the Struts config file instead. However, chaining actions programmatically could be a perfectly valid thing to do though...I've only been using Struts for three months ;-) -- bOOyah - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward from one LookupDispatchAction to another LDA
Riyad Kalla wrote: Does anyone know how I would be able to forward from one method in an LDA to another method in the same LDA (or any other LDA for that matter...)? I do exactly this in my own apps. I use Struts forward Actions in my struts-config. What about something like this? (I'm assuming your exsiting Struts forwards and 'showList' method work): Struts-Config.xml: = Your Action class: = public ActionForward execute(/* the usual args */) { ActionForward forward = new ActionForward("defaultErrHandler"); String method= request.getParameter("method"); if (method!= null && !method.equals("")) { if (method.equalsIgnoreCase("showList")) { forward = showList(mapping, form, request, response); } else { forward = super.execute(mapping, form, request, response); } } return forward; } ... public ActionForward moveDown(/* the usual args */) { ... // Success! Now refresh the re-ordered list: return mapping.FindForward("successShowList"); } public ActionForward showList(/* the usual args */) { // hit the DB for the new list and forward to the JSP // etc. } To summarise: (1) The 'moveDown' handler is called. (2) It looks up "successShowList" thereby forwarding to "/forward/product/showList". (4) "/forward/product/showList" forwards back into your Struts Action class with a 'method' parameter called 'showList' causing your existing 'showList' method to execute. That's all off the top of my head Riyad. But I use that approach all the time. -- bOOyah - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward from one LookupDispatchAction to another LDA
UPDATE: Upgraded my Struts install to nightly build and now the code snippet below works. I'm still curious if anyone knows how one LDA can forward to another (or the same) LDA, even if it takes manually setting the parameter value (how?) Thanks! Riyad Riyad Kalla wrote: UPDATE: I just tried doing what I thought would be ugly: protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return showList(mapping, form, request, response); } And it didn't work either, it threw the same exception, EVEN THOUGH the forward that returns from "showList" is actually pointing to a JSP page (not another Action or LDA like was my original problem). To be honest I'm not even entirely sure that my unspecified method got called, because the exception I get is EXACTLY the same... I'm using Struts 1.1, and I thought I saw somewhere in a longer thread from March I think that this didn't work in 1.1 but works in 1.2 (nightly build)? Riyad Kalla wrote: Hello, I have a situation where my LookupDispatchAction (LDA) has all my functionality for a particular entity defined in it (lets say "Product"). So that includes adding, removing, listing, editing and changing their order (moving them visually up/down in the table they are listed in). So far everything works fine, however I am running into a problem when I have my LDA returning a forward BACK to itself. This situation arises when someone changes the order of a product (maybe they move it down), so what happens is the "Down" button is pressed, execution goes to the "moveDown" method in the LDA. At the end of that method, a forward is returned that actually points to the same LDA, but is suppose to call the "showList" method (different path). This is done because after the order of the products is changed, you need to refresh the page with the list of products again so the user sees the changed ordering. However, as you can imagine, I get the following exception after returning the forward: javax.servlet.ServletException: Request[/forward/product/showList] does not contain handler parameter named method org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:199) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) javax.servlet.http.HttpServlet.service(HttpServlet.java:743) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) I've tried (at the end of the 'moveDown' method) to manually set a parameter (get an IllegalStateException because 'Config is Frozen') and tried to add a request attribute all by the name I have defined for the parameter (it happens to be 'method') and none of it worked. So to recap if this isn't clear so far, going into my LDA to change the ordering is fine because its from a JSP link where a value for 'parameter' is defined, so the LDA knows which method to call. However by the end of the "moveDown" method, where I need to send execution over to the "showList" method, I have no way to define a parameter value, so when the forward is returned, and execution comes BACK to the LDA, it has no parameter value (hence the exception). I've looked into using the "unspecified" method, but it SEEMS to me like that has the exact same problem... if no parameter is specified, I STILL want to forward to the showList method in the LDA, but I still won't be able to set the parameter, and it seems ugly to do a: protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return showList(); } Does anyone know how I would be able to forward from one method in an LDA to another method in the same LDA (or any other LDA for that matter...)? My entire site is a 1:1 mapping for actions and JSPs, so users never actually see ".jsp" in their address bar, its always ".do", so being able to go between LDAs is pretty important to me ;) Thank you for any help you can provide! -Riyad - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to forward from one LookupDispatchAction to another LDA
UPDATE: I just tried doing what I thought would be ugly: protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return showList(mapping, form, request, response); } And it didn't work either, it threw the same exception, EVEN THOUGH the forward that returns from "showList" is actually pointing to a JSP page (not another Action or LDA like was my original problem). To be honest I'm not even entirely sure that my unspecified method got called, because the exception I get is EXACTLY the same... I'm using Struts 1.1, and I thought I saw somewhere in a longer thread from March I think that this didn't work in 1.1 but works in 1.2 (nightly build)? Riyad Kalla wrote: Hello, I have a situation where my LookupDispatchAction (LDA) has all my functionality for a particular entity defined in it (lets say "Product"). So that includes adding, removing, listing, editing and changing their order (moving them visually up/down in the table they are listed in). So far everything works fine, however I am running into a problem when I have my LDA returning a forward BACK to itself. This situation arises when someone changes the order of a product (maybe they move it down), so what happens is the "Down" button is pressed, execution goes to the "moveDown" method in the LDA. At the end of that method, a forward is returned that actually points to the same LDA, but is suppose to call the "showList" method (different path). This is done because after the order of the products is changed, you need to refresh the page with the list of products again so the user sees the changed ordering. However, as you can imagine, I get the following exception after returning the forward: javax.servlet.ServletException: Request[/forward/product/showList] does not contain handler parameter named method org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:199) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) javax.servlet.http.HttpServlet.service(HttpServlet.java:743) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) I've tried (at the end of the 'moveDown' method) to manually set a parameter (get an IllegalStateException because 'Config is Frozen') and tried to add a request attribute all by the name I have defined for the parameter (it happens to be 'method') and none of it worked. So to recap if this isn't clear so far, going into my LDA to change the ordering is fine because its from a JSP link where a value for 'parameter' is defined, so the LDA knows which method to call. However by the end of the "moveDown" method, where I need to send execution over to the "showList" method, I have no way to define a parameter value, so when the forward is returned, and execution comes BACK to the LDA, it has no parameter value (hence the exception). I've looked into using the "unspecified" method, but it SEEMS to me like that has the exact same problem... if no parameter is specified, I STILL want to forward to the showList method in the LDA, but I still won't be able to set the parameter, and it seems ugly to do a: protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return showList(); } Does anyone know how I would be able to forward from one method in an LDA to another method in the same LDA (or any other LDA for that matter...)? My entire site is a 1:1 mapping for actions and JSPs, so users never actually see ".jsp" in their address bar, its always ".do", so being able to go between LDAs is pretty important to me ;) Thank you for any help you can provide! -Riyad - 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]
How to forward from one LookupDispatchAction to another LDA
Hello, I have a situation where my LookupDispatchAction (LDA) has all my functionality for a particular entity defined in it (lets say "Product"). So that includes adding, removing, listing, editing and changing their order (moving them visually up/down in the table they are listed in). So far everything works fine, however I am running into a problem when I have my LDA returning a forward BACK to itself. This situation arises when someone changes the order of a product (maybe they move it down), so what happens is the "Down" button is pressed, execution goes to the "moveDown" method in the LDA. At the end of that method, a forward is returned that actually points to the same LDA, but is suppose to call the "showList" method (different path). This is done because after the order of the products is changed, you need to refresh the page with the list of products again so the user sees the changed ordering. However, as you can imagine, I get the following exception after returning the forward: javax.servlet.ServletException: Request[/forward/product/showList] does not contain handler parameter named method org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:199) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) javax.servlet.http.HttpServlet.service(HttpServlet.java:743) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) I've tried (at the end of the 'moveDown' method) to manually set a parameter (get an IllegalStateException because 'Config is Frozen') and tried to add a request attribute all by the name I have defined for the parameter (it happens to be 'method') and none of it worked. So to recap if this isn't clear so far, going into my LDA to change the ordering is fine because its from a JSP link where a value for 'parameter' is defined, so the LDA knows which method to call. However by the end of the "moveDown" method, where I need to send execution over to the "showList" method, I have no way to define a parameter value, so when the forward is returned, and execution comes BACK to the LDA, it has no parameter value (hence the exception). I've looked into using the "unspecified" method, but it SEEMS to me like that has the exact same problem... if no parameter is specified, I STILL want to forward to the showList method in the LDA, but I still won't be able to set the parameter, and it seems ugly to do a: protected ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return showList(); } Does anyone know how I would be able to forward from one method in an LDA to another method in the same LDA (or any other LDA for that matter...)? My entire site is a 1:1 mapping for actions and JSPs, so users never actually see ".jsp" in their address bar, its always ".do", so being able to go between LDAs is pretty important to me ;) Thank you for any help you can provide! -Riyad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]