Convention plugin question
I'm using struts2 with the convention plugin. I'm really new to all of it and haven't really used Struts 2 WITHOUT the plugin before. Seeing as it's called convention, I imagine that there are a lot of things that it can do automatically by convention. One of the things I was curious about was how struts2 resolves jsp pages vs actions. For example, suppose I have a jsp page called register.jsp, if I navigate to /register, I get to that jsp page. register.jsp might be the result of a registration so I may have an action called Register. Now if I navigate to /register, it goes to the action, and if I don't do anything else, the result page is automatically register.jsp. This is good because I can't directly access register.jsp now and I don't want the users to be able to do that. One thing I also like is that I don't have to call my result page register.jsp, I can call it register-success.jsp and it will still work the same way EXCEPT that a user can now directly type /register-success into their address bar and will be taken to that page. Conventionally, how do people solve this problem? Thanks! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: validation and form display problem
That sounds like a classic 'prepare' problem. Take a look at the documentation on implementing Preparable in your action. You will want to initialize your backing beans inside the Prepare method in your action. That when 'input' is needed, your backing beans will be loaded. On 7/10/10, Jake Vang vangj...@googlemail.com wrote: i have a form that i display. but to display that form, i have to fetch some data from the database and then place that data on the valuestack (via backing beans). when the form is displayed, it expects that those backing beans should be populated. the form then posts to a save action. i have a className-alias-validation.xml that validates the form values. i have specified that if the result is input then go back to the form. the problem is that when the result is input and the form/page is reloaded, the beans are no longer populated and the form displays as blank. is there a way to intercept or is there a hook that i can grab to have an opportunity to populate my backing beans? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Sent from my mobile device - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Authentication and Empty Classes
One thing that I don't like (haven't figured out how to get around this) is the need for empty classes. If I have a secure page, like an image upload form, let's call it (image-upload-form.jsp), I don't want the user to be able to access it if he or she is not logged in. To accomplish this, I have a package defined in my struts.xml that declares a custom interceptor. Then, in the actions that need to be secure, I declare this package as their ParentPackage using a package-info.java file. Finally, in order for an access to image-upload-form.jsp to be intercepted, I have to have a class called ImageUploadForm.java JUST so that the interceptor can be called. There's nothing in the class that needs to be done. It seems like a waste. Is there any way around this? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Convention plugin question
Hi, if i get You right search for disabling direct jsp access on this group. Best greetings, Paweł Wielgus. 2010/7/11 JP Cafaro jcafar...@gmail.com: I'm using struts2 with the convention plugin. I'm really new to all of it and haven't really used Struts 2 WITHOUT the plugin before. Seeing as it's called convention, I imagine that there are a lot of things that it can do automatically by convention. One of the things I was curious about was how struts2 resolves jsp pages vs actions. For example, suppose I have a jsp page called register.jsp, if I navigate to /register, I get to that jsp page. register.jsp might be the result of a registration so I may have an action called Register. Now if I navigate to /register, it goes to the action, and if I don't do anything else, the result page is automatically register.jsp. This is good because I can't directly access register.jsp now and I don't want the users to be able to do that. One thing I also like is that I don't have to call my result page register.jsp, I can call it register-success.jsp and it will still work the same way EXCEPT that a user can now directly type /register-success into their address bar and will be taken to that page. Conventionally, how do people solve this problem? 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: Authentication and Empty Classes
Couldn't you just declare BaseAction.java as the action's class? Also; it sounds like you're using a custom security solution; I'd suggest using Spring Security instead. Custom security code is likely to suffer from many of the bugs that Spring Security ran into years ago. -Brian On Sun, Jul 11, 2010 at 8:25 AM, JP Cafaro jcafar...@gmail.com wrote: One thing that I don't like (haven't figured out how to get around this) is the need for empty classes. If I have a secure page, like an image upload form, let's call it (image-upload-form.jsp), I don't want the user to be able to access it if he or she is not logged in. To accomplish this, I have a package defined in my struts.xml that declares a custom interceptor. Then, in the actions that need to be secure, I declare this package as their ParentPackage using a package-info.java file. Finally, in order for an access to image-upload-form.jsp to be intercepted, I have to have a class called ImageUploadForm.java JUST so that the interceptor can be called. There's nothing in the class that needs to be done. It seems like a waste. Is there any way around this? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Convention plugin question
Not quite. I think I already have it set up for direct jsp access disabled. Aka, when I type in the path to something.jsp, I can't access it. HOWEVER, when I type in /something, I can access it. Sometimes, this is good. For example, if I have a form I want the user to fill out, I don't want to make an empty class just so I can access a form. I provide a link to /something and it automatically gets me to that form. What I'm referring to is, I want to take advantage of the ability for an action, say Register.java, to automatically direct me to register-success.jsp with no annotations needed, which it can, but I don't want register-success.jsp to be accessible via /register-success. Register.java can ALSO automatically direct me to register.jsp with no annotations needed with the added benefit that I can't access register.jsp directly by going to /register because of the presence of a Register.java action. Does that make sense? Paweł Wielgus wrote: Hi, if i get You right search for disabling direct jsp access on this group. Best greetings, Paweł Wielgus. 2010/7/11 JP Cafaro jcafar...@gmail.com: I'm using struts2 with the convention plugin. I'm really new to all of it and haven't really used Struts 2 WITHOUT the plugin before. Seeing as it's called convention, I imagine that there are a lot of things that it can do automatically by convention. One of the things I was curious about was how struts2 resolves jsp pages vs actions. For example, suppose I have a jsp page called register.jsp, if I navigate to /register, I get to that jsp page. register.jsp might be the result of a registration so I may have an action called Register. Now if I navigate to /register, it goes to the action, and if I don't do anything else, the result page is automatically register.jsp. This is good because I can't directly access register.jsp now and I don't want the users to be able to do that. One thing I also like is that I don't have to call my result page register.jsp, I can call it register-success.jsp and it will still work the same way EXCEPT that a user can now directly type /register-success into their address bar and will be taken to that page. Conventionally, how do people solve this problem? 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Authentication and Empty Classes
I'm not sure I follow. There isn't an action here. Let's say I have a jsp page that I want to be secure, aka you have to be logged in to visit. For all of the secure pages that actually require some work to be done, this is ok, because the workflow is: 1) Click link to secure page, /secure-page, 2) This triggers action SecurePage.java 3)Then successfully direct to /secure-page.jsp. Some pages however, don't need any work to be done so there isn't a need for a class. In non secure cases this is fine. Click link to /insecure-page and the result is /insecure-page.jsp. In secure cases, I don't want /secure-page to go to /secure-page.jsp but I also don't want to make an empty action class for every page JUST so that an interceptor can say, hey that action is being fired but we're not logged in, redirect to login page. Is this possible? I'm not familiar with Spring, I'm still trying to get through the basics of struts2. The book I'm reading uses empty classes. I just don't like the idea that that's the only option. Brian Thompson wrote: Couldn't you just declare BaseAction.java as the action's class? Also; it sounds like you're using a custom security solution; I'd suggest using Spring Security instead. Custom security code is likely to suffer from many of the bugs that Spring Security ran into years ago. -Brian On Sun, Jul 11, 2010 at 8:25 AM, JP Cafaro jcafar...@gmail.com wrote: One thing that I don't like (haven't figured out how to get around this) is the need for empty classes. If I have a secure page, like an image upload form, let's call it (image-upload-form.jsp), I don't want the user to be able to access it if he or she is not logged in. To accomplish this, I have a package defined in my struts.xml that declares a custom interceptor. Then, in the actions that need to be secure, I declare this package as their ParentPackage using a package-info.java file. Finally, in order for an access to image-upload-form.jsp to be intercepted, I have to have a class called ImageUploadForm.java JUST so that the interceptor can be called. There's nothing in the class that needs to be done. It seems like a waste. Is there any way around this? - 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: Authentication and Empty Classes
In my project, I have everything defined as an action in a struts.xml. All my action classes extend BaseAction. Then, for cases where everything I need really *is* in the jsp, I just have an action set up something like: action name=jspOnly class=BaseAction result name=successno-action-jsp.jsp/result /action Doing it this way, *everything* will be an action (though the BaseAction execute() method doesn't really do much). -Brian On Sun, Jul 11, 2010 at 11:13 AM, JP Cafaro jcafar...@gmail.com wrote: I'm not sure I follow. There isn't an action here. Let's say I have a jsp page that I want to be secure, aka you have to be logged in to visit. For all of the secure pages that actually require some work to be done, this is ok, because the workflow is: 1) Click link to secure page, /secure-page, 2) This triggers action SecurePage.java 3)Then successfully direct to /secure-page.jsp. Some pages however, don't need any work to be done so there isn't a need for a class. In non secure cases this is fine. Click link to /insecure-page and the result is /insecure-page.jsp. In secure cases, I don't want /secure-page to go to /secure-page.jsp but I also don't want to make an empty action class for every page JUST so that an interceptor can say, hey that action is being fired but we're not logged in, redirect to login page. Is this possible? I'm not familiar with Spring, I'm still trying to get through the basics of struts2. The book I'm reading uses empty classes. I just don't like the idea that that's the only option. Brian Thompson wrote: Couldn't you just declare BaseAction.java as the action's class? Also; it sounds like you're using a custom security solution; I'd suggest using Spring Security instead. Custom security code is likely to suffer from many of the bugs that Spring Security ran into years ago. -Brian On Sun, Jul 11, 2010 at 8:25 AM, JP Cafaro jcafar...@gmail.com wrote: One thing that I don't like (haven't figured out how to get around this) is the need for empty classes. If I have a secure page, like an image upload form, let's call it (image-upload-form.jsp), I don't want the user to be able to access it if he or she is not logged in. To accomplish this, I have a package defined in my struts.xml that declares a custom interceptor. Then, in the actions that need to be secure, I declare this package as their ParentPackage using a package-info.java file. Finally, in order for an access to image-upload-form.jsp to be intercepted, I have to have a class called ImageUploadForm.java JUST so that the interceptor can be called. There's nothing in the class that needs to be done. It seems like a waste. Is there any way around this? - 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Authentication and Empty Classes
I'm trying to get away from using a struts.xml as much as possible. My struts.xml looks like this: struts constant name=struts.devMode value=true / package name=my-default extends=struts-default global-results result name=login type=redirect/authenticate/login-page/result /global-results /package package name=my-secure extends=my-default interceptors interceptor name=authenticationInterceptor class=interceptors.AuthenticationInterceptor / interceptor-stack name=secureStack interceptor-ref name=authenticationInterceptor / interceptor-ref name=defaultStack / /interceptor-stack /interceptors default-interceptor-ref name=secureStack / /package /struts Then in my package-info.java I specify @ParentPackage(my-default) or @ParentPackage(my-secure). Brian Thompson wrote: In my project, I have everything defined as an action in a struts.xml. All my action classes extend BaseAction. Then, for cases where everything I need really *is* in the jsp, I just have an action set up something like: action name=jspOnly class=BaseAction result name=successno-action-jsp.jsp/result /action Doing it this way, *everything* will be an action (though the BaseAction execute() method doesn't really do much). -Brian On Sun, Jul 11, 2010 at 11:13 AM, JP Cafaro jcafar...@gmail.com wrote: I'm not sure I follow. There isn't an action here. Let's say I have a jsp page that I want to be secure, aka you have to be logged in to visit. For all of the secure pages that actually require some work to be done, this is ok, because the workflow is: 1) Click link to secure page, /secure-page, 2) This triggers action SecurePage.java 3)Then successfully direct to /secure-page.jsp. Some pages however, don't need any work to be done so there isn't a need for a class. In non secure cases this is fine. Click link to /insecure-page and the result is /insecure-page.jsp. In secure cases, I don't want /secure-page to go to /secure-page.jsp but I also don't want to make an empty action class for every page JUST so that an interceptor can say, hey that action is being fired but we're not logged in, redirect to login page. Is this possible? I'm not familiar with Spring, I'm still trying to get through the basics of struts2. The book I'm reading uses empty classes. I just don't like the idea that that's the only option. Brian Thompson wrote: Couldn't you just declare BaseAction.java as the action's class? Also; it sounds like you're using a custom security solution; I'd suggest using Spring Security instead. Custom security code is likely to suffer from many of the bugs that Spring Security ran into years ago. -Brian On Sun, Jul 11, 2010 at 8:25 AM, JP Cafaro jcafar...@gmail.com wrote: One thing that I don't like (haven't figured out how to get around this) is the need for empty classes. If I have a secure page, like an image upload form, let's call it (image-upload-form.jsp), I don't want the user to be able to access it if he or she is not logged in. To accomplish this, I have a package defined in my struts.xml that declares a custom interceptor. Then, in the actions that need to be secure, I declare this package as their ParentPackage using a package-info.java file. Finally, in order for an access to image-upload-form.jsp to be intercepted, I have to have a class called ImageUploadForm.java JUST so that the interceptor can be called. There's nothing in the class that needs to be done. It seems like a waste. Is there any way around this? - 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 - 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: validation and form display problem
what i did was to override ValidationAware.hasErrors(). according to the docs, the workflow interceptor calls this method, if there are validation errors, it returns input and stops further execution of the action. i tried this... public boolean hasErrors() { boolean result = super.hasErrors(); if(result) { //fetch data here } return result; } On Sun, Jul 11, 2010 at 7:23 AM, Burton Rhodes burtonrho...@gmail.com wrote: That sounds like a classic 'prepare' problem. Take a look at the documentation on implementing Preparable in your action. You will want to initialize your backing beans inside the Prepare method in your action. That when 'input' is needed, your backing beans will be loaded. On 7/10/10, Jake Vang vangj...@googlemail.com wrote: i have a form that i display. but to display that form, i have to fetch some data from the database and then place that data on the valuestack (via backing beans). when the form is displayed, it expects that those backing beans should be populated. the form then posts to a save action. i have a className-alias-validation.xml that validates the form values. i have specified that if the result is input then go back to the form. the problem is that when the result is input and the form/page is reloaded, the beans are no longer populated and the form displays as blank. is there a way to intercept or is there a hook that i can grab to have an opportunity to populate my backing beans? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Sent from my mobile device - 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
where is the datepicker in struts2-core-2.1.8.1
Hi all How can i add datepicker in jsp if i'm using the struts2-core-2.1.8.1.jar and is that all the jar files i need for a simple application in struts2 from here http://mirror.olnevhost.net/pub/apache/struts/library/struts-2.1.8.1-lib.zip thank for replys