Accessing VelocityEngine in action (struts2)
Dear everyone, I've setup my Webapp with Struts2 using Tiles, but I also want to use Velocity to read a template and send a newsletter email. It would be good if I could access the already configured VelocityEngine from within my action. Otherwise I would need to inject the ServletContext by myself when initializing Velocity since I want to use the WebappResourceLoader. The result type velocity work properly, but how can I read a Template? Thank you for any hint, Markus - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: form action is not calling while click on submit button: Struts2.0
I don't see any code. Dave On Sat, Apr 9, 2011 at 6:22 AM, arun arunnh...@gmail.com wrote: hi, i'm facing a problem in action calling. Enviroment: 1. apache-tomcat-6.0.18 2. Struts2.0 here is the JSP form code: Problem is that when i'm defining action like in above code, its not called on clicking submit button. But when same action is called by defining the action with submit button like : its been called successfully... so any help from you guys:) thanks in advance -- View this message in context: http://struts.1045723.n5.nabble.com/form-action-is-not-calling-while-click-on-submit-button-Struts2-0-tp4292686p4292686.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
Password comparison has a strange behavior.please help(struts2)
hello. I'm trying to register a user but what i'm testing is validations. The problem i have is the password comparison. When i want to compare the two password fields everything gets messed-up (and it also calls an actionclass even though it's client side validation). Please see the screen shots i have added at the end of the letter. I think anything else is pretty clear from the screenshots. Source code follows RegisterLogUserAction-validation.xml !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=user.firstname field-validator type=requiredstring messageYou must enter your first name./message /field-validator /field field name=user.lastname field-validator type=requiredstring messageYou must enter your last name./message /field-validator /field field name=user.email field-validator type=requiredstring messageYou cannot leave the email address field empty./message /field-validator field-validator type=email messageThe email address you entered is not valid./message /field-validator /field field name=pass field-validator type=requiredstring messageYou must enter a password./message /field-validator field-validator type=stringlength param name=minLength5/param messagePassword must contain at least ${minLength} characters./message /field-validator /field field name=passconfirm field-validator type=fieldexpression param name=expressionpass==passconfrim/param messagePassword does not match./message /field-validator /field /validators RegisterLogUserAction = import org.apache.struts2.interceptor.validation.SkipValidation; import net.translators.logic.User; public class RegisterLogUserAction extends UsersAction { //Has a static HashMap of the users private static final long serialVersionUID = -6928389480267873645L; private String message; private User user; private String pass; private String passconfirm; public void validate(){ setMessage(Has gone through validate()); } public String execute(){ message+=. Has gone though execute().; return SUCCESS; } //@SkipValidation public String serverside(){ message+=. Has gone though serverside().; return SUCCESS; } public String clientside(){ message+=. Has gone though clientside().; return SUCCESS; } public void setMessage(String message) { this.message = message; } public String getMessage() { return message; } public void setUser(User user) { this.user = user; } public User getUser() { return user; } public void setPass(String pass) { this.pass = pass; } public String getPass() { return pass; } public void setPassconfirm(String passconfirm) { this.passconfirm = passconfirm; } public String getPassconfirm() { return passconfirm; } } UserAction public class UsersAction extends ActionSupport { private static final long serialVersionUID = 7196692210557957242L; private static MapString, User users = new HashMapString, User(); public String register(){ return INPUT; } } index.jsp body p This is the default home page. Here you will see news feeds etc./p pYou can register (client side validation)/p s:form action=register-user1 method=POST validate=true s:textfield key=user.firstname / s:textfield key=user.lastname / s:textfield key=user.email / s:password key=pass / s:password key=passconfirm / s:submit / /s:form pYou can register (server side validation)/p s:form action=register-user2 method=POST s:textfield key=user.firstname / s:textfield key=user.lastname / s:textfield key=user.email / s:password key=pass / s:password key=passconfirm / s:submit / /s:form !-- -- /body struts.xml = action name=register-user1 class=net.translators.actions.users.RegisterLogUserAction method=clientside result name=success/tests/message.jsp/result result name=input/index.jsp/result /action action name=register-user2 class=net.translators.actions.users.RegisterLogUserAction method=serverside result name=success/tests/message.jsp/result result name=input/index.jsp/result /action IndexAction.properties user.firstname = First Name user.lastname = Last Name user.email = E-mail pass = Password passconfirm = Password confirmation IndexAction.java public class
Re: Password comparison has a strange behavior.please help(struts2)
Interesting. My first comment would be that client side validation doesn't support expression validations; only the following are supported as per [1]. * required validator * requiredstring validator * stringlength validator * regex validator * email validator * url validator * int validator * double validator Doesn't explain the behavior (although IIRC there were some changes made to the JS recently?) but I'd start by assuming you can't do what you're trying to do. Dave [1] http://struts.apache.org/2.x/docs/pure-javascript-client-side-validation.html On Tue, Apr 12, 2011 at 11:10 AM, alex zaim icid...@yahoo.com wrote: hello. I'm trying to register a user but what i'm testing is validations. The problem i have is the password comparison. When i want to compare the two password fields everything gets messed-up (and it also calls an actionclass even though it's client side validation). Please see the screen shots i have added at the end of the letter. I think anything else is pretty clear from the screenshots. Source code follows RegisterLogUserAction-validation.xml !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=user.firstname field-validator type=requiredstring messageYou must enter your first name./message /field-validator /field field name=user.lastname field-validator type=requiredstring messageYou must enter your last name./message /field-validator /field field name=user.email field-validator type=requiredstring messageYou cannot leave the email address field empty./message /field-validator field-validator type=email messageThe email address you entered is not valid./message /field-validator /field field name=pass field-validator type=requiredstring messageYou must enter a password./message /field-validator field-validator type=stringlength param name=minLength5/param messagePassword must contain at least ${minLength} characters./message /field-validator /field field name=passconfirm field-validator type=fieldexpression param name=expressionpass==passconfrim/param messagePassword does not match./message /field-validator /field /validators RegisterLogUserAction = import org.apache.struts2.interceptor.validation.SkipValidation; import net.translators.logic.User; public class RegisterLogUserAction extends UsersAction { //Has a static HashMap of the users private static final long serialVersionUID = -6928389480267873645L; private String message; private User user; private String pass; private String passconfirm; public void validate(){ setMessage(Has gone through validate()); } public String execute(){ message+=. Has gone though execute().; return SUCCESS; } //@SkipValidation public String serverside(){ message+=. Has gone though serverside().; return SUCCESS; } public String clientside(){ message+=. Has gone though clientside().; return SUCCESS; } public void setMessage(String message) { this.message = message; } public String getMessage() { return message; } public void setUser(User user) { this.user = user; } public User getUser() { return user; } public void setPass(String pass) { this.pass = pass; } public String getPass() { return pass; } public void setPassconfirm(String passconfirm) { this.passconfirm = passconfirm; } public String getPassconfirm() { return passconfirm; } } UserAction public class UsersAction extends ActionSupport { private static final long serialVersionUID = 7196692210557957242L; private static MapString, User users = new HashMapString, User(); public String register(){ return INPUT; } } index.jsp body p This is the default home page. Here you will see news feeds etc./p pYou can register (client side validation)/p s:form action=register-user1 method=POST validate=true s:textfield key=user.firstname / s:textfield key=user.lastname / s:textfield key=user.email / s:password key=pass / s:password key=passconfirm / s:submit / /s:form pYou can register (server side validation)/p s:form action=register-user2 method=POST s:textfield key=user.firstname / s:textfield key=user.lastname / s:textfield key=user.email / s:password key=pass / s:password key=passconfirm /
Password comparison has a strange behavior.please help
hello. I'm trying to register a user but what i'm testing is validations. The problem i have is the password comparison. When i want to compare the two password fields everything gets messed-up (and it also calls an actionclass even though it's client side validation). Please see the screen shots i have added at the end of the letter. I think anything else is pretty clear from the screenshots. Source code follows RegisterLogUserAction-validation.xml !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=user.firstname field-validator type=requiredstring messageYou must enter your first name./message /field-validator /field field name=user.lastname field-validator type=requiredstring messageYou must enter your last name./message /field-validator /field field name=user.email field-validator type=requiredstring messageYou cannot leave the email address field empty./message /field-validator field-validator type=email messageThe email address you entered is not valid./message /field-validator /field field name=pass field-validator type=requiredstring messageYou must enter a password./message /field-validator field-validator type=stringlength param name=minLength5/param messagePassword must contain at least ${minLength} characters./message /field-validator /field field name=passconfirm field-validator type=fieldexpression param name=expressionpass==passconfrim/param messagePassword does not match./message /field-validator /field /validators RegisterLogUserAction = import org.apache.struts2.interceptor.validation.SkipValidation; import net.translators.logic.User; public class RegisterLogUserAction extends UsersAction { //Has a static HashMap of the users private static final long serialVersionUID = -6928389480267873645L; private String message; private User user; private String pass; private String passconfirm; public void validate(){ setMessage(Has gone through validate()); } public String execute(){ message+=. Has gone though execute().; return SUCCESS; } //@SkipValidation public String serverside(){ message+=. Has gone though serverside().; return SUCCESS; } public String clientside(){ message+=. Has gone though clientside().; return SUCCESS; } public void setMessage(String message) { this.message = message; } public String getMessage() { return message; } public void setUser(User user) { this.user = user; } public User getUser() { return user; } public void setPass(String pass) { this.pass = pass; } public String getPass() { return pass; } public void setPassconfirm(String passconfirm) { this.passconfirm = passconfirm; } public String getPassconfirm() { return passconfirm; } } UserAction public class UsersAction extends ActionSupport { private static final long serialVersionUID = 7196692210557957242L; private static MapString, User users = new HashMapString, User(); public String register(){ return INPUT; } } index.jsp body p This is the default home page. Here you will see news feeds etc./p pYou can register (client side validation)/p s:form action=register-user1 method=POST validate=true s:textfield key=user.firstname / s:textfield key=user.lastname / s:textfield key=user.email / s:password key=pass / s:password key=passconfirm / s:submit / /s:form pYou can register (server side validation)/p s:form action=register-user2 method=POST s:textfield key=user.firstname / s:textfield key=user.lastname / s:textfield key=user.email / s:password key=pass / s:password key=passconfirm / s:submit / /s:form !-- -- /body struts.xml = action name=register-user1 class=net.translators.actions.users.RegisterLogUserAction method=clientside result name=success/tests/message.jsp/result result name=input/index.jsp/result /action action name=register-user2 class=net.translators.actions.users.RegisterLogUserAction method=serverside result name=success/tests/message.jsp/result result name=input/index.jsp/result /action IndexAction.properties user.firstname = First Name user.lastname = Last Name user.email = E-mail pass = Password passconfirm = Password confirmation IndexAction.java public class IndexAction
RE: Any TabbedPanel specialist in struts 2 + dojo
I'm using tabbedPanel feature of dojo plugin in struts2.. I have a value set in request say test as hello.. I have tabbedPanel tag in which selectedTab=hello. I want to pass this value by reading from the request attribute instead of hard coding it as hello. Thanks Again, Bachchu... -- View this message in context: http://struts.1045723.n5.nabble.com/Any-TabbedPanel-specialist-in-struts-2-dojo-tp4290083p4298449.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
Select collection not found only when validation xml file is used
Struts 2.2.1 I have a page with a list: s:select name=user.gender headerKey= headerValue=Select Gender listKey=code listValue=description list=genderList / and I populate genderList when I display the page. If I add a validation file, validating anything, not even specifically the list, the page fails telling me that the list could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} The failure occurs before the action is even reached. If I extend ActionSupport and override validate() and populate the list, then the page works again. This seems like a bug. For example, if I populate the list, display the page, and then the user submits the page with changes, the collection should not be required during the submit - only the values I'm validating (which does not include a drop-down list of values). This is just extra DB noise that is not necessary. Are there other solutions?
Re: Select collection not found only when validation xml file is used
My suggestion would be to make your action implement Preparable and initialize the list in the prepare() method. (*Chris*) On Tue, Apr 12, 2011 at 10:16 AM, Eric Lentz eric.le...@sherwin.com wrote: Struts 2.2.1 I have a page with a list: s:select name=user.gender headerKey= headerValue=Select Gender listKey=code listValue=description list=genderList / and I populate genderList when I display the page. If I add a validation file, validating anything, not even specifically the list, the page fails telling me that the list could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} The failure occurs before the action is even reached. If I extend ActionSupport and override validate() and populate the list, then the page works again. This seems like a bug. For example, if I populate the list, display the page, and then the user submits the page with changes, the collection should not be required during the submit - only the values I'm validating (which does not include a drop-down list of values). This is just extra DB noise that is not necessary. Are there other solutions?
Re: Select collection not found only when validation xml file is used
On Tue, Apr 12, 2011 at 1:16 PM, Eric Lentz wrote: s:select name=user.gender ... list=genderList / If I add a validation file, validating anything, not even specifically the list, the page fails telling me that the [gender list could not be found]. This seems like a bug. I second Chris's suggestion to initialize the list when you need it. It's a new request, so there's no reason the list would still be there, unless you've put it in session. Any time you do a round trip to the server, the request attributes go away--that's just the nature of request attributes. If your concern is extra DB comms then I'd recommend implementing any of several caching solutions to avoid an actual DB round-trip each time. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Select collection not found only when validation xml file is used
I second Chris's suggestion to initialize the list when you need it. Cool getting feedback from you guys. I'm not sure if you meant it this way, but my point is that I don't *need* the list - or at least I shouldn't need it IMO. As a user, I hit the submit button on a form that has a select list. The select list was populated during the display. During the submit, I only require the selected value in the select list which comes down in the POST. The framework is insisting though that the list be current, but only when I have a validation file. Again, the page works great until I put the validation file in place and then the framework starts wanting to have the list be populated - whether I do that populating in validate() or prepare() - which is my current work-around, but I stress work-around. - Eric
Struts2 + spring3.05 + Quartz = IncompatibleClassChangeError
Hello, Struts2 + spring3.05 + Quartz. Tomcat6 cannot be started showing the following exception message: == org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] for bean with name 'schedulerJob' defined in ServletContext resource [/WEB-INF/applicationContext-ibatis.xml]: problem with class file or dependent class; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class = Does someone know what may cause this exception? Thanks a lot! Emi - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Select collection not found only when validation xml file is used
It's most likely trying to validate that the value supplied is one of the values from the list. But that's just conjecture, since I don't use that XML Validation stuff. (*Chris*) On Tue, Apr 12, 2011 at 12:12 PM, Eric Lentz eric.le...@sherwin.com wrote: I second Chris's suggestion to initialize the list when you need it. Cool getting feedback from you guys. I'm not sure if you meant it this way, but my point is that I don't *need* the list - or at least I shouldn't need it IMO. As a user, I hit the submit button on a form that has a select list. The select list was populated during the display. During the submit, I only require the selected value in the select list which comes down in the POST. The framework is insisting though that the list be current, but only when I have a validation file. Again, the page works great until I put the validation file in place and then the framework starts wanting to have the list be populated - whether I do that populating in validate() or prepare() - which is my current work-around, but I stress work-around. - Eric
Re: Select collection not found only when validation xml file is used
since I don't use that XML Validation stuff. What do you use?
Re: Struts2 + spring3.05 + Quartz = IncompatibleClassChangeError
I'd look for class loading issues. Maybe you have a couple jars with quartz? Maybe an incompatible version combination? org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class
Re: Select collection not found only when validation xml file is used
I prefer to implement the validate() method and perform my own validations. It gives me a lot more control over the tests. There's just so many useful validations that can't be specified through XML, and I prefer the ability to see all of my tests in one place. (*Chris*) On Apr 12, 2011 12:27 PM, Eric Lentz eric.le...@sherwin.com wrote: since I don't use that XML Validation stuff. What do you use?
Re: Select collection not found only when validation xml file is used
Do you by chance need a @SkipValidation on a method(s) in your action? How have you named your validation file? On Apr 12, 2011 2:27 PM, Eric Lentz eric.le...@sherwin.com wrote: since I don't use that XML Validation stuff. What do you use?
Re: Struts2 + spring3.05 + Quartz = IncompatibleClassChangeError
I'd look for class loading issues. Maybe you have a couple jars with quartz? Maybe an incompatible version combination? Two jars: === . quartz-2.0.0.jar . org.springframework.context.support-3.0.5.RELEASE.jar But I cannot find other places contains the class. Still got the error :-( Emi org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Select collection not found only when validation xml file is used
On Tue, Apr 12, 2011 at 3:12 PM, Eric Lentz wrote: I'm not sure if you meant it this way, but my point is that I don't *need* the list - or at least I shouldn't need it IMO. The page displays the list--how could you not need it? d. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 + spring3.05 + Quartz = IncompatibleClassChangeError
Perhaps asking on a Spring list since so far it doesn't seem to be related to Struts at all. Dave On Tue, Apr 12, 2011 at 5:01 PM, Emi Lu em...@encs.concordia.ca wrote: I'd look for class loading issues. Maybe you have a couple jars with quartz? Maybe an incompatible version combination? Two jars: === . quartz-2.0.0.jar . org.springframework.context.support-3.0.5.RELEASE.jar But I cannot find other places contains the class. Still got the error :-( Emi org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class - 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: Struts2 + spring3.05 + Quartz = IncompatibleClassChangeError
Disclaimer, I didn't read the whole thread, just saw your last email. As Dave said, this is unrelated to Struts2. Its a Spring issue. AFAIK, quartz 2 is not supported by spring 3 (or spring 2.5) yet. Is it an option for you to downgrade to quartz 1.8.4? Hope that helps, otherwise sorry for wasting bandwidth. Cheers, -- Haroon Rafique haroon.rafi...@utoronto.ca \Enterprise Apps Solutions Integration, University of Toronto On 2011-04-12, at 5:01 PM, Emi Lu wrote: I'd look for class loading issues. Maybe you have a couple jars with quartz? Maybe an incompatible version combination? Two jars: === . quartz-2.0.0.jar . org.springframework.context.support-3.0.5.RELEASE.jar But I cannot find other places contains the class. Still got the error :-( Emi org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class - 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