Re: Session Management
Hello Pawel, well the intercepter can get a message that suggest us to have a login before proceeding, I guess that can be done, I was trying this thing as I am a newbie in Struts and I was exploring the possibilities. Thats the best I can do :) Thanks for ur help and suggestions. Regards, Baran Paweł Wielgus wrote: > > Hi, > yes it's the case, > because if You are firing ajax request to server it doesn't really > care if it's ajax or plain html request, > so the responsibility to behave properly is on the page side. > I don't know if your interceptor returning html code (page) is ok for You? > Or maybe it should return something else to tell the page to reload all of > it? > Because as i think You would like to achieve such scenario: > 1. user session is lost > 2. user clicks on a link (ajax call) > 3. interceptor catches the call and states that it's not allowed > 4. page is getting some kind of info that this request is no more > accessible and it should go to loginPage.jsp - total reload of the > page > > I haven't been doing such things so i won't help You much with it more. > > Best greetings, > Paweł Wielgus. > > > 2009/4/16 Baran : >> >> Hi, >> >> Okay, this is the response I get, I did used the same thing that you are >> suggesting, Can it be an issue that I am using AJAX, as the html code of >> the >> login page is coming as a response of the http request I am making, do I >> have to redirect it via my JSP page(using javascript)? As otherwise I >> guess >> the whole thing is working fine. >> >> Regards, >> Baran >> -- >> View this message in context: >> http://www.nabble.com/Session-Management-tp23074591p23076002.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 >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Session-Management-tp23074591p23076293.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: Session Management
Hi, Okay, this is the response I get, I did used the same thing that you are suggesting, Can it be an issue that I am using AJAX, as the html code of the login page is coming as a response of the http request I am making, do I have to redirect it via my JSP page(using javascript)? As otherwise I guess the whole thing is working fine. Regards, Baran -- View this message in context: http://www.nabble.com/Session-Management-tp23074591p23076002.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: Session Management
Hi, I guess I am fine with the intercepter side, but the issue is I am not able to redirect it to a new page. The intercepter is working fine, but the respone is coming back to the same page and not to the login page. Any thing that I might be missing in the struts.xml or somewhere? coz intercepter is fine all I need is to send it to new page. Thanks Lukasz Lenart wrote: > > package example3; > > import com.opensymphony.xwork2.Action; > import com.opensymphony.xwork2.ActionInvocation; > import com.opensymphony.xwork2.interceptor.Interceptor; > > /** > * > * @author Lukasz > */ > public class LoginInterceptor implements Interceptor { > > public void destroy() { > } > > public void init() { > } > > public String intercept(ActionInvocation arg0) throws Exception { > if (arg0.getAction() instanceof LoginAction) { > return arg0.invoke(); > } > String user = (String) > arg0.getInvocationContext().getSession().get("user"); > if ( user == null || "".equals(user)) { > return Action.LOGIN; > } else { > return arg0.invoke(); > } > } > > } > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Session-Management-tp23074591p23075474.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: Session Management
Hello Paul, Thanks for the prompt response, I guess that is a right way to do, but plz suggest me how can i redirect my control to the login page. Can u plz get me the syntax, the interceptor thing is ready all i need to do is to redirect if session is not there... Thanks Baran Paweł Wielgus wrote: > > Hi Baran, > You can check for this in interceptor in struts2 or in mainservlet in > struts1. > > Best greeitings, > Paweł Wielgus. > > 2009/4/16 Baran : >> >> Hello All, >> >> I have this common scenario of handling sessions. The scenario is: >> >> 1. To check session on the jsp side when ever a page is loaded. This is >> fairly simple and can be done without much hassle. >> >> 2. Lets say the page is left unattended and the session expires but the >> user >> is still on that authenticated page. Not the thing is how can I make sure >> that any such request is not processed and is redirected to the login >> page. >> I can check the session availability but how can I redirect the control >> to >> login page. >> >> One more thing, I am working on YUI + Ajax based application, so >> basically >> all the action requests are via javascript. >> >> Any help would be appreciated. >> >> Baran >> -- >> View this message in context: >> http://www.nabble.com/Session-Management-tp23074591p23074591.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 >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Session-Management-tp23074591p23074831.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
Session Management
Hello All, I have this common scenario of handling sessions. The scenario is: 1. To check session on the jsp side when ever a page is loaded. This is fairly simple and can be done without much hassle. 2. Lets say the page is left unattended and the session expires but the user is still on that authenticated page. Not the thing is how can I make sure that any such request is not processed and is redirected to the login page. I can check the session availability but how can I redirect the control to login page. One more thing, I am working on YUI + Ajax based application, so basically all the action requests are via javascript. Any help would be appreciated. Baran -- View this message in context: http://www.nabble.com/Session-Management-tp23074591p23074591.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: Struts access static list
Thanks Chris, It helped a lot in sorting things out. Also thanks to Dave for tossing up "SDO", it sounds interesting and I would certainly consider using it at some place. Thanks musomesa wrote: > > Yes, in between the or tags the object is sitting on > top of the value stack so you can access it with OGNL like you would a > 'normal' action. Handy for things like populating combo boxes which crop > up all > over the place. > Chris M > > > **The Average US Credit Score is 692. See Yours in Just 2 Easy > Steps! > (http://pr.atwola.com/promoclk/100126575x1221421325x1201417411/aol?redir=http:%2F%2Fwww.freecreditreport.com%2Fpm%2Fdefault.aspx%3Fsc%3D668072%26h > mpgID%3D62%26bcd%3DAprilAvgfooterNO62) > > -- View this message in context: http://www.nabble.com/Struts-access-static-list-tp23018571p23033840.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: Struts access static list
Hello Chris, well this is what I was doing yesterday, I have this naive issue here...mainly because of the fact that I am new to it. If we have an action that does the the job for us. I use s:action with actionResult="false" for no html rendering, is there a way if I can use the output as an input for a combobox. I mean call the action class and fetch the output and push it in a combobox or something. I know this is something I should not be asking at this level but being new justify my query :) Thanks musomesa wrote: > > Why not write the code in its own action or pojo and use or > wherever you want it? > Chris M > **The Average US Credit Score is 692. See Yours in Just 2 Easy > Steps! > (http://pr.atwola.com/promoclk/100126575x1221621489x1201450100/aol?redir=http:%2F%2Fwww.freecreditreport.com%2Fpm%2Fdefault.aspx%3Fsc%3D668072%26h > mpgID%3D62%26bcd%3DAprilAvgfooterNO62) > > -- View this message in context: http://www.nabble.com/Struts-access-static-list-tp23018571p23033129.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: Struts access static list
Thanks Guys. Being new to Struts is the only issue I have right now and this is the reason I am not able to use my own ideas to the fuller. Your suggestions have helped a lot. Baran newton.dave wrote: > > mitch gorman wrote: >> Baran wrote: >>> This is about implementing reusability in the actions. I am struggling >>> to >>> identify the ways how we can share some comming functionality between >>> different actions. Lets say I got a list of users i need to use as a >>> combobox list at multiple pages. Right now I have to push the code in >>> every >>> action I need that list displayed for. >>> >>> any idea if I can use that list at multiple places without repeating the >>> code. I guess we need to have it static, but not sure how we can use a >>> list >>> as an static element >> >>it's a matter of reorganizing your Java classes. extract all the >> code that's common to all your user-related classes into a class called >> UserActionSupport, and then have all those user-related classes extend >> from UserActionSupport. > > For another option, consider moving that kind of code into service > objects. I'm not convinced the implementation of that behavior belongs > in the action class unless it's *very* tightly-focused and never used > anywhere else. > > There are various mechanisms that allow us to pull common code into our > actions without inheritance (think DI/IoC). Using them keeps our action > class hierarchy thin and light. > > Putting the code into our actions proper *could* lead to a heavier > action hierarchy than necessary, where we'd use only a small portion of > the functionality at any given time. > > A combination of the two, where we split the app into areas of > functionality, create base classes for each that pull in required > services, and add additional services in sub-classes only when we need > to, may be the most flexible. > > Dave > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Struts-access-static-list-tp23018571p23032982.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
Struts access static list
Hi Guys, This is about implementing reusability in the actions. I am struggling to identify the ways how we can share some comming functionality between different actions. Lets say I got a list of users i need to use as a combobox list at multiple pages. Right now I have to push the code in every action I need that list displayed for. any idea if I can use that list at multiple places without repeating the code. I guess we need to have it static, but not sure how we can use a list as an static element. Any help would be great! Thanks Baran -- View this message in context: http://www.nabble.com/Struts-access-static-list-tp23018571p23018571.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