Re: validation in struts2
Also, the file should be LoginAction-validation.xml . Use the config-browser to see that you have the validators in place. Chris -Original Message- From: Gabriel Belingueres To: Struts Users Mailing List Sent: Wed, Jan 20, 2010 10:12 am Subject: Re: validation in struts2 the form tag is wrong? try: 2010/1/19 Shasha : > > Hi All, > > I am not able to get the validation errors from Login-validation.xml when i > am using Modeldriven . > > Login-validation.xml > 1.2. "-//OpenSymphony Group//XWork Validator 1.0.2//EN" > 3. "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > 13. > 14. > 15. > 16. > > LoginAction.java > > 1. public class LoginAction extends ActionSupport implements > ModelDriven,SessionAware{ > 2. > 3. private User user = new User(); > 4. private Map session; > 5. private UserDAO userDAO = new UserDAOImpl(); > 6. > 7. public String execute() throws Exception { > 8. > 9. boolean success=userDAO.verifyUser(user); > 10. if (success) > 11. return SUCCESS; > 12. else > 13. return ERROR; > 14. } > 15. > 16. public Object getModel() { > 17. return user; > 18. } > 19. > 20. public void setSession(Map session) { > 21. this.session=session; > 22. } > 23. > 24. public Map getSession() { > 25. return session; > 26. } > 27. > 28. } > > login.jsp > > 1. <%@ taglib prefix="s" uri="/struts-tags" %> > 2. > 3. > 4. Struts 2 Login Application! > 5. > 6. " rel="stylesheet" > type="text/css"/> > 7. > 8. > 9. > 10. > 11. > 12. Login > 13. > 14. > 15. > 16. > 17. > 18. > 19. > 20. > 21. > 22. > 23. > 24. > 25. > 26. > 27. > 28. > 29. > > http://old.nabble.com/file/p27236040/error.jpg > > > -- > View this message in context: > http://old.nabble.com/validation-in-struts2-tp27236040p27236040.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
Re: Forwarding to a Java Application
The tag previously referred to is where you can launch a java app from a jsp (or even an ordinary html page). Check out Java Web Start. Your java app can be an ordinary swing app and the server sends a .jnlp file with instructions to the browser to download the necessary classes. Your client needs to either have a full JDK installed (not just a JRE) or have Java Web Start installed. Chris -Original Message- From: Rafael Muneton To: Struts Mailing list Sent: Mon, Dec 28, 2009 12:39 pm Subject: RE: Forwarding to a Java Application i Wes: Thanks for your answer. I am a little bit confused now. What I am trying to do is uncommon? The fact that I want to launch a Java class(Nor a Servlet) from a Java Server age is something odd??? Or is it against the rules of Struts The question is now ===> How would you do something like that Thanks again. Rafael. Date: Thu, 24 Dec 2009 13:48:49 -0500 Subject: Re: Forwarding to a Java Application From: w...@wantii.com To: user@struts.apache.org On Thu, Dec 24, 2009 at 12:52 PM, Rafael Muneton wrote: > > Hi Vitor: > > What I am trying to achieve is that , after a user can log in to the Web pplication, this user receives the MainMenu screen of the Application, where here are several options, that he/she can choose from.This MainMenu is a Java pplication not a Servlet. > > And after reading your answer, I think that maybe I need to upgrade to truts 2. > > I am using Struts 1.1 > I don't think an upgrade is necessary. I think you just need to understand a little better how things work in a JSP/Servlet environment... The page that launches the MainMenu application is bound to have either an
Re: SQL ExcuteQuery
Your trouble is here: pstmtname = conn.prepareStatement(sql); sql = "UPDATE tbl_content_admin_accounts SET CA_PASSWORD = ? WHERE ROW_ID = " + UserID; When you call prepareStatement(sql) the sql string is sent to the database which "prepares" it (essentially does all the steps neccessary before execution). You then change the sql string and the database knows nothing about it. Change it so that the sql = line comes before the conn.prepareStatement line. Chris -Original Message- From: Nguyen Xuan Son To: Struts Users Mailing List Sent: Tue, Dec 8, 2009 12:59 am Subject: SQL ExcuteQuery dear all I've written Connection conn = null; PreparedStatement pstmtname = null; pstmtname = conn.prepareStatement(sql); sql = "UPDATE tbl_content_admin_accounts SET CA_PASSWORD = ? WHERE ROW_ID = " + UserID; pstmtname.setString(1, "123456"); pstmtname.executeQuery(); there is no error appear but nothing is changed in the database do you have any suggestion? thank you very much -- === Ritsumeikan University, Asia JinZai Project Master of Information Science Nguyen Xuan Son Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu Rien, Room 103 Tel/Fax : 81-(0)90-3976 2246 Email: nr000...@ed.ritsumei.ac.jp Mobile : 81-(0)90-3976 2246 URL : http://www.ritsumei.jp ===
Re: (clearly O/T) use of ThreadLocal vs Synchronized
They are quite distinct -- ThreadLocal variables are not shared at all while synchronized permits sharing (but not concurrently). Suppose you have a background thread that does some calculation that you might need [in my case you have an abstract graph and a background thread is checking if the graph has intersecting edges so that algorithms that need to know can use a cached answer rather than calculate it at the time they need it]. You can't use a thread local because you want the background thread to play with the very same variable but still not get in the way of the main thread of the algorithm. Chris -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Sat, Nov 21, 2009 8:38 am Subject: (clearly O/T) use of ThreadLocal vs Synchronized Good Morning All- are there any instances where a factory use of synchronized keyword is preferred or considered more efficient implementation over creating a ThreadLocal object? http://www.javamex.com/tutorials/synchronization_concurrency_thread_local2.shtml any answers are appreciated! Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. _ Bing brings you maps, menus, and reviews organized in one place. http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1=
Re: s2: Validation xml file not being used when validating a method
I think the @OP's difficulty is with the name vs method attributes of the action element so (if I may be excused for borrow Musachy's example) if you have /survey/survey-results.jsp /survey/survey.jsp then the action alias is save (and not persist) Chris -Original Message- From: Musachy Barroso To: Struts Users Mailing List Sent: Tue, Nov 17, 2009 6:17 pm Subject: Re: s2: Validation xml file not being used when validating a method It can be done like that as well, but, your first attempt should be better. The "alias" part is the action name, lets say you have an action like this: /survey/survey-results.jsp /survey/survey.jsp you would need to name the validation file "SurveyAction-save-validation.xml", and this file *has* to be in the classpath of the application under "survey". Make sure that the validation file is landing next to the action that it is supposed to validate, in the web app classes dir. musachy On Tue, Nov 17, 2009 at 3:10 PM, ben_979 wrote: > > So it's done strictly by exclusion? I *thought* I had read that the > validation could be focused on a specific method through the naming > convention of the validation file(s). Is that idea totally wrong? > > -- > View this message in context: > http://old.nabble.com/s2%3A-Validation-xml-file-not-being-used-when-validating-a-method-tp26399337p26399526.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
Re: Performance issue using tag
Since it is not happening consistently and seems to happen more under load it could well be that the instantiation of an object is triggering a garbage collection so it might be unrelated to the itself and more to hanging onto some other objects for too long. Chris -Original Message- From: Musachy Barroso To: Struts Users Mailing List Sent: Tue, Nov 3, 2009 8:04 am Subject: Re: Performance issue using tag I would suggest you to use a profiler to find out for sure what is aking the time. You can use VisualVM which comes with java 6 or the xcellent jrockit mission control(free as well). musachy On Mon, Nov 2, 2009 at 2:50 PM, CS Wong wrote: Hi, thanks for answering, I noticed that the quoted text in your reply seemed to be garbled so I guess something screwed up when I sent in my question. I've pasted my original question in a pastebin here ( http://paste2.org/p/495951) so that you can read it better. Sorry for any inconvenience caused. Well, I don't want to be an ass, Musachy, but I think I can prove that the EJB is not the problem. I've timed the logs precisely and the delay happens before the EJB invocation. Here's an example: 1. At the end of the action class, just before returning SUCCESS, I made a log statement. This occurs at 10:03:07. 2. After the log statement, I immediately return SUCCESS. 3. The next logged line would be from PayerAccountsWithBalance bean itself. 4. setTransType() is just a normal setter method that assigns the input to a private attribute (differs from what I said below, sorry my mistake) 5. setInitClass() has the lines that I pasted in a pastebin here: http://paste2.org/p/495948 6. Line 9 of the code pasted is where I make my call to the EJB, yet, the time recorded for line 4, which is a log statement, is at 10:05:23! 7. This means that, over 2 minutes has passed between when the action class completed its execution and when the bean was instantiated and reach the log statement. And this is definitely before the EJB call. 8. So this would exclude the possibility that the delay was caused by the EJB lookup / execution I hope my analysis above is correct. Hope someone with more experience can provide their input here as I'm really getting pasted about the performance issue on a daily basis. Thanks! Wong On Tue, Nov 3, 2009 at 6:27 AM, Musachy Barroso wrote: > It is the same struts code running all the time, so it should as > fast(or slow) every time. The only thing that changes is the call to > the EJB, so I would bet that the problem is there. > > musachy > > On Mon, Nov 2, 2009 at 9:57 AM, CS Wong wrote: > > Hi, > > > > I seem to be having a performance issue in some of my Struts 2 actions. > On > > several of my pages, I render a couple of drop down tags in my output > page. > > I populate the drop down tags by instantiating an tag and > invoking > > the methods in the bean to call an EJB service and populating a > collection > > property from the results. The collection is then passed to a > > tag for rendering. The JSP looks something like this: > name="com.valueObject.PayerAccountsWithBalance" id="payerAccount"> > > name="transType">9 > > > > ="selectedFromAccount" value ="selectedFromAccount" required ="true" list > = > > "#payerAccount.accountsList" listKey = "key" listValue= "value" headerKey > > ="-1" headerValue="Please Select" cssClass ="clsSelectedOpt accountType" > id > > ="selectedFromAccount" /> com.valueObject.PayerAccountsWithBalance is > just a > > normal Java bean with methods "setTransType()", "setInitClass()" and > > "getAccountsList()" exposed. I populate the accounts list by calling an > EJB > > service. I chose to do it this way instead of populating the collection > in > > the action class itself because I felt that the populating of the > collection > > was not really related to the core business logic of the action itself. > > Functionally, this works great and up till recently, it was working fine > in > > production as well. But people started complaining about load times of > the > > action. Upon investigating, I found that under peak loads, my action was > > taking up to 200 seconds to complete loading. The pattern is > inconsistent. I > > could be getting a 3-8 second response on the action for 5 consecutive > users > > and then it jumps to over 100 seconds for a couple of users before > dropping > > back down again. I had initially thought that my EJBs were the bottleneck > > but after I played around with the logs, I don't think so. I placed a log > > statement at the last line of the action class and the first line of the > > setTransType() method in PayerAccountsWithBalance and found that when a > > significant delay happens, there was a very big delay gap between the > action > > and the bean. The context look up for the EJB only happens in > setInitClass() > > so it looks more like the container was waiting for a new instance of > > PayerAccou
Re: Please Help with struts2
Do you also have an exception for the decorator tag library? The one you have in your post is for the page tag library. Check that you have the struts2-sitemesh-plugin jar in WEB-INF/lib because that is where those tag libraries are. Also check that your web.xml has the appropriate elements for Sitemesh Chris -Original Message- From: Konstantyn Harasevich To: Struts Users Mailing List Sent: Sat, Sep 26, 2009 2:04 pm Subject: Please Help with struts2 Hello When running samples struts 2 Here is exception relative to this taglib in NetBeans7.1: <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator"; prefix="decorator" %> org.apache.jasper.JasperException: /WEB-INF/decorators/main.jsp(26,72) PWC6188: The absolute uri: http://www.opensymphony.com/sitemesh/page cannot be resolved in either web.xml or the jar files deployed with this application Do not now reason why this error appear because this is valid url ? Thanks.
Re: Switching Action between different modules...
The name of the xml file is immaterial -- what is the namespace attribute on the package you defined inside of home.xml? I would use the config-browser to check that the configuration is what you intended. Chris -Original Message- From: Muthu Velappan To: user@struts.apache.org Sent: Wed, Sep 23, 2009 3:10 am Subject: Switching Action between different modules... Hi, I have 3 different modules in my project and added that into struts.xml like this I got a feedback.jsp page in admin module. When user hit the cancel button from this form, I want that to submit to home.action available in home module. Since I don't have the namespace option in submit button tag, this is how I added this it in my submit button but it is not working. It throws the following exception. Can anyone please let me know where I'm going wrong. Struts Problem Report Struts has detected an unhandled exception: Messages: * There is no Action mapped for namespace /admin and action name /home/Home. _ Stacktraces There is no Action mapped for namespace /admin and action name /home/Home. - [unknown location] com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:1 78) Thanks, Muthu
Re: Struts2 - OGNL - access bean property in model object
JSP page: The c in CBookingFactorsBean should be lower case , I think. Chris -Original Message- From: Raghuveer.V To: user@struts.apache.org Sent: Mon, Sep 21, 2009 7:48 am Subject: RE: Struts2 - OGNL - access bean property in model object Hi Rouxel, I am using ScopedModelDriven. I am not using prepare,since ModelDSriven interceptor takes care of initializing model object. I have following implemented methods of ScopedModelDriven and other servlet config related methods in my Action class. public Object getModel(){ System.out.println("getting model."); return cBookingFactorsModel; } public String getScopeKey() { System.out.println("getting key."); return key; } public void setModel(Object obj) { System.out.println("setting model: "+obj.toString()); this.cBookingFactorsModel=(CBookingFactorsModel)obj; } public void setScopeKey(String key) { System.out.println("setting key: "+key); this.key=key; } public void setServletRequest(HttpServletRequest request) { this.request=request; } public void setSession(Map map) { this.session_map=map; } public CBookingFactorsModel getCBookingFactorsModel() { return cBookingFactorsModel; } public void setCBookingFactorsModel(CBookingFactorsModel bookingFactorsModel) { cBookingFactorsModel = bookingFactorsModel; } _ From: Raghuveer.V [mailto:raghuve...@infotechsw.com] Sent: Monday, September 21, 2009 4:32 PM To: 'user@struts.apache.org' Subject: Struts2 - OGNL - access bean property in model object I have following property in model object(ScopedModelDriven). CBookingFactorsBean cBookingFactorsBean=null; In JSP page i get error when accessing [b]'salesAfterDiscount'[/b] property of custom object(CBookingFactors[b]Bean[/b]) in model(CBookingFactors[b]Model[/b]). -- JSP page: WARNING: Error setting value ognl.OgnlException: target is null for setProperty(null, "SalesAfterDiscount", [Ljava.lang.String;@110d68a) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651) at ognl.ASTProperty.setValueBody(ASTProperty.java:101) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.ASTChain.setValueBody(ASTChain.java:172) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.Ognl.setValue(Ognl.java:476) at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155 ) at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143 ) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(Para metersInterceptor.java:273) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame tersInterceptor.java:187) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method FilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati on.java:236) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(S copedModelDrivenInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati on.java:236) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(Debu ggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati on.java:236) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareIn terceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method FilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati on.java:236) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletCon figInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati on.java:236) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
Re: Hello Help please with Struts2
When you say "on the classpath" do you mean the compile classpath of the project or is the jar physically in WEB-INF/lib? Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Sat, Sep 19, 2009 6:55 pm Subject: Re: Hello Help please with Struts2 Which app server do you have set up in netbeans? On 9/19/09, Konstantyn Harasevich wrote: > Hello > > When running samples struts 2 > > Here is exception relative to this taglib in NetBeans7.1: > <%@ taglib uri="/struts-tags" prefix="s" %> > > > > org.apache.jasper.JasperException: /example/HelloWorld.jsp(2,41) PWC6117: > File "/struts-tags" not found > at > org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:73) > at > org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:359) > at > org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:153) > > > Do not now reason why this error appear , beacause struts2-core-2.0.11.jar > is on classpath ? > > Thanks. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Formatting in extended theme using Freemarker
Try the pattern "#.00". Chris -Original Message- From: ashwin ala To: user@struts.apache.org Sent: Sat, Sep 12, 2009 2:30 pm Subject: RE: Formatting in extended theme using Freemarker Thank you for the prompt replies. The BigDecimal rounding somehow always renders the value with extra zeroes appended. I had some success with the freemarker number formatting as suggested by Martin and am getting close to solving this. I changed text.ftl to now use this line: <#if parameters.nameValue??><#setting number_format="#.00"> value="<@s.property value="${parameters.nameValue?number}"/>"<#rt/> However it still doesnt render the final 0. For example value "5" should render as "5.00" but renders as "5.0" Ive tried number_format="#.##" as well as other combinations with no success. I'll keep trying different approaches. Please let me know if you can suggest a solution. thanks ash.
Re: Struts jsp access java class
Check out http://struts.apache.org/2.1.6/docs/bean.html Chris -Original Message- From: deepannair To: user@struts.apache.org Sent: Fri, Sep 11, 2009 9:51 am Subject: Struts jsp access java class I have a properties class which has soem properties being loaded from a remote system. In my jsp I need to access the java class. In traditional jsp I have [code] <% /* CAPTCHA */ boolean captchaEnabledFlag=PropertiesConfig.getCaptchaEnabled(); %> <%if (captchaEnabledFlag) {%> <%} %> [code] I want to change the if statement to struts if . How do I access the PropertiesConfig class directly from struts tag? -- View this message in context: http://www.nabble.com/Struts-jsp-access-java-class-tp25401337p25401337.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: Interceptor question
By the way, Pawel, at that link some software seems to have severely butchered your xml in the struts.xml part. Chris -Original Message- From: Dale Newfield To: Struts Users Mailing List Sent: Wed, Sep 9, 2009 12:41 pm Subject: Re: Interceptor question Paweł Wielgus wrote: > Mike You can take a look at my post about this problem [1] > and read more about Spring Security (ACEGI). > > [1] - > http://poulwiel.blogspot.com/2009/01/intercepting-all-actions-inside-my-app.html I don't understand what your problem is. As you state, you can set the interceptor stack for each package, and you have two separate packages that you want to have two separate interceptor stacks. You also illustrate how the interceptor can make decisions based on the mapping. What's the problem? -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Action Tag java.lang.StackOverflowError
Different tags do different things so I'm afraid you have to look at the documentation for a tag to see just what it does. This one was written for the purpose of allowing you to use the result of an action in the page you are currently rendering. Chris -Original Message- From: briannic...@aspca.org To: Struts Users Mailing List Sent: Wed, Sep 2, 2009 3:36 pm Subject: Re: Action Tag java.lang.StackOverflowError Of course if you couldn't tell, I'm very new to Struts. Can you explain why that all shows up on one page and doesn't take me to a different page? My best assumption on how Struts works is that when I'm at index.jsp I call the action ActionTag which on a success displays the snippet.jsp page on the index.jsp page. Brian E. Nicely Programmer / Analyst Knowledge Management ASPCA® 1717 South Philo Road, Suite 36 Urbana, IL 61802 briannic...@aspca.org P: 217-337-9700, 9799 F: 217-337-0599 www.aspca.org The information contained in this e-mail, and any attachments hereto, is from The American Society for the Prevention of Cruelty to Animals® (ASPCA ®) and is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying or use of the contents of this e-mail, and any attachments hereto, i s strictly prohibited. If you have received this e-mail in error, please immediately notify me by reply email and permanently delete the original and any copy of this e-mail and any printout thereof.
Re: Action Tag java.lang.StackOverflowError
Great. The trick is not to have an action's result contain a call to the action -- you set up an infinite recursion that way. Chris -Original Message- From: briannic...@aspca.org To: Struts Users Mailing List Sent: Wed, Sep 2, 2009 3:21 pm Subject: Re: Action Tag java.lang.StackOverflowError Chris, Thanks, that works exactly the way I wanted. Brian E. Nicely Programmer / Analyst Knowledge Management ASPCA® 1717 South Philo Road, Suite 36 Urbana, IL 61802 briannic...@aspca.org P: 217-337-9700, 9799 F: 217-337-0599 www.aspca.org The information contained in this e-mail, and any attachments hereto, is from The American Society for the Prevention of Cruelty to Animals® (ASPCA ®) and is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying or use of the contents of this e-mail, and any attachments hereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me by reply email and permanently delete the original and any copy of this e-mail and any printout thereof.
Re: Action Tag java.lang.StackOverflowError
1) Create a file called snippet.jsp with just: And this line is from the target action. - 2) Change result in your struts.xml to read /snippet.jsp --- 3) Just a comment: you are overriding the execute() method with the same functionality you are inheriting from ActionSupport so your TargetAction can be abbreviated to: package manning.chapterSix; import com.opensymphony.xwork2.ActionSupport; public class TargetAction extends ActionSupport {} -- 4) index.jsp stays the same: Action Tag Action Tag This line is before the ActionTag invokes the secondary action. Chris -Original Message- From: briannic...@aspca.org To: Struts Users Mailing List Sent: Wed, Sep 2, 2009 2:14 pm Subject: Re: Action Tag java.lang.StackOverflowError Is there an example you could point me to (that actually works) or help me get my example working? Brian E. Nicely Programmer / Analyst Knowledge Management ASPCA® 1717 South Philo Road, Suite 36 Urbana, IL 61802 briannic...@aspca.org P: 217-337-9700, 9799 F: 217-337-0599 www.aspca.org The information contained in this e-mail, and any attachments hereto, is from The American Society for the Prevention of Cruelty to Animals® (ASPCA ®) and is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying or use of the contents of this e-mail, and any attachments hereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me by reply email and permanently delete the original and any copy of this e-mail and any printout thereof.
Re: Need to disable session interceptor
JSP create sessions by default. It is servlets that don't create a session unless you call getSession(). Do you have something like <%@ page session="false"> at the top of your JSPs? Chris -Original Message- From: Rajeev Sharma To: Struts Users Mailing List Sent: Tue, Sep 1, 2009 9:49 am Subject: RE: Need to disable session interceptor I googled this and the struts2 performance tuning page says this "Struts 2 does not create sessions unless asked to (for example, by having the createSession interceptor in your interceptor stack). Note that when you use SiteMesh however, a session will always be created" I am never creating the session in my code directly and AFAIK I am not using SiteMesh (I don't even know what exactly is this). I have written code using JSP/Servlet and my knowledge says that unless the session is created explicitly it wont be created. Is there any interceptor in the defaultStack which creates it? (is the createSession part or defaultStack?) or I am doing something wrong. I opened some pages on my application and found there was one session created for my browser and others for other clients, So I guess this has nothing to do with JMeter. Sessions are being created for every client. I am trying to find out why is the session created when I did not create the session in my code. -- Rajeev -Original Message- From: Martin Gainty Reply-to: " Struts Users Mailing List" To: Struts Users Mailing List Subject: RE: Need to disable session interceptor Date: Tue, 1 Sep 2009 09:23:58 -0400 Nils- doc suggests implementing a HttpCookieManager to handle the session any suggestions on which HttpCookieManager to implement and possible configurations? (i think JMeter is O/T so please ping offline) thanks Martin Gainty __ Note de déni et de confidentialité Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Tue, 1 Sep 2009 13:19:22 +0200 > Subject: Re: Need to disable session interceptor > From: nil...@gmail.com > To: user@struts.apache.org > > From the JMeter FAQ: "How do I ensure each http request for jsp is > within one jsessionid ?" > > http://wiki.apache.org/jakarta-jmeter/JMeterFAQ#head-114aca8407cf0eaff55b7ae5955eda46b1e2cecb > > Nils-H > > On Tue, Sep 1, 2009 at 1:15 PM, Dave Newton wrote: > > Rajeev Sharma wrote: > >> > >> I am new to struts 2 (I mean struts). I am developing an application which > >> does not need to use sessions at all. When I tested my application with > >> jmeter, I got 18000 sessions created (tomcat showed me this). Looks like for > >> every individual request there is one session created. How can I remove the > >> session interceptor at all (and other components related to sessions), so > >> that there are no sessions created in my application. > > > > There isn't a session created for each request, there's a session per client > > conversation. Also, AFAIK, Struts 2 doesn't do anything in particular > > regarding session creation--that is handled by the container. > > > > Dave > > > > > > - > > 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 > _ Get back to school stuff for them and cashback for you. http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2
Wasn't being picky -- the single versus double quote rules in OGNL for single character Strings versus chars often trip people up at places like Chris -Original Message- From: Luca To: Struts Users Mailing List Sent: Fri, Aug 28, 2009 1:07 pm Subject: Re: Struts 2 His status is a char.? >? >? > >? >? > Chris? >? > >? >? > >? > -Original Message-? > From: Luca ? > To: Struts Users Mailing List ? > Sent: Fri, Aug 28, 2009 11:58 am? > Subject: Re: Struts 2 ? >? >? >? >? >? >? >? >? > Hi, do you try to check that the methods in the Action class match the > beans name conventions??? > ?? >? > For example, in your case I'm thinking this situation:?? > ?? >? > private String status;?? > ?? >? > public void *setStatus*(String status){?? >? > ? this.status = status;?? >? > }?? > ?? >? > public String *getStatus*(){?? >? > ? return this.status;?? >? > }?? > ?? >? > I use the same convention as you, and it works fine for me :-)?? > ?? >? > bye, Luca?? > ?? >? > Sonu S ha scritto:?? >? > >> Hi,?? >> >? > >> ?? >> >? > >> i am using struts 2. i want to check some condition in my jsp and based on?? >> >? > >> result i want to perform some task.?? >> >? > >> ?? >> >? > >> i have written?? >> >? > >> ?? >> >? > >> ?? >> >? > >> //DO something?? >> >? > >> ?? >> >? > >> ?? >> >? > >> // Do Something else?? >> >? > >> ?? >> >? > >> ?? >> >? > >> for this i have created one hidden field also in JSP named status and have?? >> >? > >> getter and setter method in Action class.?? >> >? > >> ?? >> >? > >> but things are not working as expected. Even if status is Y it always?? >> >? > >> execute ELSE part. please let me what i am doing wrong.?? >> >? > >> ?? >> >? > >> thanks?? >> >? > >> ?? >> >? > >> >> ?? >> >? > >> ?? >> >? > >> ?? >> >? > >> Nessun virus nel messaggio in arrivo.?? >> >? > >> Controllato da AVG - www.avg.com >> Versione: 8.5.409 / Database dei virus: 270.13.71/2330 - Data di rilascio: >> 08/27/09 18:02:00?? >> >? > >> ?? >> >? > >> >> >? >? > >? >? > > ? >? >? > Nessun virus nel messaggio in arrivo.? > Controllato da AVG - www.avg.com > Versione: 8.5.409 / Database dei virus: 270.13.71/2331 - Data di rilascio: > 08/28/09 06:26:00? >? > ? -? To unsubscribe, e-mail: user-unsubscr...@struts.apache.org? For additional commands, e-mail: user-h...@struts.apache.org? ?
Re: Struts 2
His status is a char. Chris -Original Message- From: Luca To: Struts Users Mailing List Sent: Fri, Aug 28, 2009 11:58 am Subject: Re: Struts 2 Hi,? >? > i am using struts 2. i want to check some condition in my jsp and based on? > result i want to perform some task.? >? > i have written? >? > ? > //DO something? > ? > ? > // Do Something else? > ? >? > for this i have created one hidden field also in JSP named status and have? > getter and setter method in Action class.? >? > but things are not working as expected. Even if status is Y it always? > execute ELSE part. please let me what i am doing wrong.? >? > thanks? >? > > ? >? >? > Nessun virus nel messaggio in arrivo.? > Controllato da AVG - www.avg.com > Versione: 8.5.409 / Database dei virus: 270.13.71/2330 - Data di rilascio: > 08/27/09 18:02:00? >? >
Re: ActionForm is been called once only
In the time between the first time you go to the page and the second time where in your application is the data supposed to be? Chris -Original Message- From: Paweł Wielgus To: Struts Users Mailing List Sent: Fri, Aug 28, 2009 5:34 am Subject: Re: ActionForm is been called once only Hi, what do You mean by saying: "if i try to open the page again" what does that mean for real? hitting F5 or refresh button in browser? or a real brand new request. Best greetings, Paweł Wielgus. 2009/8/28 sharadsingh : > > i have an action form which i use to collect form data and also to set them > back by populating the variables in the reset method. But the problem is > that the reset method is been called only the first time i am opening the > page which contains that form, if i try to open the page again the reset > method wont be called at all. Please suggest me on this.., > -- > View this message in context: > http://www.nabble.com/ActionForm-is-been-called-once-only-tp25186640p25186640.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-help @struts.apache.org
Re: Convention Plugin problem
The OP is mapping the result by XML so the behavior (as someone pointed out) is what you would expect. Chris -Original Message- From: Paweł Wielgus To: Struts Users Mailing List Sent: Fri, Aug 28, 2009 2:58 am Subject: Re: Convention Plugin problem Hi all, my thinking is same as Dave's, add config browser plugin to see what things are after app has started. Also You can try http://myserver/myapp/catchall to see if it is mapped by a convention plugin. http://cwiki.apache.org/S2PLUGINS/config-browser-plugin.html Best greetings, Paweł Wielgus. 2009/8/28 Dave Newton : > Rusty Wright wrote: >> >> I can't get struts.convention.result.path to work. >> >> >> >> /catchall.jsp >> >> > >> ... >> >> > value="/WEB-INF/views/jsp/" /> >> >> But it's always looking for the catchall.jsp file in the top level >> directory of my web app, ~tomcat/webapps/sample002. > > My impression was that the convention result path was for *conventionally* > defined results--you're defining that one manually. > > I'd expect the behavior you're seeing, but I could be wrong. > > Dave > > > - > 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: Intermittent Session Problems in Strut2.
Where is the information that is being shared? Your problem might have nothing to do with authentication. Chris -Original Message- From: pankaj semwal To: Struts Users Mailing List Sent: Mon, Aug 24, 2009 10:15 am Subject: Re: Intermittent Session Problems in Strut2. In my LoginAction i am setting the session as private boolean isUserExist() { Connection con = null; boolean result = false; // MD5Util MD5=new MD5Util(); try { con = ConnectionFactory.getConnection(); String sqlQ = "SELECT * FROM USER_MASTER WHERE LOGIN_ID=?" + "AND PASSWORD=? AND ROLE=? AND STATUS='Y'"; PreparedStatement pstmt = con.prepareStatement(sqlQ); pstmt.setString(1, getUserId().trim()); pstmt.setString(2, getPassword().trim()); pstmt.setString(3, getRole().trim()); ResultSet rst = pstmt.executeQuery(); if (rst.next()) { user = new User(); user.setUserId(rst.getInt("USER_ID") == 0 ? 0 : rst .getInt("USER_ID")); user.setUserName(rst.getString("USER_NAME") == null ? "" : rst .getString("USER_NAME")); user.setRole(rst.getString("ROLE") == null ? "" : rst .getString("ROLE")); user.setAddress(rst.getString("LOGIN_ID") == null ? "" : rst .getString("LOGIN_ID")); user.setCandidateId(rst.getString("CANDIDATE_ID") == null ? "" : rst.getString("CANDIDATE_ID")); if (getCustType1() == null) { user.setCustType(""); } else { user.setCustType(getCustType1()); } result = true; * getSession().put("loginDetails",user);* } And in other Actions i am getting the session as : User user = (User) getSession().get("loginDetails"); if (user == null) { addActionMessage("Not Authorize to view this page."); return ERROR; } AppointmentDocDBdao appointmentdocdob = new AppointmentDocDBdao(); custType = appointmentdocdob.getCustType(Integer.parseInt(user .getCandidateId())); Is there any problem in this code.
Re: project running on local server but got page not found error while accessing it from godaddy server
I would get a copy of the Tomcat version you are targeting from http://archive.apache.org/dist/tomcat/tomcat-5/ and see if it runs. That would answer you question much faster than us guessing. Cheers. Chris -Original Message- From: kalaimathi To: user@struts.apache.org Sent: Mon, Aug 24, 2009 5:42 am Subject: project running on local server but got page not found error while accessing it from godaddy server Hi to all, I am new to this post, I created my project in struts 1.3.8 with hibernate 3.2 ,it works fine in my local server (ie) http://localhost:8080/Testing/ But the same project when i deployed in godaddy server ,jsp page is displaying but when i click on some action it leads to page not found error .http://boomipooja.com/rekha/ But i developed the project using tomcat 6.0 ,but the godaddy server has tomcat 5.0.27 .. due to tomcat version is that i get this page not found eror ,or i should do some proxy change ..plz help me out. if any one faced such problem can please share with me. regards, T.Rekha. -- View this message in context: http://www.nabble.com/project-running-on-local-server-but-got-page-not-found-error-while-accessing-it-from-godaddy-server-tp25113215p25113215.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: Intermittent Session Problems in Strut2.
where is the information they are sharing located? Chris -Original Message- From: Struts Two To: Struts Users Mailing List Sent: Sun, Aug 23, 2009 10:05 am Subject: Re: Intermittent Session Problems in Strut2. Do you log in to the system from two different client machines or you log in to both accounts using tabs of a same browser IE or firefox ? --- On Sun, 8/23/09, pankaj semwal wrote: > From: pankaj semwal > Subject: Intermittent Session Problems in Strut2. > To: user@struts.apache.org > Received: Sunday, August 23, 2009, 6:04 AM > Hi List, > > ? ? ? ? ? ? ? ? > ? ? ? ? ? I am facing a problem > of???session intermittent in > Strut2.In Distributed environment > > when user A login and at the same time when user B? > login .The information > are sharing .I tried but did not find the solution. > > Even the session Id? are creating different for each > user. > > I am setting? the session as : > > Map session = ActionContext.getContext().getSession(); > > session.put("loginDetails", user); > > > > Please tell me where i am wrong. > > > Please help me. > __ Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to register an ActionEventListener
Yes, the interceptors can tinker with the action before the action method executes . Chris -Original Message- From: Karan Malhi To: Struts Users Mailing List Sent: Sat, Aug 22, 2009 10:35 pm Subject: Re: How to register an ActionEventListener Struts 2. If interceptors kick in immediately after creation, then that would solve my purpose. Ignore my reply to your previous message. On Sat, Aug 22, 2009 at 11:56 AM, wrote: > > Sorry -- I should have asked if you were using Struts 1 or 2! > Struts 2 interceptors kick in after action creation. > > > > > > Chris > > > > > > > -Original Message- > From: Karan Malhi > To: user@struts.apache.org > Sent: Fri, Aug 21, 2009 11:28 pm > Subject: How to register an ActionEventListener > > > > > > > > > > > I want to post process an action instance after it is created. I could > create an ActionEventListener implementation. How would I register this > class with struts so that it notifies the listener? > > -- > Karan Singh Malhi > > > > > > -- Karan Singh Malhi
Re: How to register an ActionEventListener
Sorry -- I should have asked if you were using Struts 1 or 2! Struts 2 interceptors kick in after action creation. Chris -Original Message- From: Karan Malhi To: user@struts.apache.org Sent: Fri, Aug 21, 2009 11:28 pm Subject: How to register an ActionEventListener I want to post process an action instance after it is created. I could create an ActionEventListener implementation. How would I register this class with struts so that it notifies the listener? -- Karan Singh Malhi
Re: How to register an ActionEventListener
The action is instantiated before the interceptors fire so all your interceptors are processing the request after the action is created. after it is created Chris -Original Message- From: Karan Malhi To: user@struts.apache.org Sent: Fri, Aug 21, 2009 11:28 pm Subject: How to register an ActionEventListener I want to post process an action instance after it is created. I could create an ActionEventListener implementation. How would I register this class with struts so that it notifies the listener? -- Karan Singh Malhi
Re: Problem with result returning from interceptor
Check it out with the config-browser -- you should see on the results tab if your login result is really there. Chris -Original Message- From: ManiKanta G To: Struts-User Sent: Fri, Aug 21, 2009 3:36 am Subject: Problem with result returning from interceptor Hi, In my application actions are distributed into several namespaces using Conventions plugin. When a request come for an action in a namespace (other than default one, say, myapp/admin/action-name), and when there is no user session found, I m returning 'login', which is configured as global-result in the default namespace. But I m getting exception saying 'No result found with name...'. Result config: login Intercept() of interceptor: public String intercept(ActionInvocation invocation) throws Exception { Map session = invocation.getInvocationContext().getSession(); User user = (User) session.get(Constants.USER_HANDLE); if(user == null) { return "login"; }else{ invocation.invoke(); } } Action is in other namespace (package) and so jsp. But the result is configured in default namespace, as login result should be accessible from any namespace. I m not getting what is the mistake I m doing. Is there any this kind of problem with conventions plugin? Some one please help. Regards, ManiKanta G twitter.com/manikantag
Re: Why submit didn't support param
You are kind, Wes. I saw that message and thought "I don't want anything to do with this person!" Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Thu, Aug 20, 2009 9:39 am Subject: Re: Re: Why submit didn't support param On Thu, Aug 20, 2009 at 6:23 AM, xnpeng wrote: > > how to remove my email from this fucking list? [snip] >>- >>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>For additional commands, e-mail: user-h...@struts.apache.org >> > The funny thing is that the instructions are at the bottom of every single message. Did you attempt to follow these instructions? If so, did it not work the way you expected? I think you would find that most of the people on this list are willing to help, but using vulgarities, etc. is pretty much going to get you labelled as a troll and make it harder to get the help you need. Anyhow, after following the instructions, if it did not work, let us know what error message, etc. you might have received and someone will likely be able to better help you. -W -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts 2.1.5 type conversion error
That is because you are using Struts 2.1.5. There is a bug in the type conversion for doubles in XWork which is fixed in the current version (XWork 2.1.4). When you enter a zero it claims it is not a valid value. To use XWork 2.1.4 you need Struts 2.1.7. I have just sent the zips I promised and you will find since I used 2.1.7 that negative numbers and zero work. -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Tue, Aug 18, 2009 4:43 am Subject: RE: struts 2.1.5 type conversion error Dusty, The error only shows if i enter '0' or a negative number in my double-field.. Not with positive numbers. Is this normal? Regards, Sandy -Oorspronkelijk bericht- Van: dusty [mailto:dustin_pea...@yahoo.com] Verzonden: dinsdag 18 augustus 2009 6:37 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error The error/warning you are talking about happens when the conversion fails. Essentially, after it tries the conversion and can't do it then it tries to apply the setXXX(String xxx), but that really is not what you want at all. When you are using your own converters you want to be able to return a NULL for example when you get a "" and you are expecting an id to convert to some kind of object. newton.dave wrote: > > sandy.verfai...@roularta.be wrote: >> I've changed my original setter to setStockAmountInt(int >> stockAmount), and kept setStockAmount(String stockAmount) so it could >> be used by the default ognl conversion. Now I can work without >> errors, but it seems kind of strange to me that this is the normal >> way of working, is it? > > No; you shouldn't need to do that (and you're breaking JavaBean > convention by doing so). The default type conversion should be > converting the form values to int automatically. > > If it's not, something is very wrong, because this functionality has > been working for a very long time. > > 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-2.1.5-type-conversion-error-tp24534638p2501 8347.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
Re: validation
That looks like a question -- it is meant to be an assertion but somehow question marks crept in. C. -Original Message- From: musom...@aol.com To: user@struts.apache.org Sent: Mon, Aug 17, 2009 11:12 am Subject: Re: validation For primitives and dates you don't need to do anything? -- the type conversion is automatic Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 10:43 am Subject: RE: validation Chris, Your version doesn't work for me neither.. Maybe you can tell me the paths of each file you putted at pastie? Anyway, I can not pass a double value from my jsp file to my actionclass. Then I get the error 'no such method found for 'setPrice(java.lang.String)''. So I make a setter with a string and convert it. Assuming the value would be already parsed in the validation xml,so my conversion will work. Is this normal? Regards, Sandy -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 15:28 Aan: user@struts.apache.org Onderwerp: Re: validation ok -- I used as much of your code as you have posted and put a working version at http://pastie.org/585837 Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 2:09 pm Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends="struts-default" in your package? or may be just put this in your package to check From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... ... weight: ... In struts.xml I have: /products.jsp /products.jsp /products.jsp In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> 0 3 Weight has to be numeric and can't be less than 0. thx! Sandy - 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
For primitives and dates you don't need to do anything? -- the type conversion is automatic Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 10:43 am Subject: RE: validation Chris, Your version doesn't work for me neither.. Maybe you can tell me the paths of each file you putted at pastie? Anyway, I can not pass a double value from my jsp file to my actionclass. Then I get the error 'no such method found for 'setPrice(java.lang.String)''. So I make a setter with a string and convert it. Assuming the value would be already parsed in the validation xml,so my conversion will work. Is this normal? Regards, Sandy -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 15:28 Aan: user@struts.apache.org Onderwerp: Re: validation ok -- I used as much of your code as you have posted and put a working version at http://pastie.org/585837 Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 2:09 pm Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends="struts-default" in your package? or may be just put this in your package to check From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... ... weight: ... In struts.xml I have: /products.jsp /products.jsp /products.jsp In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> 0 3 Weight has to be numeric and can't be less than 0. thx! Sandy - 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
ok -- I used as much of your code as you have posted and put a working version at http://pastie.org/585837 Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 2:09 pm Subject: RE: validation Requiredstring doesn't work neither.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 14:16 Aan: Struts Users Mailing List Onderwerp: Re: validation how about change your field validator to requiredstring just to check which part of your setting went wrong? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:54:04 PM Subject: RE: validation Yes, this is my package declaration in struts.xml: I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends="struts-default" in your package? or may be just put this in your package to check From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... ... weight: ... In struts.xml I have: /products.jsp /products.jsp /products.jsp In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> 0 3 Weight has to be numeric and can't be less than 0. thx! Sandy - 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
In the products.jsp you assume the action? addProduct to be in the "/service" namespace but? "shop" package which contains the action is not in the "/service" namespace. Try -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 7:54 am Subject: RE: validation Yes, this is my package declaration in struts.xml: I changed the namespace of my formtag (on the jsp page) into 'shop', according to the package name. But it doesn't help.. -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:42 Aan: Struts Users Mailing List Onderwerp: Re: validation do you extends="struts-default" in your package? or may be just put this in your package to check From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 12:26:45 PM Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... ... weight: ... In struts.xml I have: /products.jsp /products.jsp /products.jsp In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> 0 3 Weight has to be numeric and can't be less than 0. thx! Sandy - 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
The names of the params for double validator are different from those of int validator. Instead of max and min your choices are minInclusive maxInclusive minExclusive maxExclusive Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 7:26 am Subject: RE: validation Thx for the reply, I have no interceptors declared in my struts.xml, so I assume i use defaultstack interceptor, or not? Jes, the validation xml is in the same dir as my class. Any other thoughts? -Oorspronkelijk bericht- Van: mailtolouis2020-str...@yahoo.com [mailto:mailtolouis2020-str...@yahoo.com] Verzonden: maandag 17 augustus 2009 13:12 Aan: Struts Users Mailing List Onderwerp: Re: validation Are u using defaultStack interceptor? If not u need to make sure validate and workflow interceptor are in your interceptor stack. Another check is are u putting the ProductActions-addProduct-validation.xml in the same directory as your ProductActions.java ? From: "sandy.verfai...@roularta.be" To: user@struts.apache.org Sent: Monday, August 17, 2009 11:01:56 AM Subject: validation Hi, I'm trying to add some validation to my fstruts 2 form but it won't work. If I enter for example value '6' in my weight textfield and press 'add', the debugger comes in the method 'addProduct', finishes and returns to products.jsp. There is no message shown as defined in the validation xml. Does someone see what goes wrong? In products.jsp I have the following code: ... ... weight: ... In struts.xml I have: /products.jsp /products.jsp /products.jsp In ProductActions.java i have: public String addProduct(){ return SUCCESS; } In ProductActions-addProduct-validation.xml I have: http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";> 0 3 Weight has to be numeric and can't be less than 0. thx! Sandy - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts 2.1.5 type conversion error
Glad it is working. Yes, in a JavaBean the setter/getter methods define the property. The type is derived from the arguments and return types of those methods. The actual data might not even be stored in the bean, e.g. it might be stored in a database or be a calculated value. OGNL follows that pattern but as with most things you can't make blanket statements -- some IOC engines like Spring can go either way depending on configuration. C. -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 7:28 am Subject: RE: struts 2.1.5 type conversion error Chris, I've changed my original setter to setStockAmountInt(int stockAmount), and kept setStockAmount(String stockAmount) so it could be used by the default ognl conversion. Now I can work without errors, but it seems kind of strange to me that this is the normal way of working, is it? Regards, sandy -Oorspronkelijk bericht- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 11:53 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error OGNL properties are JavaBean properties. In your case you are trying to define the property stockAmount twice with two different types. Instead of overloading the setter give it a different name: public void setStockAmountStr(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } Now you have two properties even though the data is in one field. Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 4:26 am Subject: RE: struts 2.1.5 type conversion error Eduard, I have in my class: private int stockAmount; public void setStockAmount(int stockAmount) { this.stockAmount = stockAmount; } public int getStockAmount() { return stockAmount; } public void setStockAmount(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } And in my jsp: Stockamount When I enter a number in stockamount (above 0) it goes well, when i enter a letter it goes wrong, saying 'no such method error setStockAmount(java.lang.String) I have no conversion xml or .properties file.. Regards, SAndy -Oorspronkelijk bericht- Van: Eduard Neuwirt [mailto:eduard.neuw...@googlemail.com] Verzonden: maandag 17 augustus 2009 9:38 Aan: Struts Users Mailing List Onder werp: Re: struts 2.1.5 type conversion error Hi Sandy, please use additionally to the conversion xml the of the declaration corresponding member attributes as double, int etc. I think there are several examples for the .properties files. Regards Eduard Neuwirt sandy.verfai...@roularta.be schrieb: > Martin, > > Then why are there validator xmls in which=2 0you can say what type your > input should be? > Shall I give all my int variables in my class a String-setter? > > Thx for the answer, > Sandy > > > -Oorspronkelijk bericht- > Van: Martin Gainty [mailto:mgai...@hotmail.com] > Verzonden: donderdag 13 augustus 2009 18:45 > Aan: Struts Users Mailing List > Onderwerp: RE: struts 2.1.5 type conversion error > > > http transmits strings (not int,double,date or any other type of > primitive) > > Martin Gainty > je ne suis pas d'accord avec ce que vous dites. > mais je défendrai à ma mort votre droite de la dire. - Voltaire __ > Note de déni et de confidentialité > Ce message est confidentiel et peut être privilégié. Si vous n'êtes > pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, no us ne pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > >> Subject: RE: struts 2.1.5 type conversion error >> Date: Thu, 13 Aug 2009 16:11:55 +0200 >> From: sandy.verfai...@roularta.be >> To: user@struts.apache.org >> >> Lukasz, >> >> The type of 'price' is a double.. >> >> Thx for answering. >> >> Regards, >> sandy >> >> -Oorspronkelijk bericht- >> Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] >> Verzonden: woensdag 22 juli 2009 9:50 >> Aan: Struts Users Mailing List >> Onderwerp: Re: struts 2.1.5 type conversion error >> >> 2009/7/17 : >> >>> Name >>> nl price>> value=""/> >>> >> What type has "price" in action class? >> >> >> Regards >> -- >> Lukasz >> http://www.lenart.org.pl/ >> http://dailylog.lenart.org.pl/ >> >> Charles de Gaulle - "The better I get to know men, the more I find >> myself loving dogs." - >> http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html >> >>
Re: struts 2.1.5 type conversion error
OGNL properties are JavaBean properties. In your case you are trying to define the property stockAmount twice with two different types. Instead of overloading the setter give it a different name: public void setStockAmountStr(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } Now you have two properties even though the data is in one field. Chris -Original Message- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 4:26 am Subject: RE: struts 2.1.5 type conversion error Eduard, I have in my class: private int stockAmount; public void setStockAmount(int stockAmount) { this.stockAmount = stockAmount; } public int getStockAmount() { return stockAmount; } public void setStockAmount(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } And in my jsp: Stockamount When I enter a number in stockamount (above 0) it goes well, when i enter a letter it goes wrong, saying 'no such method error setStockAmount(java.lang.String) I have no conversion xml or .properties file.. Regards, SAndy -Oorspronkelijk bericht- Van: Eduard Neuwirt [mailto:eduard.neuw...@googlemail.com] Verzonden: maandag 17 augustus 2009 9:38 Aan: Struts Users Mailing List Onder werp: Re: struts 2.1.5 type conversion error Hi Sandy, please use additionally to the conversion xml the of the declaration corresponding member attributes as double, int etc. I think there are several examples for the .properties files. Regards Eduard Neuwirt sandy.verfai...@roularta.be schrieb: > Martin, > > Then why are there validator xmls in which you can say what type your input should be? > Shall I give all my int variables in my class a String-setter? > > Thx for the answer, > Sandy > > > -Oorspronkelijk bericht- > Van: Martin Gainty [mailto:mgai...@hotmail.com] > Verzonden: donderdag 13 augustus 2009 18:45 > Aan: Struts Users Mailing List > Onderwerp: RE: struts 2.1.5 type conversion error > > > http transmits strings (not int,double,date or any other type of primitive) > > Martin Gainty > je ne suis pas d'accord avec ce que vous dites. > mais je défendrai à ma mort votre droite de la dire. - Voltaire __ > Note de déni et de confidentialité > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, no us ne pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > >> Subject: RE: struts 2.1.5 type conversion error >> Date: Thu, 13 Aug 2009 16:11:55 +0200 >> From: sandy.verfai...@roularta.be >> To: user@struts.apache.org >> >> Lukasz, >> >> The type of 'price' is a double.. >> >> Thx for answering. >> >> Regards, >> sandy >> >> -Oorspronkelijk bericht- >> Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] >> Verzonden: woensdag 22 juli 2009 9:50 >> Aan: Struts Users Mailing List >> Onderwerp: Re: struts 2.1.5 type conversion error >> >> 2009/7/17 : >> >>> Name >>> nl price>> value=""/> >>> >> What type has "price" in action class? >> >> >> Regards >> -- >> Lukasz >> http://www.lenart.org.pl/ >> http://dailylog.lenart.org.pl/ >> >> Charles de Gaulle - "The better I get to know men, the more I find >> myself loving dogs." - >> http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html >> >> - >> 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 >> >> > > _ > Get your vacation photos on your phone! > http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM > > - > 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: URL Mappings
Note that org.apache.struts2.dispatcher.FilterDispatcher is deprecated since 2.1.3 in favor of org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter. -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Sat, Aug 15, 2009 9:29 am Subject: RE: URL Mappings Martin Gainty wrote: action extensions are specified in struts.xml struts.action.extension static-content: * This filter(org.apache.struts2.dispatcher.FilterDispatcher) also serves common static * content needed when using various parts of Struts, such as JavaScript * files, CSS files, etc. It works by looking for requests to /struts/*, and then mapping the * * value after "/struts/" * to common packages in Struts and, optionally, in your class path. By default, the * * following packages are * automatically searched: * org.apache.struts2.static specifying additional 'packages' in init-param will allow DefaultStaticContentLoader to load those additional packages does this answer your questions? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Aus tausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Sat, 15 Aug 2009 11:29:16 +0200 > From: ro...@mtndesigns.co.uk > To: user@struts.apache.org > Subject: URL Mappings > > Please excuse if this question has been answered before. I can't find > any direct reference to it. > > How would I configure Struts2 to treat .htm requests in the same way as > .action requests. > > I freely admit I do not understand how > org.apache.struts2.dispatcher.FilterDispatcher identifies between static > and not static content. > > For SEO and for familiarity for average users, I'd like all our URLs to > end in .htm > > Is this possible and how do I go about this. > > Thanks > Robin > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands , e-mail: user-h...@struts.apache.org > _ Get your vacation photos on your phone! http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM=
Re: Validation does not work on redirect result
Martin I think the docs you are looking at are for the old org.apache.struts2.config.Result rather than org.apache.struts2.convention.annotation.Result. Chris -Original Message- From: musom...@aol.com To: user@struts.apache.org Sent: Thu, Aug 13, 2009 10:10 am Subject: Re: Validation does not work on redirect result But then look at http://struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-Resultannotation I am using location successfuly. C -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Thu, Aug 13, 2009 9:34 am Subject: RE: Validation does not work on redirect result see value (of destination location) not location http://struts.apache.org/2.1.6/docs/result-annotation.html e.g. @Result(name="success", value="/home.page", type=TilesResult.class) is the doc incorrect? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes=2 0pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement20 être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > To: user@struts.apache.org > Subject: Re: Validation does not work on redirect result > Date: Thu, 13 Aug 2009 08:18:56 -0400 > From: musom...@aol.com > > > Check > > > > @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) > > > I think the attribute should be location rather than value in 2.1.x > Chris > > > > > > > > -Original Message- > From: spsarolkar > To: user@struts.apache.org > Sent: Thu, Aug 13, 2009 12:47 am > Subject: RE: Validation does not work on redirect result > > > > > > > > > > > > FindUserAction extends UserAction which in turn extends from ActionSupport so > why add another import for ActionSupport so I directly used > > return SUCCESS; > > // > > Following does not work -- > @ParentPackage("base-package") > @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) > public class FindUserAction extends UserAction implements > ServletRequestAware { > HttpServletRequest req uest; > public void setServletRequest(HttpServletRequest httpServletRequest) { > request=httpServletRequest; > } > public String execute(){ > if(user!=null) request.getSession().setAttribute("user",user); > return SUCCESS; > } > } > > Following works -- >=2 0 @ParentPackage("base-package") > @Result(name="input",value="/WEB-INF/jsp/user/findUser-success.jsp") > public class FindUserAction extends UserAction implements > ServletRequestAware { > HttpServletRequest request; > public void setServletRequest(HttpServletRequest httpServletRequest) { > request=httpServletRequest; > } > public String execute(){ > if(user!=null) request.getSession().setAttribute("user",user); >=2 > 0 return SUCCESS; > } > } > > > mgainty wrote: > > > > > > execute should return ActionSupport.SUCCESS; > > > > curious as to which document stated to use ServletRedirectAction for a > > result? > > Martin Gainty > > __ > > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > > dient lediglich dem Austausch von Informationen und entfaltet keine > > r echtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > > destinataire prévu, nous te demandons avec bonté que pour satisfaire > > informez l'expéditeur. N'importe quelle di ffusion non autorisée ou la > > copie de ceci est interdite. Ce message sert à l'information seulement et > > n'aura pas n'importe quel effet légalement obligatoire. Étant donné que > > les email peuvent facilement être sujets à la manipulation, nous ne > > p
Re: Validation does not work on redirect result
But then look at http://struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-Resultannotation I am using location successfuly. C -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Thu, Aug 13, 2009 9:34 am Subject: RE: Validation does not work on redirect result see value (of destination location) not location http://struts.apache.org/2.1.6/docs/result-annotation.html e.g. @Result(name="success", value="/home.page", type=TilesResult.class) is the doc incorrect? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement20 être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > To: user@struts.apache.org > Subject: Re: Validation does not work on redirect result > Date: Thu, 13 Aug 2009 08:18:56 -0400 > From: musom...@aol.com > > > Check > > > > @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) > > > I think the attribute should be location rather than value in 2.1.x > Chris > > > > > > > > -Original Message- > From: spsarolkar > To: user@struts.apache.org > Sent: Thu, Aug 13, 2009 12:47 am > Subject: RE: Validation does not work on redirect result > > > > > > > > > > > > FindUserAction extends UserAction which in turn extends from ActionSupport so > why add another import for ActionSupport so I directly used > > return SUCCESS; > > // > > Following does not work -- > @ParentPackage("base-package") > @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) > public class FindUserAction extends UserAction implements > ServletRequestAware { > HttpServletRequest request; > public void setServletRequest(HttpServletRequest httpServletRequest) { > request=httpServletRequest; > } > public String execute(){ > if(user!=null) request.getSession().setAttribute("user",user); > return SUCCESS; > } > } > > Following works -- >=2 0 @ParentPackage("base-package") > @Result(name="input",value="/WEB-INF/jsp/user/findUser-success.jsp") > public class FindUserAction extends UserAction implements > ServletRequestAware { > HttpServletRequest request; > public void setServletRequest(HttpServletRequest httpServletRequest) { > request=httpServletRequest; > } > public String execute(){ > if(user!=null) request.getSession().setAttribute("user",user); >=2 > 0 return SUCCESS; > } > } > > > mgainty wrote: > > > > > > execute should return ActionSupport.SUCCESS; > > > > curious as to which document stated to use ServletRedirectAction for a > > result? > > Martin Gainty > > __ > > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > > dient lediglich dem Austausch von Informationen und entfaltet keine > > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > > destinataire prévu, nous te demandons avec bonté que pour satisfaire > > informez l'expéditeur. N'importe quelle di ffusion non autorisée ou la > > copie de ceci est interdite. Ce message sert à l'information seulement et > > n'aura pas n'importe quel effet légalement obligatoire. Étant donné que > > les email peuvent facilement être sujets à la manipulation, nous ne > > pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > > > > > >> Date: Wed, 12 Aug 2009 12:22:24 -0700 > >> From: spsarol...@gmail.com > >> To: user@struts.apache.org > >> Subject: Re: Validation does not work on redirect result > >> > >> > >> Yep its working wonderfully, > > >> I shouldn't have made use of ServletRedirectA
Re: Validating that two fields match?
try the pattern etc -Original Message- From: James Carr To: Struts Users Mailing List Sent: Thu, Aug 13, 2009 9:53 am Subject: Re: Validating that two fields match? I have tried this and it doesn't seem to work at all. I am using ModelDriven and the model object has a PointOfContact object with an emailAddress and confirmingEmail attributes. true Email Address is required. Please enter a valid email (pointOfContact.emailAddress.equals(pointOfContact.confirmingEmail)) Verify that you have entered the same email address in both fields The other two validators above it work. Thanks, James On Wed, Aug 12, 2009 at 5:59 PM, wrote: > > Check out > http://struts.apache.org/2.x/docs/expression-validator.html > > If you are using annotations check out > > http://struts.apache.org/2.x/docs/expressionvalidator-annotation.html > > Your expression will be something like > @ExpressionValidator(expression="email.equals(confirmEmail)",? message="The email fields do not match") > > > > Chris > > > > > -Original Message- > From: James Carr > To: Struts Users Mailing List > Sent: Wed, Aug 12, 2009 5:30 pm > Subject: Validating that two fields match? > > > > > > > > > > > Hello, > > Is there something out of the box that will let me validate if two > fields match in struts2? An example would be a form with email and > confirmingEmail fields. > > Thanks, > James > > - > 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 does not work on redirect result
Check @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) I think the attribute should be location rather than value in 2.1.x Chris -Original Message- From: spsarolkar To: user@struts.apache.org Sent: Thu, Aug 13, 2009 12:47 am Subject: RE: Validation does not work on redirect result FindUserAction extends UserAction which in turn extends from ActionSupport so why add another import for ActionSupport so I directly used return SUCCESS; // Following does not work -- @ParentPackage("base-package") @Result(name="input",value="findUser",type=ServletActionRedirectResult.class) public class FindUserAction extends UserAction implements ServletRequestAware { HttpServletRequest request; public void setServletRequest(HttpServletRequest httpServletRequest) { request=httpServletRequest; } public String execute(){ if(user!=null) request.getSession().setAttribute("user",user); return SUCCESS; } } Following works -- @ParentPackage("base-package") @Result(name="input",value="/WEB-INF/jsp/user/findUser-success.jsp") public class FindUserAction extends UserAction implements ServletRequestAware { HttpServletRequest request; public void setServletRequest(HttpServletRequest httpServletRequest) { request=httpServletRequest; } public String execute(){ if(user!=null) request.getSession().setAttribute("user",user); =2 0 return SUCCESS; } } mgainty wrote: > > > execute should return ActionSupport.SUCCESS; > > curious as to which document stated to use ServletRedirectAction for a > result? > Martin Gainty > __ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > dient lediglich dem Austausch von Informationen und entfaltet keine > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > destinataire prévu, nous te demandons avec bonté que pour satisfaire > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la > copie de ceci est interdite. Ce message sert à l'information seulement et > n'aura pas n'importe quel effet légalement obligatoire. Étant donné que > les email peuvent facilement être sujets à la manipulation, nous ne > pouvons accepter aucune responsabilité pour le contenu fourni. > > > > >> Date: Wed, 12 Aug 2009 12:22:24 -0700 >> From: spsarol...@gmail.com >> To: user@struts.apache.org >> Subject: Re: Validation does not work on redirect result >> >> >> Yep its working wonderfully, >> I shouldn't have made use of ServletRedirectAction. Following worked for >> me >> >> @ParentPackage("base-package") >> @Result(name="input",value="/WEB-INF/jsp/user/findUser-success.jsp") >> public class FindUserAction extends UserAction implements >> ServletRequestAware { >> HttpServletRequest request; >> public void setServletRequest(HttpServletRequest httpServletRequest) >> { >> request=httpServletRequest; >> } >> public String execute(){ >> if(user!=null) request.getSession().setAttribute("user",user); >> return SUCCESS; >> } >> } >> >> Greg Lindholm-2 wrote: >> > >> > You are going to want to define at least the 2 results 'success' and >> > 'input' >> > for FindUserAction. >> > The 'input' result should not be a redirect, it should be to a jsp (or >> > Freemarker, or velocity, etc). >> > >> > Here is an example from my app using struts.xml configuration: >> > >> > > > method="doList"> >> > /struts/UserList.jsp >> > /struts/UserList.jsp >> > >> > >> > I don't use annotations to define results but I think it would look >> like >> > this: >> > >> > @Results({ >> > @Result (name="success", location="/struts/User/List.jsp"), >> > @Result (name="input", location="/struts/User/List.jsp") >> > }) >> > >> > >> > On Wed, Aug 12, 2009 at 1:48 PM, spsarolka r >> wrote: >> > >> >> >> >> thanks i missed that >> >> >> >> But i am not able to understand statement >> >> >> >> Here is my FindUser.action >> >> @ParentPackage("base-package") >> >> public class FindUserAction extends UserAction implements >> >> ServletRequestAware { >> >>HttpServletRequest request; >> >>public void setServletRequest(HttpServletRequest >> httpServletRequest) { >> >>request=httpServletRequest; >> >>} >> >>public String execute(){ >> >>if(user!=null) request.getSession().setAttribute("user",user); >> >>return SUCCESS; >> >>} >> >> } >> >> >> >> Here is struts.xml >> >> >> >> >> >>> value="base-package
Re: How to prevent user invoke a method?
Have dynamic method invocation off and be careful with wildcards. Another possibility is to have an interceptor veto calls to that method but that would get tedious if you have many of them. chris -Original Message- From: Louis Voo To: Struts Users Mailing List Sent: Thu, Aug 13, 2009 6:54 am Subject: How to prevent user invoke a method? Hello, Is there anyway to prevent user invoke a method which is not define in the configuration file? For e.g, in my UserAction, there is a public String getPassword() method. So in the url, user can enter User!getPassword to directly call this method(), of course they won't be a result map to the return value, so in the front end it will show HTTP Status 404 - No result defined for action com.demo.action.UserAction and result thisisapassword How to prevent this happen? Regards Louis
Re: Configuring SiteMesh for specific action mappings in Struts 2?
Hopefully it solves the OP's problem. Cheers Chris -Original Message- From: Zoran Avtarovski To: Struts Users Mailing List ; musom...@aol.com Sent: Wed, Aug 12, 2009 7:27 pm Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2? I apologise, you’re right. But by changing it to : /widgets/home.action It will work exactly the same way and only exclude the home action when invoked via the widgets namespace. Z. > I think your pattern is on the namespace rather than the action? > C. > > > > > > > > -Original Message- > From: Zoran Avtarovski > To: Struts Users Mailing List ; CS Wong > > Sent: Tue, Aug 11, 2009 9:49 pm > Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2? > > > > > > > > > > > I¹m certain that¹s not correct. We use the decorators.xml file extensively > and we¹re able to have pretty fine control over the sitemesh decorators. I > know in our installation the decorator is based on the action url rather > than the resulting jsp file. > > For example you could include a excludes pattern which ignores all widget > requests by placing > /widgets/* in your excludes section. > > Z. >> > >> > >> > Tried this route but it seems to me that they only work if the patterns >> > specified point to physical files only. For example, it'd work if it points >> > to "index.html" or "/view/hello.jsp". >> > However, I was assuming that it would work for the output from the filter >> > dispatcher as well. What I wanted to achieve was to have SiteMesh invoked >> > for the output from "/hello.action" but to be excluded for >> > "/widgets/hello.action". >> > >> > Big picture-wise, what I wanted was to have one default Struts 2 package, >> > all configured to serve full pages decorated by SiteMesh. Then I'll create >> > another package "widgets", where there's no decorator invoked and it only >> > serves the raw content of the JSPs returned. On my pages, if20AJAX is >> > available, I'd dynamically change the links to load from the "widgets" >> > package instead so I can just call the widget and render it dynamically >> into >> > the page using JS. I'd be able to reuse both the action classes and the JSP >> > throughout both packages then. >> > >> > BTW, I know that SiteMesh is not a native Struts 2 application so if enough >> > people think I'm off-topic here please do let me know. I just thought that >> > since SiteMesh is a supported plugin, it may be applicable here. >> > >> > Thanks, >> > Wong >> > >> > >> > On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt < >> > eduard.neuw...@googlemail.com> wrote: >> > >> > Hi Wong, >> > >> > perhaps would the following entries from decorators.xml help you : >>=2 0> >> > >> > >> > /styles/* >> > /scripts/* >> > /images/* >> > /index.html >> > >> > ... >> > >> > >> > Regards >> > Eduard Neuwirt >> > >> > CS Wong schrieb: >> > >> > Hi, >> >>> >> I'm trying to configure sitemesh to only take effect for a certain subset >> >>> >> of >> >>> >> action mappings in my Struts 2 application. >> >>> >> >> >>> >> Say for example, I have the following struts.xml snippet: >> >>> >> >> >>> >> >> >>> >> >> >>> >>/view/form.jsp >> >>> >> >> >>> >> >> >>> >> espace="/widgets" extends="struts-default"> >> >>> >> >> >>> >>/view/form.jsp >> >>> >> >> >>> >> >> >>> >> >> >>> >> I would like the output of "/showForm.action" to be decorated by >> SiteMesh >> >>> >> but for "/widgets/showForm.action" to be returned empty instead. The >> >>> >> critical part here is that I want the JSP file to be reused by both >>> action >> >>> >> mappings. >> >>> >> >> >>> >> But try as I might, I can't seem to get SiteMe sh's tag to >> >>> >> recognize a mapping. I have to specify the file "/view/form.jsp" to be >> >>> >> excluded instead and that means I won't be able to reuse the JSP file. >> >>> >> >> >>> >> Is there any way I can get around this? >> >>> >> >> >>> >> I'm using Struts 2.0.14. >> >>> >> >> >>> >> Thanks, >> >>> >> Wong >> >>> >> >> >>> >> >> >>> >> >> > >> > >> > - >> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> > For additional commands, e-mail: user-h...@struts.apache.org >> > >> > > > > > >
Re: Validating that two fields match?
Check out http://struts.apache.org/2.x/docs/expression-validator.html If you are using annotations check out http://struts.apache.org/2.x/docs/expressionvalidator-annotation.html Your expression will be something like @ExpressionValidator(expression="email.equals(confirmEmail)",? message="The email fields do not match") Chris -Original Message- From: James Carr To: Struts Users Mailing List Sent: Wed, Aug 12, 2009 5:30 pm Subject: Validating that two fields match? Hello, Is there something out of the box that will let me validate if two fields match in struts2? An example would be a form with email and confirmingEmail fields. Thanks, James - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Configuring SiteMesh for specific action mappings in Struts 2?
I think your pattern is on the namespace rather than the action? C. -Original Message- From: Zoran Avtarovski To: Struts Users Mailing List ; CS Wong Sent: Tue, Aug 11, 2009 9:49 pm Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2? I¹m certain that¹s not correct. We use the decorators.xml file extensively and we¹re able to have pretty fine control over the sitemesh decorators. I know in our installation the decorator is based on the action url rather than the resulting jsp file. For example you could include a excludes pattern which ignores all widget requests by placing /widgets/* in your excludes section. Z. > > > Tried this route but it seems to me that they only work if the patterns > specified point to physical files only. For example, it'd work if it points > to "index.html" or "/view/hello.jsp". > However, I was assuming that it would work for the output from the filter > dispatcher as well. What I wanted to achieve was to have SiteMesh invoked > for the output from "/hello.action" but to be excluded for > "/widgets/hello.action". > > Big picture-wise, what I wanted was to have one default Struts 2 package, > all configured to serve full pages decorated by SiteMesh. Then I'll create > another package "widgets", where there's no decorator invoked and it only > serves the raw content of the JSPs returned. On my pages, if20AJAX is > available, I'd dynamically change the links to load from the "widgets" > package instead so I can just call the widget and render it dynamically into > the page using JS. I'd be able to reuse both the action classes and the JSP > throughout both packages then. > > BTW, I know that SiteMesh is not a native Struts 2 application so if enough > people think I'm off-topic here please do let me know. I just thought that > since SiteMesh is a supported plugin, it may be applicable here. > > Thanks, > Wong > > > On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt < > eduard.neuw...@googlemail.com> wrote: > >> > Hi Wong, >> > >> > perhaps would the following entries from decorators.xml help you : >> > >> > >> > >> > /styles/* >> > /scripts/* >> > /images/* >> > /index.html >> > >> > ... >> > >> > >> > Regards >> > Eduard Neuwirt >> > >> > CS Wong schrieb: >> > >> > Hi, >>> >> I'm trying to configure sitemesh to only take effect for a certain subset >>> >> of >>> >> action mappings in my Struts 2 application. >>> >> >>> >> Say for example, I have the following struts.xml snippet: >>> >> >>> >> >>> >> >>> >>/view/form.jsp >>> >> >>> >> >>> >> >>> >> >>> >>/view/form.jsp >>> >> >>> >> >>> >> >>> >> I would like the output of "/showForm.action" to be decorated by SiteMesh >>> >> but for "/widgets/showForm.action" to be returned empty instead. The >>> >> critical part here is that I want the JSP file to be reused by both >>> action >>> >> mappings. >>> >> >>> >> But try as I might, I can't seem to get SiteMesh's tag to >>> >> recognize a mapping. I have to specify the file "/view/form.jsp" to be >>> >> excluded instead and that means I won't be able to reuse the JSP file. >>> >> >>> >> Is there any way I can get around this? >>> >> >>> >> I'm using Struts 2.0.14. >>> >> >>> >> Thanks, >>> >> Wong >>> >> >>> >> >>> >> >> > >> > >> > - >> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> > For additional commands, e-mail: user-h...@struts.apache.org >> > >> >
Re: Configuring SiteMesh for specific action mappings in Struts 2?
Are you able to put a parameter in your action URL -- something like .myAction.action@&printable=true because in that case you can configure different (or no) decoration based on the parameter chris -Original Message- From: CS Wong To: Struts Users Mailing List Sent: Tue, Aug 11, 2009 1:03 pm Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2? If I understand you correctly, you're saying that I should have double copies of each JSP, say "/decorated/view.jsp" and "/undecorated/view.jsp". And I should configure the exclusion pattern like "/undecorated/*". If possible, I'd really like to avoid that. Java classes themselves already have plenty of boilerplate code without adding JSPs to the mix :) On Tue, Aug 11, 2009 at 10:55 PM, wrote: > > SiteMesh is just a decorator and not Struts 2 centric so you won't find > what you want in its native configuration.? As far as it is concerned the > view could have been generated by a CGI script of anything. I think the path > of least effort it to have two essentially blank JSps that include the > actual material you want to re-use? > Chris > > > > > > > > > -Original Message- > From: CS Wong > To: user@struts.apache.org > Sent: Tue, Aug 11, 2009 6:10 am > Subject: Configuring SiteMesh for specific action mappings in Struts 2? > > > > > > > > > > > Hi, > I'm trying to configure sitemesh to only take effect for a certain subset > of > action mappings in my Struts 2 application. > > Say for example, I have the following struts.xml snippet: > > > >/view/form.jsp > > > > >/view/form.jsp > > > > I would like the output of "/showForm.action" to be decorated by SiteMesh > but for "/widgets/showForm.action" to be returned empty instead. The > critical part here is that I want the JSP file to be reused by both action > mappings. > > But try as I might, I can't seem to get SiteMesh's tag to > recognize a mapping. I have to specify the file "/view/form.jsp" to be > excluded instead and that means I won't be able to reuse the JSP file. > > Is there any way I can get around this? > > I'm using Struts 2.0.14. > > Thanks, > Wong > > > > > >
Re: [S2] Model Driven validation using xml?
I think this is what you are after: http://struts.apache.org/2.x/docs/visitor-validator.html ...This allows you to use the ModelDriven development pattern ... -Original Message- From: James Carr To: Struts Users Mailing List Sent: Tue, Aug 11, 2009 1:43 pm Subject: [S2] Model Driven validation using xml? Hi All, I seem to be unable to find an example of using xml based validation with model driven. My object model is nested, most of my text fields look like: Any help or links would be much apperciated. Thanks, James - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Configuring SiteMesh for specific action mappings in Struts 2?
You did understand me correctly and I see your dilema -- problem is the tags like are not aware of what action the view came from :( -Original Message- From: CS Wong To: Struts Users Mailing List Sent: Tue, Aug 11, 2009 1:03 pm Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2? If I understand you correctly, you're saying that I should have double copies of each JSP, say "/decorated/view.jsp" and "/undecorated/view.jsp". And I should configure the exclusion pattern like "/undecorated/*". If possible, I'd really like to avoid that. Java classes themselves already have plenty of boilerplate code without adding JSPs to the mix :) On Tue, Aug 11, 2009 at 10:55 PM, wrote: > > SiteMesh is just a decorator and not Struts 2 centric so you won't find > what you want in its native configuration.? As far as it is concerned the > view could have been generated by a CGI script of anything. I think the path > of least effort it to have two essentially blank JSps that include the > actual material you want to re-use? > Chris > > > > > > > > > -Original Message- > From: CS Wong > To: user@struts.apache.org > Sent: Tue, Aug 11, 2009 6:10 am > Subject: Configuring SiteMesh for specific action mappings in Struts 2? > > > > > > > > > > > Hi, > I'm trying to configure sitemesh to only take effect for a certain subset > of > action mappings in my Struts 2 application. > > Say for example, I have the following struts.xml snippet: > > > >/view/form.jsp > > > > >/view/form.jsp > > > > I would like the output of "/showForm.action" to be decorated by SiteMesh > but for "/widgets/showForm.action" to be returned empty instead. The > critical part here is that I want the JSP file to be reused by both action > mappings. > > But try as I might, I can't seem to get SiteMesh's tag to > recognize a mapping. I have to specify the file "/view/form.jsp" to be > excluded instead and that means I won't be able to reuse the JSP file. > > Is there any way I can get around this? > > I'm using Struts 2.0.14. > > Thanks, > Wong > > > > > >
Re: Configuring SiteMesh for specific action mappings in Struts 2?
SiteMesh is just a decorator and not Struts 2 centric so you won't find what you want in its native configuration.? As far as it is concerned the view could have been generated by a CGI script of anything. I think the path of least effort it to have two essentially blank JSps that include the actual material you want to re-use? Chris -Original Message- From: CS Wong To: user@struts.apache.org Sent: Tue, Aug 11, 2009 6:10 am Subject: Configuring SiteMesh for specific action mappings in Struts 2? Hi, I'm trying to configure sitemesh to only take effect for a certain subset of action mappings in my Struts 2 application. Say for example, I have the following struts.xml snippet: /view/form.jsp /view/form.jsp I would like the output of "/showForm.action" to be decorated by SiteMesh but for "/widgets/showForm.action" to be returned empty instead. The critical part here is that I want the JSP file to be reused by both action mappings. But try as I might, I can't seem to get SiteMesh's tag to recognize a mapping. I have to specify the file "/view/form.jsp" to be excluded instead and that means I won't be able to reuse the JSP file. Is there any way I can get around this? I'm using Struts 2.0.14. Thanks, Wong
Re: struts2 ognl confusion
is it (questionId) human generated 9I am thinking leading/trailing white space etc). Really clutching at straws but somehow the questionid must occasionally be different ... Chris -Original Message- From: Bhaarat Sharma To: Struts Users Mailing List Sent: Wed, Aug 5, 2009 1:41 pm Subject: Re: struts2 ognl confusion questionId is just a string. so dont think its equals or hash problem. wes, what you suggested I've put that in place and testing to see if error comes again. On Wed, Aug 5, 2009 at 1:35 PM, wrote: > > what type is questionId? You might have a problem with the > equals() in it. > Chris > > > > > > > > -Original Message- > From: Wes Wannemacher > To: Struts Users Mailing List > Sent: Wed, Aug 5, 2009 1:09 pm > Subject: Re: struts2 ognl confusion > > > > > > > > > > > I would try to fiddle around with incorrectQs to see why .contains > isn't working... I'm guessing that if you iterate both lists, although > not efficient, you might get better results - > > > > >Print Something > > > > > > > On Wed, Aug 5, 2009 at 12:22 PM, Bhaarat Sharma > wrote: > > looks like it is not working only in contains.I tried the following: > > > > > > ? ? ? ? > > ? ? ? ? ? ?Print > > Something > > ? ? ? ? > > ? ? ? ? > > ? ? ? ? ? ? > > ? ? ? ? > > > > > > Line 6 prints fine and prints questionId...:( > > > > On Wed, Aug 5, 2009 at 12:09 PM, Bhaarat Sharma > wrote: > > > >> thanks for the explanation chris. but using what you suggested is not > >> making Print Something appear even once. so the test statement is never > >> evaluated to true. ...leading me to suspect that ognl expression is not > >> working. > >> I am not sure whether the random error that is happening for us is being > >> caused by using ${}. Now that you mentioned it is a security concern to > use > >> that expression under s: tags I am ready to change it to #...considering > I > >> find the syntax to do it.. > >> > >> > >> On Wed, Aug 5, 2009 at 11:54 AM, Chris Pratt >wrote: > >> > >>> You must be using a fairly old version of Struts 2. ?The difference > >>> between > >>> the ${} and the # versions is that the ${} is a JSTL EL expression that > is > >>> no longer allowed inside struts (s:) tags for security reasons. ?The # > >>> version is OGNL and references the variable that Wes tried to define. > ?Try > >>> using the id attribute instead of the var attribute. ?So something more > >>> like > >>> this: > >>> > >>> > >>> ? ? > >>> ? ? ? ?Print > Something > >>> ? ? > >>> > >>> > >>> I like to make it obvious which attributes use OGNL by enclosing them > in > >>> %{} > >>> ? (*Chris*) > >>> > >>> On Wed, Aug 5, 2009 at 8:43 AM, Bhaarat Sharma > >>> wrote: > >>> > >>> > oh and attribute 'var' seems to be invalid according to the TLD > >>> > > >>> > On Wed, Aug 5, 2009 at 11:42 AM, Bhaarat Sharma > > >>> > wrote: > >>> > > >>> > > ok thanks Wes. yeah that is def. more readable. > >>> > > could you please tell me what the difference is in doing > >>> > > ? ? > >>> > > VS. > >>> > > ? ? > >>> > > > >>> > > beside the question.questionId part. I am more concerned about > >>> difference > >>> > > in '$' vs. '#' > >>> > > > >>> > > > >>> > > On Wed, Aug 5, 2009 at 11:39 AM, Wes Wannemacher > >>> > wrote: > >>> > > > >>> > >> I think this would be more readable - > >>> > >> > >>> > >> > >>> > >> ? ? > >>> > >> ? ? ? ? Print > >>> > >> Something > >>> > >> ? ? > >>> > >> > >>> > >> > >>> > >> -Wes > >>> > >> > >>> > >> On Wed, Aug 5, 2009 at 11:35 AM, Bhaarat Sharma< > bhaara...@gmail.com> > >>> > >> wrote: > >>> > >> > I have the following code in a jsp > >>> > >> > Line1: > >>> > >> > Line2: ? ? > >>> > >> > Line3: ? ? ? ?Print > >>> > >> > Something > >>> > >> > Line4: ? ? > >>> > >> > Line5: > >>> > >> > > >>> > >> > On Line1 questions is a list. ?This list contains object of > class > >>> > Exam. > >>> > >> > Class Exam has a getter/setter questionId > >>> > >> > On Line2 incorrectQs is a list. ?This list contains strings. > >>> > >> > > >>> > >> > I am checking to see if list in Line2 contains a questionId that > is > >>> in > >>> > >> > questions list on line1. > >>> > >> > > >>> > >> > Is this the best way to do this? > >>> > >> > > >>> > >> > the code seems to be working but 'randomly' sometimes Line2 > never > >>> > seems > >>> > >> to > >>> > >> > be true ...when we know it IS true. > >>> > >> > > >>> > >> > I just want to make sure with some experienced people whether > this > >>> is > >>> > >> the > >>> > >> > way to achieve this? > >>> > >> > > >>> > >> > >>> > >> > >>> > >> > >>> > >> -- > >>> > >> Wes Wannemacher > >>> > >> > >>> > >> Head Engineer, WanTii, Inc. > >>> > >> Need Training? Struts, Spring, Maven, Tomcat... > >>> > >> Ask me for a quote! > >>> > >> > >>> > >> > - > >>> > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >>> > >> For additional commands, e-mail: user-h...@strut
Re: param for action in struts.xml
Looks more like the questioner is after StaticParams. I would check -- that you have the appropriate setter -- that your interceptor stack includes staticParams Chris -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Thu, Aug 6, 2009 8:26 am Subject: RE: param for action in struts.xml webapp: specified on servlet's definition of web.xml dwr uk.ltd.getahead.dwr.DWRServlet snafu true as you can see from the example critical parameter snafu is set to true Action specific: a param can be specified for a specific interceptor for specified action e.g. LOSELOSE ... as you can see when the fubar interceptor is fired critical parameter expectedOutcome of LOSELOSE is transmitted hth Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraul ich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Thu, 6 Aug 2009 18:17:45 +0800 > Subject: param for action in struts.xml > From: kenshin...@gmail.com > To: user@struts.apache.org > > Hi I want to set initial value for an action > I believe the way is > >myParamValue > > > then "myParamValue" will be set to my Action's myParam property. > > but i am not getting anything in my action class. > Am i missing something? or its not how it works? > > I am using Struts 2.1.8 SNAPSHOT. > > Thanks ___ __ Get back to school stuff for them and cashback for you. http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1=
Re: struts2 ognl confusion
what type is questionId? You might have a problem with the equals() in it. Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Wed, Aug 5, 2009 1:09 pm Subject: Re: struts2 ognl confusion I would try to fiddle around with incorrectQs to see why .contains isn't working... I'm guessing that if you iterate both lists, although not efficient, you might get better results - Print Something On Wed, Aug 5, 2009 at 12:22 PM, Bhaarat Sharma wrote: > looks like it is not working only in contains.I tried the following: > > > ? ? ? ? > ? ? ? ? ? ?Print > Something > ? ? ? ? > ? ? ? ? > ? ? ? ? ? ? > ? ? ? ? > > > Line 6 prints fine and prints questionId...:( > > On Wed, Aug 5, 2009 at 12:09 PM, Bhaarat Sharma wrote: > >> thanks for the explanation chris. but using what you suggested is not >> making Print Something appear even once. so the test statement is never >> evaluated to true. ...leading me to suspect that ognl expression is not >> working. >> I am not sure whether the random error that is happening for us is being >> caused by using ${}. Now that you mentioned it is a security concern to use >> that expression under s: tags I am ready to change it to #...considering I >> find the syntax to do it.. >> >> >> On Wed, Aug 5, 2009 at 11:54 AM, Chris Pratt wrote: >> >>> You must be using a fairly old version of Struts 2. ?The difference >>> between >>> the ${} and the # versions is that the ${} is a JSTL EL expression that is >>> no longer allowed inside struts (s:) tags for security reasons. ?The # >>> version is OGNL and references the variable that Wes tried to define. ?Try >>> using the id attribute instead of the var attribute. ?So something more >>> like >>> this: >>> >>> >>> ? ? >>> ? ? ? ?Print Something >>> ? ? >>> >>> >>> I like to make it obvious which attributes use OGNL by enclosing them in >>> %{} >>> ? (*Chris*) >>> >>> On Wed, Aug 5, 2009 at 8:43 AM, Bhaarat Sharma >>> wrote: >>> >>> > oh and attribute 'var' seems to be invalid according to the TLD >>> > >>> > On Wed, Aug 5, 2009 at 11:42 AM, Bhaarat Sharma >>> > wrote: >>> > >>> > > ok thanks Wes. yeah that is def. more readable. >>> > > could you please tell me what the difference is in doing >>> > > ? ? >>> > > VS. >>> > > ? ? >>> > > >>> > > beside the question.questionId part. I am more concerned about >>> difference >>> > > in '$' vs. '#' >>> > > >>> > > >>> > > On Wed, Aug 5, 2009 at 11:39 AM, Wes Wannemacher >>> > wrote: >>> > > >>> > >> I think this would be more readable - >>> > >> >>> > >> >>> > >> ? ? >>> > >> ? ? ? ? Print >>> > >> Something >>> > >> ? ? >>> > >> >>> > >> >>> > >> -Wes >>> > >> >>> > >> On Wed, Aug 5, 2009 at 11:35 AM, Bhaarat Sharma >>> > >> wrote: >>> > >> > I have the following code in a jsp >>> > >> > Line1: >>> > >> > Line2: ? ? >>> > >> > Line3: ? ? ? ?Print >>> > >> > Something >>> > >> > Line4: ? ? >>> > >> > Line5: >>> > >> > >>> > >> > On Line1 questions is a list. ?This list contains object of class >>> > Exam. >>> > >> > Class Exam has a getter/setter questionId >>> > >> > On Line2 incorrectQs is a list. ?This list contains strings. >>> > >> > >>> > >> > I am checking to see if list in Line2 contains a questionId that is >>> in >>> > >> > questions list on line1. >>> > >> > >>> > >> > Is this the best way to do this? >>> > >> > >>> > >> > the code seems to be working but 'randomly' sometimes Line2 never >>> > seems >>> > >> to >>> > >> > be true ...when we know it IS true. >>> > >> > >>> > >> > I just want to make sure with some experienced people whether this >>> is >>> > >> the >>> > >> > way to achieve this? >>> > >> > >>> > >> >>> > >> >>> > >> >>> > >> -- >>> > >> Wes Wannemacher >>> > >> >>> > >> Head Engineer, WanTii, Inc. >>> > >> Need Training? Struts, Spring, Maven, Tomcat... >>> > >> Ask me for a quote! >>> > >> >>> > >> - >>> > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> > >> For additional commands, e-mail: user-h...@struts.apache.org >>> > >> >>> > >> >>> > > >>> > >>> >> >> > -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: equivalent of request.getParameter();
it possible to not click any url but still set a setter If you don't need any user interraction why not do it in the action? It is not clear what would be the point of a view that without any user input then proceeds to do further logic... Chris -Original Message- From: Bhaarat Sharma To: Struts Users Mailing List Sent: Tue, Aug 4, 2009 2:25 pm Subject: Re: equivalent of request.getParameter(); thanks wes. so when that url will be clicked the setter will be set. ...maybe pushing the envelope but is it possible to not click any url but still set a setter. just like we call a getter. On Tue, Aug 4, 2009 at 2:22 PM, Bhaarat Sharma wrote: > wow ..just explaining the problem i figured out I can just avoid doing what > i was thinking and just check for request.getParamter() inside the action > class. > anyways...still curious if there is a way to set a setter w/out doing form > submission.. > > > On Tue, Aug 4, 2009 at 2:18 PM, Bhaarat Sharma wrote: > >> I know its not the best case scenario. If i can do this then I will not >> have to change major piece of the code. >> I'll try to explain the scenario: basically one jsp page is used to show >> results. this jsp page has pagination so each time 50 results are shown. But >> the page has a printer friendly version. when printer friendly link is >> clicked this same jsp page is loaded again but this time around we want to >> print everything not just 50 records. so in my action class there is a >> method which returns sublist. but in this case i want it to return the whole >> list. >> >> So in the jsp i know when printerfriendly is taking place because it is >> being passed a parameter called ?print=true >> >> so i thought that in jsp i could check if print=true then set action class >> Printer method to true. kind of confusing i bet it sounds.. >> >> >> On Tue, Aug 4, 2009 at 2:14 PM, Wes Wannemacher wrote: >> >>> On Tue, Aug 4, 2009 at 2:09 PM, Bhaarat Sharma >>> wrote: >>> > Thanks. >>> > I have another question, which might be a little off topic. >>> > >>> > if I have a method like this in my Action class >>> > >>> >public void setPrinter(String print) >>> >{ >>> >this.printer = print; >>> >} >>> > >>> > how can I call this setter with some value from my jsp page using >>> struts2? >>> > >>> > I know this can be set if I submit a form with hidden value and stuff >>> but I >>> > dont want to submit a form. I just want to set the value from the jsp >>> page. >>> > .. >>> > >>> >>> At which point will that value be used? If you need to know the value >>> of the 'print' variable within the execute method of your action, then >>> it should be part of the form submission... In fact, I am having >>> trouble thinking of a scenario where you would want to call that sort >>> of method from a JSP that doesn't involve form submission (except >>> javascript, but still, just calling a setter alone doesn't really have >>> any effect unless you are calling another action method afterwards >>> that has an interest in that variable's value). >>> >>> -Wes >>> >>> -- >>> Wes Wannemacher >>> >>> Head Engineer, WanTii, Inc. >>> Need Training? Struts, Spring, Maven, Tomcat... >>> Ask me for a quote! >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> >
Re: Struts vs Other competitors
It is not clear how one gets to help -- I have submitted bugs with fixes a few times and then wondered what to do next so they sit there and ferment ... Chris -Original Message- From: Musachy Barroso To: Struts Users Mailing List Sent: Tue, Jul 28, 2009 12:33 am Subject: Re: Struts vs Other competitors I would say the biggest help we can get right now is on the documentation and get help testing releases. One thing I have always seems lacking in the struts community, is support from users to help testing releases *before* they are actually released. As for coordinating effort, I am not sure it would work (besides the usual.."hey I am working on this cool X thing.." email in dev@), I think that working as volunteers doesn't fit well with commitment because we also have other priorities, you know, like playing video games and stuff :) musachy On Mon, Jul 27, 2009 at 8:35 PM, Zoran Avtarovski wrote: > I have to agree. Our touch with the JSF Oracle was both painful and > fruitless and lead us to truly appreciate how bad things could be. > > Having said that, I think Martin has raised some points about how S2 can be > improved and I think S2 is at a stage where there needs to be some general > discussion on where all interested parties (devs and users) think the > framework should be heading and where there are deficiencies. > > I for one think, that with=2 0S2¹s improved plugin architecture, there is a > huge amount of scope in what can be achieved. We need a few key people to > guide the process. I know my biggest fear is over committing and not having > the time to deliver. If there was a centralised coordinator who could > organise a second tier of developers, for example, who can help on a smaller > scale then I believe more of the niche development could be achieved. > > Z. >> >> On Mon, Jul 27, 2009 at 4:42 AM, Andrey Rogov wrote: >>> > I agree with Matt Rable that JSF programming based on RAD methods makes us >>> > transition to JSF. >> >> I think many, many people have crossed that bridge and came back in >> rush after a while. >> >> musachy > > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: getting listValue back to actionclass from s:select tag
Not sure what you mean when you say it is dynamic -- Why not keep track of the original key-value pairs in the user session? You only need the key. Chris -Original Message- From: Bhaarat Sharma To: Struts Users Mailing List Sent: Mon, Jul 27, 2009 9:52 pm Subject: getting listValue back to actionclass from s:select tag I have a s:select tag which is working fine. html code made out of that is: Reason1* Reason2 Reason3* when user selects stuff from this select box and submits what is sent back is listKey. Is there any way to get the listValue (content) back to the action class? I want to do this because as you can see some reasons have * behind them and I want to have some logic for when users select reasons with *. I can not just go by value because it is dynamic. Is there a way to get around this hurdle?
Re: struts 1.x, how to create package ?
No offence intended, John but I would strongly counsel you to read some Tomcat documentation before trying to launch your shopping cart. At the very least the official Tomcat docs for you version of Tomcat (http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html) or some such url and a book or two like http://www.amazon.com/Tomcat-Definitive-Guide-Jason-Brittain/dp/0596101066/ref=sr_1_1?ie=UTF8&qid=1248749758&sr=8-1 Cheers Chris -Original Message- From: john lee To: Struts Users Mailing List Sent: Mon, Jul 27, 2009 6:11 pm Subject: Re: struts 1.x, how to create package ? tks for reply, but should put it in which folder/directory ? then tomcat/struts can serve to online user? ? ? --- On Mon, 7/27/09, Musachy Barroso wrote: From: Musachy Barroso Subject: Re: struts 1.x, how to create package ? To: "Struts Users Mailing List" Date: Monday, July 27, 2009, 4:07 PM http://www.google.com/search?q=how+to+make+a+jar musachy On Mon, Jul 27, 2009 at 1:45 PM, john lee wrote: > > i build online store by struts 1.x, and working fine, and all the classes > file under > > /var/apache-tomcat-6.0.16/webapps/store/WEB-INF/classes/packageX/cart/*.class > > /mail/*.class > /security/*.class > > how can i generate 1 single .jar? and put into which folder, then i can > delete those many *.class files, and delete folder packageX as well? > > tks in advance > > john > > > > > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
Re: DebuggingInterceptor debug=console ?
I vaguely remember it working on some browsers and not on others ... I think it was IE that did not work. Try another browser. Chris **A Good Credit Score is 700 or Above. See yours in just 2 easy steps! (http://pr.atwola.com/promoclk/100126575x1222377105x1201454426/aol?redir=http://www.freecreditreport.com/pm/default.aspx?sc=668072&hmpgID=115&bcd =JulystepsfooterNO115)
Re: unit testing Struts2 application (with Spring and Hibernate)
[The standard?diclaimer that it is not a popularity contest and nothing that does the job for you is wrong.] Would you not agree that if you are going to mock up the framework the simulation of S2 of highest fidelity is S2 itself. IMHO?you are digging a swimming pool by the ocean to test your yatch. I am not familiar with Selenium but anything you can do with JUnit you can do in JWebUnit since it is just JUnit with more libraries. I took your route or instantiating parts of S2 in standard JUnit tests and run into trouble when I moved from 2,0,x to 2,1,x due to changes in the framework. It is a bummer when you switch versions and find the tests are dead. Chris -Original Message- From: Greg Lindholm To: Struts Users Mailing List Sent: Sat, Jul 18, 2009 3:00 am Subject: Re: unit testing Struts2 application (with Spring and Hibernate) > > > > > > > IMO that's outside the purview of unit testing, though--by definition > > > this describes integration testing: the testing of an action along with > > > the framework. > > > > > > There's nothing *wrong* with doing that testing, I just don't think > it's > > > the same thing as unit testing: independently testing the smallest bits > > > of functionality. > > > > > > JUnit can be used for that kind of testing too (and I do, sometimes), > > > but once I'm at that point I generally figure I might as well just be > > > doing client-focused testing and testing the output of my results. I > > > also use Selenium, although I may switch back to using a layer I wrote > > > on top of Watir. > > > > > > Dave > > > > > > > Not to throw weight around, but it is sort of curious to me that the > three > > struts committers who chimed in all agreed that tip-to-tail integration > > testing in JUnit is not worth the effort. I only bring it up because, > IMO, > > struts 2 is one of the best-unit-tested products I've ever worked on. I > think > > Dave, Musachy and myself are biased against tip-to-tail in JUnit because > in > > Struts 2, we have a guideline to unit test all bugfixes and new > functionality. > > That being so, all three of us have probably come across situations where > > writing the unit test is 500x harder than writing the fix :) > > > > Dave does a good job of making the point I tried to make earlier, > tip-to-tail > > testing is better looked at as an integration test and it becomes much > easier > > to deal with as an integration test. If you are unfamiliar with selenium, > it > > is worth learning. One of the posters earlier mentioned that he didn't > want to > > learn another testing framework when he already knows JUnit. Selenium is > nice > > because it runs right in the browser (IE and Firefox) and runs though a > set of > > VB-like instructions... Things like - open this url, look for this text, > click > > this link and then make sure this text exists. IMO, if you want to make > sure > > th at your action renders the appropriate result, this is way better than > > trying to coax the framework by bootstrapping it with mocks then figuring > out a > > way to retrieve the rendered result. As an added bonus, it is possible to > get > > maven to launch selenium tests, so you can get full unit and integration > > testing out of your CI if you are willing to put forth the effort. > > > > To drive the point home further, I would add that the Dojo plugin > probably > > would have been more stable if we had taken the selenium approach (that > is > > being employed with the slowly moving jquery plugin). > > > > -Wes > > > Not to pick on anyone but this isn't really a popularity contest. Different situations have different needs and there is no reason to suggest that one solution will work best for everyone. At a large shop naming something "unit testing" vs "integration testing" maybe important as it can determined who's job it is to do the work. But at a small shop, like I'm at, it makes no difference, it's all just testing and it's the developers job. So for me, whatever way is easiest, quickest and gets the job done wins. It took some work at first to figure out how to tests actions with the full stack with junit but now that I have the plumbing figured out it's very easy to add tests as actions are added. With junit I can easily set the database to a know state before each test, or use mocks to simulate hard to setup edge conditions (how easy is that to do with selenium?) Plus it's easy to jun junit with code coverage so I can see code isn't being covered. And, as another already pointed out, junit is fast and convienent, 2 clicks from inside Eclipse. I do think it is great to see that the industry (at least those on this list) recognizes the importance of automated testing and that with Struts you have ability to test at the isolated pojo detail level all the way through full blow integration testing.
Re: unit testing Struts2 application (with Spring and Hibernate)
JWebUnit integrates? nicely with eclipse. I fall in the?'unit tests are for small? units' group. If your validation is configured wrong you won't fix it in the action so you are not really unit testing the action at that point. I prefer separate JUnit unit tests and JWebUnit tests to test the whole enchilada. Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Fri, Jul 17, 2009 10:59 am Subject: Re: unit testing Struts2 application (with Spring and Hibernate) On Thursday 16 July 2009 07:14:30 pm Dave Newton wrote: > > IMO that's outside the purview of unit testing, though--by definition > this describes integration testing: the testing of an action along with > the framework. > > There's nothing *wrong* with doing that testing, I just don't think it's > the same thing as unit testing: independently testing the smallest bits > of functionality. > > JUnit can be used for that kind of testing too (and I do, sometimes), > but once I'm at that point I generally figure I might as well just be > doing client-focused testing and testing the output of my results. I > also use Selenium, although I may switch back to using a layer I wrote > on top of Watir. > > Dave > Not to throw weight around, but it is sort of curious to me that the three struts committers who chimed in all agreed that tip-to-tail integration testing in JUnit is not worth the effort. I only bring it up because, IMO, struts 2 is one of the best-unit-tested products I've ever worked on. I think Dave, Musachy and myself are biased against tip-to-tail in JUnit because in Struts 2, we have a guideline to unit test all bugfixes and new functionality. That being so, all three of us have probably come across situations where writing the unit test is 500x harder than writing the fix :) Dave does a good job of making the point I tried to make earlier, tip-to-tail testing is better looked at as an integration test and it becomes much easier to deal with as an integration test. If you are unfamiliar with selenium, it is worth learning. One of the posters earlier mentioned that he didn't want to learn another testing framework when he already knows JUnit. Selenium is nice because it runs right in the browser (IE and Firefox) and runs though a set of VB-like instructions... Things like - open this url, look for this text, click this link and then make sure this text exists. IMO, if you want to make sure that your action renders the appropriate result, this is way better than trying to coax the framework by bootstrapping it with mocks then figuring out a way to retrieve the rendered result. As an added bonus, it is possible to get maven to launch selenium tests, so you can get full unit and integration testing out of your CI if you are willing to put forth the effort. To drive the point home further, I would add that the Dojo plugin probably would have been more stable if we had taken the selenium approach (that is being employed with the slowly moving jquery plugin). -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Actions are not Garbage Collected
It is unlikely but if your actions have a finalize() method they won't be collected by minor GCs Chris -Original Message- From: Anselmo To: user@struts.apache.org Sent: Sat, Jul 11, 2009 2:55 am Subject: Re: Actions are not Garbage Collected The only references I have to my action are localeProvider of com.opensymphony.xwork2.TextProviderSupport which has references from the action again. Is this maybe running in circles? -- View this message in context: http://www.nabble.com/Actions-are-not-Garbage-Collected-tp24425128p24432059.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 2 Plug-in and JSP 404
JSP tags wont't funtion inside jars -- the "JSP"s you might have spotted in jars are probably using Freemarker tags which will work in jars. Chris -Original Message- From: Dale Newfield To: Struts Users Mailing List Sent: Fri, Jul 10, 2009 5:06 am Subject: Re: Struts 2 Plug-in and JSP 404 stanlick wrote:? > However, for a plug-in to be a drop-n-go deal, I sort of think the goods? > should all be in the plug-in jar itself? Make sense?? ? Agreed, but I believe I've been told that can't be done with jsp templates. This is why plugins that I've seen have been implemented in freemarker.? ? > I was looking at this? > article, and it appears this cat has a JSP working in his plug-in?? > > http://www.struts2.org/category/struts2-plugins/? ? I downloaded that zip, and looked inside the .jars: no .jsps.? ? > The reason for this plug-in is to eliminate a couple pages of configuration? > steps for the adopter of my application. I'd rather not say just drop the? > plug-in in your WEB-INF/lib folder and then copy JSP files here...? ? I'm simply reporting hear-say here, but I believe you've already hit the roadblock that'll prevent you from getting farther w/o using a different template engine.? ? -Dale? ? -? To unsubscribe, e-mail: user-unsubscr...@struts.apache.org? For additional commands, e-mail: user-h...@struts.apache.org? ?
Re: Commercial framework based on struts2.
Are you not mixing Struts 1 and Struts 2 concepts? Chris -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Tue, Jul 7, 2009 2:26 pm Subject: RE: Commercial framework based on struts2. majority of struts tags support ajax out of the box would definitely help us out if you could be specific about which tag you want 'ajaxified' things like page-level security,prerender actions,intelligent navigation and RESTful URLS cannot be accomplished with JSF keep in mind JSF does not have a front end controller so this Controller cycle only works with Struts and not JSF 1.A request comes in with a certain extension(used to be .do), the container maps it to the ActionServlet. 2. The ActionServlet acts like a front end controller and dispatches control to a RequestProcessor. 3. The RequestProcessor finds an action tag with a path attribute that matches the incoming request 4. Then the RequestProcessor looks for a form-bean tag that has a name attribute that matched the action tags name attribute...aka backing bean 5. RequestProcessor instantiates a FormBean of the of based on the type attribute 6. RequestProcessor calls populates the FormBeans fields from the incoming request, then calls its reset method, then its validate method 7. RequestProcessor instantiates an Action based on the action tags type attribute 8. RequestProcessor calls the action's ex ecute (now perform) method which returns an ActionForward (now ActionResult). 9. The RequestProcessor finds a matching ActionForward first within the nested forward tags, then from within the global-forwards tag. Note: if the validate method returns an ActionMessage then the RequestProcessor forward the request to the resource specified in the action's input attribute thanks, Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Tue, 7 Jul 2009 11:10:29 -0700 > Subject: Re: Commercial framework based on struts2. > From: musa...@gmail.com > To: user@struts.apache.org > > hum, and I never thought there was a demand for something like > this...maybe we should do something about it :) > > @OP: I haven't seen any product like this. > > musachy > > On Tue, Jul 7, 2009 at 10:06 AM, sharath karnati wrote: > > HI Bharath, > > > >I know Struts2 is a framework but I'm looking like customized tags like dataTable,panelGrids and so on > > > >All tags should support AJAX functionality without doing any coding... Please check Icefaces for example which is built on top of JSF and giving more UI tags > > > > Thanks, > > Sharath. > > > > --- On Tue, 7/7/09, Bhaarat Sharma wrote: > > > > > > From: Bhaarat Sharma > > Subject: Re: Commercial framework based on struts2. > > To: "Struts Users Mailing List" > > Date: Tuesday, July 7, 2009, 12:24 PM > > > > > > Struts 2 IS a framework > > > > On Tue, Jul 7, 2009 at 12:20 PM, sharath karnati wrote: > > > >> Dear All, > >> > >>I'm looking for chimerical framework which is built on top of struts2, > >> with having AJAX support tags. I know struts2 comes with DOJO but we need to > >> write lot of coding which we'd like to avoid and we are planning to purchase > >> chimerical product with support. > >> > >>Similar to Icefaces which is build20on JSF technology. > >> > >>Can anyone please let me know. If you have price details then please > >> include that also... > >> > >> Thanks, > >> Sharath. > >> > >> > >> > >> > >> > > > > > > > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > _ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009=
Re: Action mapping documentation (and a security question)
If you lecture your developers to be aware that any public method becomes fair game the security concern might be mitigated but you still have a maintainability issue. With explicit configuration someone inheriting the code can easily figure out how an action method is used by looking at annotations or the XML.. If you allow bangs not only do you have to read *all* the JSPs in your application -- some URLs might be coming from outside the application making it impossible to account for all usage of the action. Chris -Original Message- From: Jan T. Kim To: Struts Users Mailing List Sent: Sun, Jun 28, 2009 10:55 am Subject: Re: Action mapping documentation (and a security question) On Sun, Jun 28, 2009 at 08:15:43AM -0400, Dave Newton wrote: > Jan T. Kim wrote: > >(1) Where is the documentation of this wildcard syntax? > > http://struts.apache.org/2.x/docs/wildcard-mappings.html > http://struts.apache.org/2.x/docs/action-configuration.html#ActionConfiguration-WildcardMethod > > Although the underscore thing is mentioned I don't think it's explicitly > stated. The first link above is linked off the "Guides" page directly, > and from the action configuration page. Ok -- from experimentation it seems to me that an "exclamation point (aka 'bang'), underscore, or other special character" matches any other special character or the empty string, as accessing "bleh", "bleh_" and "bleh!" gives me a test form with validation errors while accessing "bleh_input" gives me one without validation errors. (I tried a few other characters but none exhibited this "special" behaviour so far -- does anyone know what the "other special characters" are?) > >(2) Isn't encoding methods in action name suffixes like this a potential > >security issue? So, are wildcards useful for development but have to be expanded before putting a system to production use? Replacing the filename globbing like wildcard system with a complete regular expression system would allow writing more precise rules, e.g. one could write ... and be certain that the method attribute won't take any values other than "input", "dummy", or the empty string (which then probably should map to the execute method). Best regards, Jan -- +- Jan T. Kim ---+ | email: j@uea.ac.uk | | WWW: http://www.cmp.uea.ac.uk/people/jtk | *-=< hierarchical systems are for files, not for humans >=-* - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Exceptions thrown by constructor different from those thown by execute() ?
I see your point that there has to be some design to handle? that contingency (exceptions coming from the constructor) but with so many opportunities for us to do things via interceptors I would let the framework have a total monopoly on the constructors. Essentially we (application developers) should be into how the action behaves rather than how it comes into being. But I do see your point that for completeness there has to be some definite behavior that takes place if the exception is thrown. Chris -Original Message- From: Jan T. Kim To: Struts Users Mailing List Sent: Thu, Jun 25, 2009 9:05 am Subject: Re: Exceptions thrown by constructor different from those thown by execute() ? Dear Chris, On Thu, Jun 25, 2009 at 08:23:30AM -0400, musom...@aol.com wrote: > > I am with the devs on this one -- typically the constructor of an object whose life cycle is managed by > the framework is off limits -- you wouldn't write code to throw exceptions from a servlet or > EJB etc. I agree that from an EJB provider's angle its quite possible to argue that session bean's constructors shouldn't throw exceptions. From an application assembler's perspective, though, I'd expect that a global exception mapping would handle all exceptions of the specified class, regardless of whether they are thrown by constructors or other methods (and regardless of whether the exception is considered legitimate or reasonable). Best regards, Jan > > > > -Original Message- > From: Wes Wannemacher > To: Struts Users Mailing List > Sent: Tue, Jun 23, 2009 9:03 am > Subject: Re: Exceptions thrown by constructor different from those thown by execute() ? > > > > > > > > > > > On Tue, Jun 23, 2009 at 8:50 AM, Jim Kiley wrote: > [...] > > From a philosophical perspective, though -- no clue, I don't have a lot of > > insight into why the devs make all the decisions they make. > > > [...] > > The decisions I make are usually heavily weighted by how impressed > girls will be :) > > I would go against adding security via exceptions thrown by a > constructor. In the default ObjectFactory for xwork, the flow for > creating instances of classes is pretty easy to follow. The exception > handling is deferred to callers (as evidenced by the various "throws > Exception" qualifiers on the methods). The main reason I would be > against it is that you aren't the one calling "new" on the classes. I > can appreciate what you are trying to do, so file a JIRA and when we > have time to investigate, we could probably implement it, but to solve > your problem, the best bet is an interceptor. > > -Wes > > -- > Wes Wannemacher > Author - Struts 2 In Pr actice > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > http://www.manning.com/wannemacher > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > -- +- Jan T. Kim ---+ | email: j@uea.ac.uk | | WWW: http://www.cmp.uea.ac.uk/people/jtk | *-=< hierarchical systems are for files, not for humans >=-* - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts1 or Struts2
SInce you are comited to a re-write, go for it. Chris -Original Message- From: Mitchell, Steven To: Struts Users Mailing List Sent: Thu, Jun 25, 2009 5:17 pm Subject: RE: Struts1 or Struts2 Chris, My opinion is that you will take an initial productivity hit while the team gets accustomed to the new JSP tags. That is what took me the longest. I also switched from Tiles to SiteMesh, which like much better. My recommendation is to pick one person to do the first small, benchmark application and then have that person mentor the rest of your team. I went ahead and converted a couple of Struts 1 applications to Struts 2. There is no business justification to do so, but it was an excellent learning exercise. The main thing I noticed when I converted my Struts 1 actions to Struts 2 was that they were much cleaner with Struts 2. I standardized the basic layout of my actions. public String save() throws Exception { checkForActionErrors(); if ( !hasActionErrors() ) { checkForFieldErrors(); if ( !hasFieldErrors() ) { // do CRUD stuff here... return SUCCESS; } prepare(); //re-populate stuff in Request scope return INPUT; } } return ERROR; } Go for it! Steve Mitchell http://www.ByteworksInc.com -Original Message- From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] Sent: Thursday, June 25, 2009 3:29 PM To: user@struts.apache.org Subject: Struts1 or Struts2 My company has used Struts1.1 and Struts1.2 for the development of our widely used customer portal web application environment. Recently, the company has decided to migrate to a new back office solution and as a part of this project, our customer portal application is needing to be rewritten as well. In an effort to remain on the latest and greatest technology stacks, I am considering Struts2 (specifically 2.1.6) versus staying on the Struts1.2 framework. Is there a huge benefit in moving to Struts2 for my development team? Will less development/configuration/maintenance be required? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For a dditional commands, e-mail: user-h...@struts.apache.org -- NOTICE: This electronic mail message and any attached files are confidential. The information is exclusively for the use of the individual or entity intended as the recipient. If you are not the intended recipient, any use, copying, printing, reviewing, retention, disclosure, distribution or forwarding of the message or any attached file is not authorized and is strictly prohibited. If you have received this electronic mail message in error, please advise the sender by reply electronic mail immediately and permanently delete the original transmission, any attachments and any copies of this message from your computer system. Thank you. == - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Exceptions thrown by constructor different from those thown by execute() ?
I am with the devs on this one -- typically the constructor of an object whose life cycle is managed by the framework is off limits -- you wouldn't write code to throw exceptions from a servlet or EJB etc. Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Tue, Jun 23, 2009 9:03 am Subject: Re: Exceptions thrown by constructor different from those thown by execute() ? On Tue, Jun 23, 2009 at 8:50 AM, Jim Kiley wrote: [...] > From a philosophical perspective, though -- no clue, I don't have a lot of > insight into why the devs make all the decisions they make. > [...] The decisions I make are usually heavily weighted by how impressed girls will be :) I would go against adding security via exceptions thrown by a constructor. In the default ObjectFactory for xwork, the flow for creating instances of classes is pretty easy to follow. The exception handling is deferred to callers (as evidenced by the various "throws Exception" qualifiers on the methods). The main reason I would be against it is that you aren't the one calling "new" on the classes. I can appreciate what you are trying to do, so file a JIRA and when we have time to investigate, we could probably implement it, but to solve your problem, the best bet is an interceptor. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 static content
I would think this is even more expensive that just doling out static content from Tomcat as Struts 2 is also creating a whole bunch of objects for the request cycle. Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Tue, Jun 23, 2009 12:11 pm Subject: Re: Struts2 static content On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso wrote: > Struts adds overhead for serving static content. Not that I have ever > done any benchmarking on it, but I know that at my company(large > online retailer), just suggesting to serve static content thru tomcat > instead of apache is a big offense. > > musachy > I had a similar experience at a large online content provider. At the time, we were bouncing back and forth between tomcat and resin. We used mod_jk and mod_caucho for integration between httpd and the app servers. I hate it when rules exist, but there is no data to backup the rule's existence. A SysAdmin that I was good friends with and I sat down and performed a series of benchmarks in our dev lab. The results were not something that can easily be generalized (we were testing many different parameters, not just serving static content, things like "hello world" through SSI vs JSP), but we found that even under heavy load, Tomcat and Resin were capable of keeping up with httpd. The biggest factor was JSP compilation (obviously). In our case, we solved that by crawling sites as part of deployment. On particularly heavy traffic sites, we would deploy to the app server, crawl it, then open up traffic from the load balancers. Even after the benchmarks, we never changed the way sites were deployed. I think the argument went something like the following - protagonist - "I don't see any reason to put httpd out in front of that app, it will only add unnecessary configuration overhead." antagonist - "Well, we always put httpd out front because it is highly optimized and fast at serving static content." protagonist - "That's not necessarily true, we have data that indicates that tomcat/resin are just as fast with static content, which sort of makes sense considering how easy it is to find a resource then serve it, I mean, what advanced techniques do you think httpd employs?" antagonist - "Well, we always put httpd out front because it is highly optimized and fast at serving static content." That being said, I generally put the app servers behind a copy of httpd for configuration not performance. I can't say whether httpd has more options than Tomcat or vice versa. I have been using httpd so long, and writing CGI long before writing JSP, so I am just more familiar with httpd's advanced configuration options (host header based vhosting, bandwidth throttling, etc.). -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Update to Struts 2.1.7
Are you saying you have a method called input() in the action or is it that you are getting a result code "input" which would imply a validation error? -Original Message- From: Pro1712 To: user@struts.apache.org Sent: Tue, Jun 23, 2009 9:34 am Subject: Update to Struts 2.1.7 Hello! I try to update from Struts 2.1.6 to 2.1.7. I've got simple actions like this: /pages/Test1.jsp In Struts 2.1.6 'input' was called when invoking the action. In Struts 2.1.7 'execute' is called. Why is ecexute called now? What is the default action that is called? How can I change it? Thanks for your help! -- View this message in context: http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24166101.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: Cant find @Result type=? list in docs
Are you using xml or annotations? Does your package extend struts-default? (the 'built-in' types are defined there) Chris -Original Message- From: Jim Collings To: Struts Users Mailing List Sent: Fri, 29 May 2009 2:57 pm Subject: Re: Cant find @Result type=? list in docs @Result(name="success", location="http://struts.apache.org";, type="redirect") Question was supposed to be: "In the line above, what are the possibilities for type=?" I think the answer is: http://struts.apache.org/2.1.6/docs/result-types.html however, I just tried "redirect-action" mentioned in these docs and either I don't know how to use it, or it doesn't work. On Fri, May 29, 2009 at 2:45 PM, Wes Wannemacher wrote: > http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-Resultannotation > > -Wes > > On Fri, May 29, 2009 at 2:20 PM, Jim Collings wrote: >> So what are the different options for setting type in an @Result >> annotation and what are they for? ?Can't find this in the docs. >> >> Jim C. >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > Wes Wannemacher > Author - Struts 2 In Practice > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > http://www.manning.com/wannemacher > > - > 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: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0
There is something new -- something to do with virtual classpaths that makes JBoss 5 reject apps with dev mode on or with the Convention plugin active while JBoss 4 accepts them. Chris -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 27 May 2009 4:51 pm Subject: Re: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0 2009/5/27 : > Me again: here is a link with a discussion. Don't hold your breath as > it does not give a work around. > http://www.nabble.com/Problems-using-Struts2-on-JBoss-5.0.1GA-td22969807.html Does it mean it solves your issue? Or there there is something new regarding JBoss 5.1? 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
Re: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0
Me again: here is a link with a discussion. Don't hold your breath as it does not give a work around. http://www.nabble.com/Problems-using-Struts2-on-JBoss-5.0.1GA-td22969807.html Chris -Original Message- From: Fernandes Celinio To: Struts Users Mailing List Sent: Wed, 27 May 2009 1:06 pm Subject: RE: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0 Yes, I did and it works. So i am assuming there is a problem with Jboss. I have not checked the logs yet. -Message d'origine- e : Lukasz Lenart [mailto:lukasz.len...@googlemail.com] nvoyé : mercredi 27 mai 2009 19:02 : Struts Users Mailing List bjet : Re: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0 2009/5/27 Fernandes Celinio : I know it works well with the Tomcat server. JBoss is using Tomcat to serve Java web applications, did you try deploy the ame application to standalone Tomcat? egards - ukasz ttp://www.lenart.org.pl/ - o unsubscribe, e-mail: user-unsubscr...@struts.apache.org or additional commands, e-mail: user-h...@struts.apache.org o unsubscribe, e-mail: user-unsubscr...@struts.apache.org or additional commands, e-mail: user-h...@struts.apache.org
Re: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0
Lukasz, it is JBoss specific -- actually JBoss 5. Apps that work on JBoss 4 with the Convention Plugin fail with JBoss 5. I can post the specific error messages when I get home next week (I am in Stockholm without my code. Cheers Chris -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 27 May 2009 1:02 pm Subject: Re: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0 2009/5/27 Fernandes Celinio : > I know it works well with the Tomcat server. JBoss is using Tomcat to serve Java web applications, did you try deploy the same application to standalone Tomcat? 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
Re: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0
Fernandes I had the same problem -- essentially I could not get it to work using the Convention plugin. Also, when you configure by xml you can't have dev mode on. The most I have gleaned off the internet, and there are people who should know better than me on this list the problem is to do with the scanning process as the framework scans for action classes. Anyone who knows more, chime in. Cheers Chris -Original Message- From: Fernandes Celinio To: Struts Users Mailing List Sent: Wed, 27 May 2009 12:58 pm Subject: [Struts 2.1.6] Convention plug-in not working with Jboss 5.1.0 Hi, Is there a problem when using the Convention plug-in with Jboss 5.1.0 ? I mean there is no struts.xml file., the mapping is defined in the Action classes, through the use of annotations such as : @Actions({ @Action(value="/myFirstPath", result...@result(name="success", location="/here/first.jsp")} ), @Action(value="/mySecondPath", result...@result(name="success", location="/here/second.jsp")} ) }) Http://localhost:8080/myFirstPath Gives me the following error : HTTP Status 404 - There is no Action mapped for namespace / and action name myFirstPath. Http://localhost:8080/mySecondPath Gives me the following error : HTTP Status 404 - There is no Action mapped for namespace / and action name mySecondPath. I know it works well with the Tomcat server. Is there a problem with Jboss ? Something else to configure ? Thanks for helping. Celinio - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Interceptor Trouble
Jim, since it is the interceptor you are interested in testing why not test it without the Convention Plug-in (configuring the action by xml) to see if it is working, which is your aim. That way you don't have two things you are unsure of happening at once. Cheers Chris -Original Message- From: Wes Wannemacher To: Struts Users Mailing List Sent: Wed, 27 May 2009 3:29 pm Subject: Re: Interceptor Trouble On Wed, May 27, 2009 at 3:24 PM, Jim Collings wrote: > > Conventions. Hmmm.. Perhaps better implemented as a filter then. I'ld > prefer it to having to annotate every single Action class. > > > Jim C. > You don't need to annotate every class, but you will need to change the package the conventions assigns by default - -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Converter trying to set String on int field
I bet it has something to do with a null not being assignable to an int. Chris -Original Message- From: Richard Sayre To: Struts Users Mailing List Sent: Mon, 11 May 2009 11:44 am Subject: Re: Converter trying to set String on int field After some further investigation I found that any array type that has no values from the form on submit will call setXXX(String). I checked the source of com.opensymphony.xwork2.util.XWorkBasicConverter and this is the first thing it does: if (value == null || toType.isAssignableFrom(value.getClass())) { // no need to convert at all, right? return value; } So I'm still unclear as to why setXXX(String) is called. I even used a custom converter, and I am getting the same results. When I return null from my converter setXXX(String) is called. If anyone has any suggestions on how to handle this it would be greatly appreciated Thanks Rich On Mon, May 11, 2009 at 11:10 AM, Richard Sayre wrote: > I have a bunch of check boxes called userId. In my action I have int > userId[] and setUserId(int[] ids) > > When I select a checkbox the conversion works normally. ?When I dont > check any boxes on the form and submit, I get the following: > > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null > for property userId. Mapping size: 4 > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to > default type converter > [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null > for property userId. Mapping size: 4 > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to > default type converter > [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Error setting value > ognl.MethodFailedException: Method "setUserId" failed for object > com.abc.usersact...@1db2215 [java.lang.NoSuchMethodException: > setUserId(java.lang.String)] > > For some reason when no ids are selected it is trying to set the value > as a String. > > 1) Is this normal behavior? > 2) Is there a way to work around it? > > Thank you, > > Rich > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: S2 - s:submit method="value" has to be hard-coded?
There is bound to be some logic that determines what method the button would invoke. Why not put that logic in the action method and have it call appropriate helper methods? In other words move the fork from the view to inside the action method. Chris **Remember Mom this Mother's Day! Find a florist near you now. (http://yellowpages.aol.com/search?query=florist&ncid=emlcntusyelp0006)
Re: Open an excel in Struts application
Here is the link to the discussion on Jasperforge http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=47545 I wasn't aware of a poi-plugin for Struts2 -- can't see it in the registry. I used the JasperReports plugin and the poi jar. You must have a different approach. -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Mon, 27 Apr 2009 8:02 am Subject: RE: Open an excel in Struts application which error is displayed? can you show the logs? BTW: If you want Poi Action classes you will need the POI-plugin for Struts Thanks, Martin __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > To: user@struts.apache.org > Subject: Re: Open an excel in Struts application > Date: Sun, 26 Apr 2009 22:25:01 -0400 > From: musom...@aol.com > > When/if you use the JasperReports plugin use an older version of poi (3.0 is the latest I had success with). The new poi throws an exception which many have complained about but has not been fixed/ > Chris > > > > -Original Message- > From: renisha > To: user@struts.apache.org > Sent: Sun, 26 Apr 2009 1:30 pm > Subject: Re: Open an excel in Struts application > > > > > Thanks for your reply . I am using struts2 version. Could you please give me > some sampl code if you have. > > Wes Wannemacher wrote: > > > > On Sunday 26 April 2009 11:00:59 am renisha wrote: > >> Hi, > >> > >> I am reading some values from database , doing some calculations and > >> creating an20excel file. > >> > >> In my action class , I am returning an HSSFWorkbook object and I need to > >> diaply the excel file as the output . Please let me know how do I get it > >> working . > > > > > > Which version of Struts? > > > > I would suggest if you are using Struts 2, then take a look at the Jasper > > Reports plugin, there is XLS output from there. > > > > -Wes > > > > -- > > > > Wes Wannemacher > > Author - Struts 2 In Practice > > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > > http://www.manning.com/wannemacher > > > > > > - > > 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/Open-an-excel-in-Struts-application-tp23243002p23244421.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 > > _ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_042009=
Re: Open an excel in Struts application
When/if you use the JasperReports plugin use an older version of poi (3.0 is the latest I had success with). The new poi throws an exception which many have complained about but has not been fixed/ Chris -Original Message- From: renisha To: user@struts.apache.org Sent: Sun, 26 Apr 2009 1:30 pm Subject: Re: Open an excel in Struts application Thanks for your reply . I am using struts2 version. Could you please give me some sampl code if you have. Wes Wannemacher wrote: > > On Sunday 26 April 2009 11:00:59 am renisha wrote: >> Hi, >> >> I am reading some values from database , doing some calculations and >> creating an excel file. >> >> In my action class , I am returning an HSSFWorkbook object and I need to >> diaply the excel file as the output . Please let me know how do I get it >> working . > > > Which version of Struts? > > I would suggest if you are using Struts 2, then take a look at the Jasper > Reports plugin, there is XLS output from there. > > -Wes > > -- > > Wes Wannemacher > Author - Struts 2 In Practice > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more > http://www.manning.com/wannemacher > > > - > 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/Open-an-excel-in-Struts-application-tp23243002p23244421.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: sample CRUD application question
Sorry i was not very clear: when you configure your application to allow the bang (!) notation, the client gets to choose *any* of the public methods on your action and use them as action methods as opposed to you listing what your action methods are explicitly. So?the developer has to be cautious because all public methods on the action become fair game. Chris? -Original Message- From: Dave Newton To: Struts Users Mailing List Sent: Tue, 14 Apr 2009 2:25 pm Subject: Re: sample CRUD application question Bhaarat Sharma wrote:? > so what would be a way to avoid that?? > > use this instead?? > >> ? >> ? >> ? ? I don't see any difference there.? ? I'm not sure what the original response had in mind; the same thing could happen with a POST form.? ? Normally one would check for delete access rights on the server side before allowing deletions.? ? Dave? ? -? To unsubscribe, e-mail: user-unsubscr...@struts.apache.org? For additional commands, e-mail: user-h...@struts.apache.org? ?
Re: sample CRUD application question
You might want to be cautious about that -- essentially you are allowing the client by typing a URL in their browser to delete material in your database in an adhoc fashion. Chris M -Original Message- From: Bhaarat Sharma To: Struts Users Mailing List Sent: Tue, 14 Apr 2009 11:03 am Subject: Re: sample CRUD application question oh cool so i can just add method parameter myself. damn the shorthands. we need a wiki that explains all these On Tue, Apr 14, 2009 at 11:01 AM, Security Management < list-subscripti...@secmgmt.com> wrote: > I *think* it's the method name of the action? > > In other words, the equivilant of: > > > > > Mike. > -Original Message- > From: Bhaarat Sharma [mailto:bhaara...@gmail.com] > Sent: Tuesday, April 14, 2009 10:55 AM > To: Struts Users Mailing List > Subject: sample CRUD application question > > I was looking at the CRUD sample application in struts2 > > http://struts.apache.org/2.0.14/docs/crud-demo-i.html > > in one of the jsp's they have this code > > > > > > and some part of the struts.xml is: > > class="com.aurifa.struts2.tutorial.action.EmployeeAction" method="input"> >index >/WEB-INF/jsp/employeeForm.jsp >/WEB-INF/jsp/error.jsp > > > I am lost as to why > shouldnt the action be just "crud" what does the exclamation mark and > delete > do?? is that a shorthand for something or is that just an action name and > if > it is an action name then why is it not defined in struts.xml > > Thanks!! > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: Struts access static list
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)
Re: Struts access static list
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)
Re: how to re-init / update parameter of an interceptor during runtime?
An interceptor has access to application via ActionContext so it is easy to rig up. From anywhere in your application you can manipulate an entry in application and have the interceptor check if it matches the value it currently has. I still think it is an unorthodox approach though. It also costs you time as your intercept() method now has that extra check. Chris M -Original Message- From: Joe Lam To: user@struts.apache.org Sent: Fri, 3 Apr 2009 2:48 am Subject: Re: how to re-init / update parameter of an interceptor during runtime? thx for your reply. actually I am not going to change the param regularly. this is more like "just in case I want to change the setting in the future". thx Joe Nils-Helge Garli wrote: > > Why do you need to do that? > > Nils-H > > On Fri, Apr 3, 2009 at 5:05 AM, Joe Lam wrote: >> >> I got this in action mapping >> >> ? ? ? ?value01 >> >> >> that parameter actually is an instance property of that interceptor >> instance. >> >> private String param01; >> public void setParam01(String value){ >> ? ? ? ?param01= value; >> } >> >> I wonder if it is possible to call again the setter method via API during >> runtime to change the interceptor behavior. >> >> thanks. >> >> Joe >> -- >> View this message in context: >> http://www.nabble.com/how-to-re-init---update-parameter-of-an-interceptor-during-runtime--tp22861150p22861150.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/how-to-re-init---update-parameter-of-an-interceptor-during-runtime--tp22861150p22862897.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: how to re-init / update parameter of an interceptor during runtime?
Since interceptors are not thread safe I would look at manipulating fields from a given thread with a jaundiced eye. Chris M. -Original Message- From: Nils-Helge Garli Hegvik To: Struts Users Mailing List Sent: Fri, 3 Apr 2009 1:46 am Subject: Re: how to re-init / update parameter of an interceptor during runtime? Why do you need to do that? Nils-H On Fri, Apr 3, 2009 at 5:05 AM, Joe Lam wrote: > > I got this in action mapping > > ? ? ? ?value01 > > > that parameter actually is an instance property of that interceptor > instance. > > private String param01; > public void setParam01(String value){ > ? ? ? ?param01= value; > } > > I wonder if it is possible to call again the setter method via API during > runtime to change the interceptor behavior. > > thanks. > > Joe > -- > View this message in context: > http://www.nabble.com/how-to-re-init---update-parameter-of-an-interceptor-during-runtime--tp22861150p22861150.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
Re: ExecuteAndWaitInterceptor not working (2.1.6)
Thanks --? I think Struts 2.0.x had an earlier version of the interceptor that would create a wait page dynamically.? No problem as long as it is the expected behavior. That being the case, perhaps we should change the documentation at http://struts.apache.org/2.x/docs/execute-and-wait-interceptor.html to not say If no "wait" result is found, Struts will automatically generate a wait result on the fly. Chris -Original Message- From: Musachy Barroso To: Struts Users Mailing List Sent: Wed, 1 Apr 2009 6:25 pm Subject: Re: ExecuteAndWaitInterceptor not working (2.1.6) Sorry I hadn't looked at this in detail. As Dale said, you need to define a "wait" result. Struts should not be trying to create it if it isn't there, it should throw an exception instead. musachy On Wed, Apr 1, 2009 at 11:30 AM, wrote: > > ?Will do. > Chris > > > > > > > > -Original Message- > From: Musachy Barroso > To: Struts Users Mailing List > Sent: Tue, 31 Mar 2009 11:09 am > Subject: Re: ExecuteAndWaitInterceptor not working (2.1.6) > > > > > > > > > > > Add the full stack trace and as much information as possible. > > thanks > musachy > > On Tue, Mar 31, 2009 at 10:58 AM, Dale Newfield wrote: >> musom...@aol.com wrote: >>> >>> Exactly -- used to work in 2.0.x but must have broken in the transition. >> >> Please create a JIRA issue for this. >> >> -Dale >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Action an overused term?
Maybe we should start calling them struts2 beans or something. It might also lessen the frequency of people thinking they are functionally the same as Struts 1 actions. Chris -Original Message- From: Musachy Barroso To: Struts Users Mailing List Sent: Wed, 1 Apr 2009 4:40 pm Subject: Re: Action an overused term? And that is why I love Groovy's "import something as somethingelse" :) musachy On Wed, Apr 1, 2009 at 11:35 AM, wrote: > We are at the point where in many cases we will want an action to > 1. implement Action (for configuration by convention purposes) and also > 2. use the @Action annotation > So we are faced with either using fully qualified names for one of the 'Action's or taking the route of extending ActionSupport and losing the chance to extend anything else. Perhaps in later versions we could have fewer things called Action? > Chris M > > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Action an overused term?
We are at the point where in many cases we will want an action to 1. implement Action (for configuration by convention purposes) and also 2. use the @Action annotation So we are faced with either using fully qualified names for one of the 'Action's or taking the route of extending ActionSupport and losing the chance to extend anything else. Perhaps in later versions we could have fewer things called Action? Chris M
Re: ExecuteAndWaitInterceptor not working (2.1.6)
Will do. Chris -Original Message- From: Musachy Barroso To: Struts Users Mailing List Sent: Tue, 31 Mar 2009 11:09 am Subject: Re: ExecuteAndWaitInterceptor not working (2.1.6) Add the full stack trace and as much information as possible. thanks musachy On Tue, Mar 31, 2009 at 10:58 AM, Dale Newfield wrote: > musom...@aol.com wrote: >> >> Exactly -- used to work in 2.0.x but must have broken in the transition. > > Please create a JIRA issue for this. > > -Dale > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: ExecuteAndWaitInterceptor not working (2.1.6)
Exactly -- used to work in 2.0.x but must have broken in the transition. Chris -Original Message- From: Dale Newfield To: Struts Users Mailing List Sent: Mon, 30 Mar 2009 3:51 pm Subject: Re: ExecuteAndWaitInterceptor not working (2.1.6) musom...@aol.com wrote:? > execAndWait in 2.1.6 gives the following exception when it kicks in: (code > pasted below)? > > > java.lang.UnsupportedOperationException > ??? java.util.Collections$UnmodifiableMap.put(Collections.java:1285)? > ??? > org.apache.struts2.interceptor.ExecuteAndWaitInterceptor.doIntercept(ExecuteAndWaitInterceptor.java:256)? ? Not sure why the problem is occurring, but looking at that section of code suggests having a real "wait" result rather than letting struts auto-build one for you should be a workaround for the bug.? ? -Dale? ? -? To unsubscribe, e-mail: user-unsubscr...@struts.apache.org? For additional commands, e-mail: user-h...@struts.apache.org? ?
ExecuteAndWaitInterceptor not working (2.1.6)
execAndWait in 2.1.6 gives the following exception when it kicks in: (code pasted below) java.lang.UnsupportedOperationException ??? java.util.Collections$UnmodifiableMap.put(Collections.java:1285) ??? org.apache.struts2.interceptor.ExecuteAndWaitInterceptor.doIntercept(ExecuteAndWaitInterceptor.java:256) ??? com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) ??? com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) ??? com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) ??? com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) ??? com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) ??? org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) ??? org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) ??? org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) ??? org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) ??? org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ??? org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) ??? org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) ??? org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) ??? org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) ??? org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) ??? org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) ??? org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) ??? org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) ??? org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) ??? java.lang.Thread.run(Thread.java:619) CODE: Input JSP: (WEB-INF/content/all/index.jsp <%@ taglib prefix="s" uri="/struts-tags"%> ??? ??? ??? Hello World ??? ??? ??? ??? ??? ??? ??? Enter Your Name ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? Configuration (struts.xml) http://struts.apache.org/dtds/struts-2.0.dtd";> ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? 1000 ??? ??? ??? ??? 50 ??? ??? ??? ??? ??? ??? ??? ??? ??? /WEB-INF/content/all/say-hello-success.jsp ??? ??? ??? ??? ??? ??? === Action (actions.all.SayHelloAction.java) package actions.all; import java.util.Date; public class SayHelloAction{ ??? private static final long serialVersionUID = 1L; ??? private String userName; ??? public String execute() throws Exception { ??? ??? wasteTime(1); ??? ??? return "success"; ??? } ??? public String getUserName() { ??? ??? return userName; ??? } ??? public void setUserName(String userName) { ??? ??? this.userName = userName; ??? } ??? ??? private void wasteTime(long time){ ??? ??? long start = new Date().getTime(); ??? ??? while(new Date().getTime()-start < time){ ??? ??? ??? try { ??? ??? ??? ??? Thread.sleep(100L); ??? ??? ??? } catch (InterruptedException e) { ??? ??? ??? ??? e.printStackTrace(); ??? ??? ??? } ??? ??? } ??? } } = Output page (WEB-INF/content/all/say-hello-success.jsp) <%@ taglib prefix="s" uri="/struts-tags"%> ??? ??? ??? Hello Success ??? ??? ??? Hello ??? Cheers Chris M.
Re: Config-browser properties tab broken (2.1.6)
Here is a smaller more succinct example to show the config-browser misbehaving. (No xml -- using convention plugin) Jars in WEB-INF/lib: commons-collections-3.2.1.jar commons-fileupload-1.2.1.jar commons-logging-1.1.1.jar freemarker-2.3.13.jar log4j-1.2.15.jar ognl-2.6.11.jar struts2-config-browser-plugin-2.1.6.jar struts2-convention-plugin-2.1.6.jar struts2-core-2.1.6.jar xwork-2.1.2.jar = Input JSP: WEB-INF/WebContent/content/all/index.jsp <%@ taglib prefix="s" uri="/struts-tags"%> Hello World Enter Your Name = Action: actions.all.SayHelloAction.java package actions.all; public class SayHelloAction{ private static final long serialVersionUID = 1L; private String userName; public String execute() throws Exception { return "success"; } A 0 public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } } === Output JSP: WEB-INF/content/all/say-hello-success.jsp <%@ taglib prefix="s" uri="/struts-tags"%> Hello Success Hello == You still get the long list of incorrect properties in the config-browser :( Cheers Chris M -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Wed, 25 Mar 2009 10:35 pm Subject: RE: Config-browser properties tab broken (2.1.6) can you post jsp and xml action config? thx, Martin __ Disclaimer and confidentiality note This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. > To: user@struts.apache.org > Subject: Config-browser properties tab broken (2.1.6) > Date: Wed, 25 Mar 2009 21:18:00 -0400 > From: musom...@aol.com > > I find it doesn't matter which action you are looking at -- you get the same list of 38 key-value pairs which are clearly not the bean properties of your action. The list is pasted below: > It looks very much like we are getting the bean properties of some Class object ...? > Chris M > > annotation boolean > annotations [Ljava.lang.annotation.Annotation; > anonymousClass boolean > array boolean > canonicalName java.lang.String > classLoader java.lang.ClassLoader > classes [Ljava.lang.Class; > componentType java.lang.Class > constructors [Ljava.lang.reflect.Constructor; > declaredAnnotations [Ljava.lang.annotation.Annotation; > declaredClasses [Ljava.lang.Class; > declaredConstructors [Ljava.lang.reflect.Constructor; > declaredFields [Ljava.lang.reflect.Field; > declaredMethods [Ljava.lang.reflect.Method; > declaringClass java.lang.Class > enclosingClass java.lang.Class > enclosingConstructor java.lang.reflect.Constructor > enclosingMethod java.lang.reflect.Method > enum boolean > enumConstants [Ljava.lang.Object; > fields [Ljava.lang.reflect.Field; > genericInterfaces [Ljava.lang.reflect.Type; > genericSuperclass java.lang.reflect.Type > interface boolean > interfaces [Ljava.lang.Class; > localClass boolean > memberClass boolean > methods [Ljava.lang.reflect.Method; > modifiers int > name java.lang.String > package java.lang.Package > primitive boolean > protectionDomain java.security.ProtectionDomain > signers [Ljava.lang.Object; > simpleName java.lang.String20 > superclass java.lang.Class > synthetic boolean > typeParameters [Ljava.lang.reflect.TypeVariable; > > _ Windows Live™ SkyDrive: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_032009=
Re: Config-browser properties tab broken (2.1.6)
Forgot the jsps -- sorry! = <%@ taglib prefix="s" uri="/struts-tags"%> Add Music Recording Enter New Music Recording Details C2 == <%@ taglib prefix="s" uri="/struts-tags"%> Music Recording Added Successfully Music Recording Added Successfully = -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Wed, 25 Mar 2009 10:35 pm Subject: RE: Config-browser properties tab broken (2.1.6) can you post jsp and xml action config? thx, Martin __ Disclaimer and confidentiality note This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. > To: user@struts.apache.org > Subject: Config-browser properties tab broken (2.1.6) > Date: Wed, 25 Mar 2009 21:18:00 -0400 > From: musom...@aol.com > > I find it doesn't matter which action you are looking at -- you get the same list of 38 key-value pairs which are clearly not the bean properties of your action. The list is pasted below: > It looks very much like we are getting the bean properties of some Class object ...? > Chris M > > annotation boolean > annotations [Ljava.lang.annotation.Annotation; > anonymousClass boolean > array boolean > canonicalName java.lang.String > classLoader java.lang.ClassLoader > classes [Ljava.lang.Class; > componentType java.lang.Class > constructors [Ljava.lang.reflect.Constructor; > declaredAnnotations [Ljava.lang.annotation.Annotation; > declaredClasses [Ljava.lang.Class; > declaredConstructors [Ljava.lang.reflect.Constructor; > declaredFields [Ljava.lang.reflect.Field; > declaredMethods [Ljava.lang.reflect.Method; > declaringClass java.lang.Class > enclosingC lass java.lang.Class > enclosingConstructor java.lang.reflect.Constructor > enclosingMethod java.lang.reflect.Method > enum boolean > enumConstants [Ljava.lang.Object; > fields [Ljava.lang.reflect.Field; > genericInterfaces [Ljava.lang.reflect.Type; > genericSuperclass java.lang.reflect.Type > interface boolean > interfaces [Ljava.lang.Class; > localClass boolean > memberClass boolean > methods [Ljava.lang.reflect.Method; > modifiers int > name java.lang.String > package java.lang.Package > primitive boolean > protectionDomain java.security.ProtectionDomain > signers [Ljava.lang.Object; > simpleName java.lang.String > superclass java.lang.Class > synthetic boolean > typeParameters [Ljava.lang.reflect.TypeVariable; > > _ Windows Live™ SkyDrive: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_032009=
Re: Config-browser properties tab broken (2.1.6)
Here is an example and its struts.xml (you get the same result with convention plug-in) = package rain.actions.all; public class AddMusicRecordingAction{ private static final long serialVersionUID = 1L; private String artist; private String category; private double price; private String title; public String execute() throws Exception { return "success"; } public String getArtist() { return artist; } public String getCategory() { return category; } public double getPrice() { return price; } public String getTitle() { return title; } public void setArtist(String artist) { this.artist = artist; } public void setCategory(String category) { this.category = category; } public void setPrice(double price) { this.price = price; } public void setTitle(String title) { this.title = title; } } = http://struts.apache.org/dtds/struts-2.0.dtd";> /WEB-INF/content/all/index.jsp /WEB-INF/content/all/add-music-recording-success.jsp = Cheers Chris M -Original Message- From: Martin Gainty To: Struts Users Mailing List Sent: Wed, 25 Mar 2009 10:35 pm Subject: RE: Config-browser properties tab broken (2.1.6) can you post jsp and xml action config? thx, Martin __ Disclaimer and confidentiality note This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to please inform the20sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. > To: user@struts.apache.org > Subject: Config-browser properties tab broken (2.1.6) > Date: Wed, 25 Mar 2009 21:18:00 -0400 > From: musom...@aol.com > > I find it doesn't matter which action you are looking at -- you get the same list of 38 key-value pairs which are clearly not the bean properties of your action. The list is pasted below: > It looks very much like we are getting the bean properties of some Class object ...? > Chris M > > annotation boolean > annotations [Ljava.lang.annotation.Annotation; > anonymousClass boolean > array boolean > canonicalName java.lang.String > classLoader java.lang.ClassLoader > classes [Ljava.lang.Class; > componentType java.lang.Class > constructors [Ljava.lang.reflect.Constructor; > declaredAnnotations [Ljava.lang.annotation.Annotation; > declaredClasses [Ljava.lang.Class; > declaredConstructors [Ljava.lang.reflect.Constructor; > declaredFields [Ljava.lang.reflect.Field; > declaredMethods [Ljava.lang.reflect.Method; > declaringClass java.lang.Class > enclosingClass java.lang.Class > enclosingConstructor java.lang.reflect.Constructor > enclosingMethod java.lang.reflect.Method > enum boolean > enumConstants [Ljava.lang.Object; > fields [Ljava.lang.reflect.Field; > genericInterfaces [Ljava.lang.reflect.Type; > genericSupercl ass java.lang.reflect.Type > interface boolean > interfaces [Ljava.lang.Class; > localClass boolean > memberClass boolean > methods [Ljava.lang.reflect.Method; > modifiers int > name java.lang.String > package java.lang.Package > primitive boolean > protectionDomain java.security.ProtectionDomain > signers [Ljava.lang.Object; > simpleName java.lang.String > superclass java.lang.Class > synthetic boolean > typeParameters [Ljava.lang.reflect.TypeVariable; > > _ Windows Live™ SkyDrive: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_032009=
Config-browser properties tab broken (2.1.6)
I find it doesn't matter which action you are looking at -- you get the same list of 38 key-value pairs which are clearly not the bean properties of your action. The list is pasted below: It looks very much like we are getting the bean properties of some Class object ...? Chris M annotation boolean annotations [Ljava.lang.annotation.Annotation; anonymousClass boolean array boolean canonicalName java.lang.String classLoader java.lang.ClassLoader classes [Ljava.lang.Class; componentType java.lang.Class constructors [Ljava.lang.reflect.Constructor; declaredAnnotations [Ljava.lang.annotation.Annotation; declaredClasses [Ljava.lang.Class; declaredConstructors [Ljava.lang.reflect.Constructor; declaredFields [Ljava.lang.reflect.Field; declaredMethods [Ljava.lang.reflect.Method; declaringClass java.lang.Class enclosingClass java.lang.Class enclosingConstructor java.lang.reflect.Constructor enclosingMethod java.lang.reflect.Method enum boolean enumConstants [Ljava.lang.Object; fields [Ljava.lang.reflect.Field; genericInterfaces [Ljava.lang.reflect.Type; genericSuperclass java.lang.reflect.Type interface boolean interfaces [Ljava.lang.Class; localClass boolean memberClass boolean methods [Ljava.lang.reflect.Method; modifiers int name java.lang.String package java.lang.Package primitive boolean protectionDomain java.security.ProtectionDomain signers [Ljava.lang.Object; simpleName java.lang.String superclass java.lang.Class synthetic boolean typeParameters [Ljava.lang.reflect.TypeVariable;
Re: Type conversion exceptions
No problem -- I have learnt plenty from others too. Cheers Chris M. -Original Message- From: ryangr To: user@struts.apache.org Sent: Fri, 20 Mar 2009 5:12 am Subject: Re: Type conversion exceptions Well I'll be damned...it's working! It looks like the solution was to remove the *-conversion.properties entries and then change this in SettingAction: public void setSettings(SettingList settings) { this.settings = settings; } public SettingList getSettings() { return settings; } to: public void setSettings(List settings) { this.settings = new SettingList(); for (Setting setting : settings) { this.settings.add(setting); } } public List getSettings() { return settings; } I probably would never have tried the List approach, I am in your debt! Thanks for taking the time to work with it a bit, I appreciate it as it was driving me nuts! You get free drinks if I go to Japan or you come to the States... Cheers, Ryan musomesa wrote: > > > I got your code to run (paseted below). Just so I am sure I am doing what > you are trying to do: > > 1. I made no changes to Setter or SetterList so that I don't break your > design. Only to the action and the jsp > 2. I assume what you want is to be able to display and edit and create the > settings (I did not do delete)? > 3. I assume you are using Struts 2.1.6 (I should have asked -- sorry) > > > Some observations: > 1. You don't need a converter at all. > Why? Because you are sending the title and value as separate Strings and > want to create a Settings object with those items as its state. > Instantiating an object and injecting it with a couple of Strings does not > require a converter. If you have a String representation of the Setting as > a whole (e.g. "theTitle&theValue) then you would need a converter to parse > the String and create a Setting object. > > 2. You don't need entries in *-converters.xml > Why? Becaus of 1. > > 3. You don't need to expose?a property of type StringList. > Why? Your JSP only uses the fact that it is a List. StringList is > an implementation. So you only need a getter/setter that returns/takes a > ?List? > > Note: I am posting from Japan and I noticed I som etimes get characters > that are non-printing here appearing in the paste -- I think it is the > encoding so please clean it up if that happens > > Action: > > public class SettingAction extends ActionSupport { > ?private static final long serialVersionUID = -7082992787920559583L; > ?private Setting newSetting; > ?private SettingList settings = new SettingList(); > > ?public String execute() { > ??if (newSetting != null) { > ???//give it an id > ???newSetting.setId("" + settings.size()); > ???settings.add(newSetting); > ??} > ??return SUCCESS; > ?} > > > ?public void setSettings(List settings) { > ??this.settings = new SettingList(); > ??for (Setting setting : settings) { > ???this.settings.add(setting); > ??} > ?} > > > ?public List getSettings() { > ??return settings; > ?} > > > ?public Setting getNewSetting() { > ??return newSetting; > ?} > > > ?public void setNewSetting(Setting newSetting) { > ??this.newSetting = newSetting; > ?}; > > } > > > JSP: > > > ? > ?? > ??? > name='settings[].title' > value='' type="hidden" /> > > '> > : > ??? > ??? > name='settings[].value' > value='' /> > ?? > ? > ? > ? > ? > ? > > > > Cheers > Chris M > > > > > -Original Message- > From: ryangr > To: user@struts.apache.org > Sent: Wed, 18 Mar 2009 10:55 pm > Subject: Re: Type conversion exceptions > > > > > > Here is the converter code: http://pastie.org/41 9709 > > Obviously it isn't doing anything other than outputting the values being > passed in, but none of the values contain anything yet as the parameters > are > getting lost somewhere so there's no point in processing them yet. > > > > musomesa wrote: >> >> I have downloaded your code and will study it so that I don't >> misunderstand. Can you also post the converter? >> If I see it I might?suggestions that fit what you are doing better. >> Chris >> > > -- > View this message in context: > http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.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 > > > > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22608399.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: Type conversion exceptions
I got your code to run (paseted below). Just so I am sure I am doing what you are trying to do: 1. I made no changes to Setter or SetterList so that I don't break your design. Only to the action and the jsp 2. I assume what you want is to be able to display and edit and create the settings (I did not do delete)? 3. I assume you are using Struts 2.1.6 (I should have asked -- sorry) Some observations: 1. You don't need a converter at all. Why? Because you are sending the title and value as separate Strings and want to create a Settings object with those items as its state. Instantiating an object and injecting it with a couple of Strings does not require a converter. If you have a String representation of the Setting as a whole (e.g. "theTitle&theValue) then you would need a converter to parse the String and create a Setting object. 2. You don't need entries in *-converters.xml Why? Becaus of 1. 3. You don't need to expose?a property of type StringList. Why? Your JSP only uses the fact that it is a List. StringList is an implementation. So you only need a getter/setter that returns/takes a ?List? Note: I am posting from Japan and I noticed I sometimes get characters that are non-printing here appearing in the paste -- I think it is the encoding so please clean it up if that happens Action: public class SettingAction extends ActionSupport { ?private static final long serialVersionUID = -7082992787920559583L; ?private Setting newSetting; ?private SettingList settings = new SettingList(); ?public String execute() { ??if (newSetting != null) { ???//give it an id ???newSetting.setId("" + settings.size()); ???settings.add(newSetting); ??} ??return SUCCESS; ?} ?public void setSettings(List settings) { ??this.settings = new SettingList(); ??for (Setting setting : settings) { ???this.settings.add(setting); ??} ?} ?public List getSettings() { ??return settings; ?} ?public Setting getNewSetting() { ??return newSetting; ?} ?public void setNewSetting(Setting newSetting) { ??this.newSetting = newSetting; ?}; } JSP: ? ?? ??? '> : ??? ??? ?? ? ? ? ? ? Cheers Chris M -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 10:55 pm Subject: Re: Type conversion exceptions Here is the converter code: http://pastie.org/419709 Obviously it isn't doing anything other than outputting the values being passed in, but none of the values contain anything yet as the parameters are getting lost somewhere so there's no point in processing them yet. musomesa wrote: > > I have downloaded your code and will study it so that I don't > misunderstand. Can you also post the converter? > If I see it I might?suggestions that fit what you are doing better. > Chris > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.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: Type conversion exceptions
I have downloaded your code and will study it so that I don't misunderstand. Can you also post the converter? If I see it I might?suggestions that fit what you are doing better. Chris -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 18 Mar 2009 6:10 pm Subject: Re: Type conversion exceptions 2009/3/18 : > But then how do you plan to write a converter to convert a String[] to a SettingList? It's already done, just to the configuration has to be adjusted > Also why is aggregation a bad design? It isn't but exposing directly internal field (ArrayList) it is. 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
Re: Type conversion exceptions
But then how do you plan to write a converter to convert a String[] to a SettingList? Also why is aggregation a bad design? Regards Chris M -Original Message- From: Lukasz Lenart To: Struts Users Mailing List Sent: Wed, 18 Mar 2009 5:50 pm Subject: Re: Type conversion exceptions 2009/3/18 : > My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it aggregation so that SettingList has a property of type ArrayList and your type conversion problems will go away. In such case SettingList is useless, it will be bad design 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
Re: Type conversion exceptions
My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it aggregation so that SettingList has a property of type ArrayList and your type conversion problems will go away. Chris -Original Message- From: ryangr To: user@struts.apache.org Sent: Wed, 18 Mar 2009 6:59 am Subject: Re: Type conversion exceptions Okay, I'm officially very confused as to what should and shouldn't be used since apparently the documentation example is not correct. Let me level set with what each of my files contains again: [xwork-conversion.properties] Element_settings=com.rjssoft.webdocs.setting.Setting According to the documentation, this tells the settings element that it is supposed to contain Setting objects which is true and needs to be in the conversion properties. [Setting.java] See this link for the code: http://pastie.org/419187 [SettingList.java] See this link for the code: http://pastie.org/419190 SettingLists are simple ArrayLists containing Setting beans. [SettingAction.java] See this link for the code: http://pastie.org/419191 The relevant section is where we go from the view.jsp, submit the form which then tries to call the update() method of SettingAction...it never gets there because it throws the exceptions noted in previous emails. [view.jsp] See this link for the relevant code: http://pastie.org/419192 What am I missing that isn't in the documentation or is incorrect? Ryan Lukasz Lenart wrote: > > 2009/3/17 ryangr : >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting > > What this is for? > >> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter > > This tells Xwork which converter to call if it will need to convert > Array to SettingList > > > 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/Type-conversion-exceptions-tp22497261p22568785.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional com mands, e-mail: user-h...@struts.apache.org