Re: Can I post my struts related queries here?
Yes -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Servlet init() equivalent in Struts 1.3.8
You can use your own Struts2 FilterDispatcher to solve this. Like this Example which is loading Configs via an SpringDAO and put it into the Application Scope: public class FilterDispatcher extends StrutsPrepareAndExecuteFilter { private static final Log log = LogFactory.getLog(FilterDispatcher.class); private ConfigDAOconfigDAO; public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); log.info("Init Application Configuration"); XmlWebApplicationContext xwac = (XmlWebApplicationContext) filterConfig.getServletContext().getAttribute("org.springframework.web.context.WebApplicationContext.ROOT"); configDAO = ConfigDAO.getFromApplicationContext(xwac); List configs = configDAO.findApplicationConfig(); for (Config c : configs) { filterConfig.getServletContext().setAttribute(c.getName(), c.getValue()); } } } Johannes - web: http://www.jgeppert.com twitter: http://twitter.com/jogep -- View this message in context: http://struts.1045723.n5.nabble.com/Servlet-init-equivalent-in-Struts-1-3-8-tp5005400p5006530.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
Can I post my struts related queries here?
Re: Dynamic Result Selection
Hi Christian, Thanks again. I think I would have to write my own interceptor. I think I can also get nextPage value from session. i.e. I can set value from my interceptor to a session variable and also from action and then use it. I would try doing that. And if it works out, I would certainly post it. Thanks & Regards, Rohan > > From: Christian Grobmeier >To: rohan jamkhedkar >Cc: Struts Users Mailing List >Sent: Saturday, 19 November 2011 1:42 PM >Subject: Re: Dynamic Result Selection > >On Sat, Nov 19, 2011 at 9:06 AM, rohan jamkhedkar > wrote: >> Hi Christian, >> Thank you for your response. I had actually defined all three >> results, success, input and error and My class did extend ActionSupport. But >> the problem was, whenever an error occurred during Interceptor invocation, >> framework would try to find value of nextPage. As action is not executed it >> would not find nextPage on valueStack. So I want to know is there any way of >> getting around this problem? Can I specify value for nextPage before any >> interceptor is invoked? > >Ah, now I understand better. > >Have you tried to define a default value for $nextPage in your class? Like: >class MyAction { >private String nextPage = "errorpage.jsp"; > >Actually the action itself will not be executed if an interceptor error occurs. >If the default value does not work, I think it might be a good idea to >write an own interceptor which catches something like that or to >extend the throwing interceptor to put a correct value into the >object. > >cheers >Christian > > >> Thanks & Regards, >> Rohan >> >> >> From: Christian Grobmeier >> To: Struts Users Mailing List ; rohan jamkhedkar >> >> Sent: Saturday, 19 November 2011 1:21 PM >> Subject: Re: Dynamic Result Selection >> >> Hello Rohan, >> >> On Sat, Nov 19, 2011 at 8:44 AM, rohan jamkhedkar >> wrote: >>> >>> %{nextPage} >> >> try to add these results too: >> >> %{nextPage} >> %{nextPage} >> >> Input is what is returned when some input is missing, error in case an >> error happens. >> Please also see the class ActionSupport, were these String constants >> are defined. To use it, extend ActionSupport and return for example: >> return SUCCESS; >> >> Of course you don't need to use ActionSupport, but I think it is a good idea >> :-) >> >> Cheers >> Christian >> >> >> -- >> http://www.grobmeier.de >> https://www.timeandbill.de >> >> >> > > > >-- >http://www.grobmeier.de >https://www.timeandbill.de > > >
Re: Dynamic Result Selection
On Sat, Nov 19, 2011 at 9:06 AM, rohan jamkhedkar wrote: > Hi Christian, > Thank you for your response. I had actually defined all three > results, success, input and error and My class did extend ActionSupport. But > the problem was, whenever an error occurred during Interceptor invocation, > framework would try to find value of nextPage. As action is not executed it > would not find nextPage on valueStack. So I want to know is there any way of > getting around this problem? Can I specify value for nextPage before any > interceptor is invoked? Ah, now I understand better. Have you tried to define a default value for $nextPage in your class? Like: class MyAction { private String nextPage = "errorpage.jsp"; Actually the action itself will not be executed if an interceptor error occurs. If the default value does not work, I think it might be a good idea to write an own interceptor which catches something like that or to extend the throwing interceptor to put a correct value into the object. cheers Christian > Thanks & Regards, > Rohan > > > From: Christian Grobmeier > To: Struts Users Mailing List ; rohan jamkhedkar > > Sent: Saturday, 19 November 2011 1:21 PM > Subject: Re: Dynamic Result Selection > > Hello Rohan, > > On Sat, Nov 19, 2011 at 8:44 AM, rohan jamkhedkar > wrote: >> >> %{nextPage} > > try to add these results too: > > %{nextPage} > %{nextPage} > > Input is what is returned when some input is missing, error in case an > error happens. > Please also see the class ActionSupport, were these String constants > are defined. To use it, extend ActionSupport and return for example: > return SUCCESS; > > Of course you don't need to use ActionSupport, but I think it is a good idea > :-) > > Cheers > Christian > > > -- > http://www.grobmeier.de > https://www.timeandbill.de > > > -- http://www.grobmeier.de https://www.timeandbill.de - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Dynamic Result Selection
Hi Christian, Thank you for your response. I had actually defined all three results, success, input and error and My class did extend ActionSupport. But the problem was, whenever an error occurred during Interceptor invocation, framework would try to find value of nextPage. As action is not executed it would not find nextPage on valueStack. So I want to know is there any way of getting around this problem? Can I specify value for nextPage before any interceptor is invoked? Thanks & Regards, Rohan > > From: Christian Grobmeier >To: Struts Users Mailing List ; rohan jamkhedkar > >Sent: Saturday, 19 November 2011 1:21 PM >Subject: Re: Dynamic Result Selection > >Hello Rohan, > >On Sat, Nov 19, 2011 at 8:44 AM, rohan jamkhedkar > wrote: >> >> %{nextPage} > >try to add these results too: > >%{nextPage} >%{nextPage} > >Input is what is returned when some input is missing, error in case an >error happens. >Please also see the class ActionSupport, were these String constants >are defined. To use it, extend ActionSupport and return for example: >return SUCCESS; > >Of course you don't need to use ActionSupport, but I think it is a good idea >:-) > >Cheers >Christian > > >-- >http://www.grobmeier.de >https://www.timeandbill.de > > >