[s2] Different Annotated Validations for different action methods
Hey all, I'm trying to figure out how to validate my action methods differently. For example I've got a modeldriven User bean with the following two annotated methods @Validations(...) - processLogin @Validations(...) - processSignup Now I want the first annotation to only check for the username and password, but the second annotation is supposed to check for other things like email too. However when I call the appropriate action mapping which calls processSignup it processes both Validations, which results in a invalid email address error for the login in addition to the wrong username and password. So how can I separate the two validatio annotations without needing separate classes? - Thilo -- Mit freundlichen Grüßen, Thilo Ettelt Telefon: +49-421-6265-111 Carmunity.com GmbHTelefax: +49-421-6265-100 Mary-Astell-Strasse 2 E-Mail: [EMAIL PROTECTED] 28359 Bremen http://www.carmunity.de/ Developer (YourVids) Handelsregisternummer: HRB 19256 beim AG Bremen Geschäftsführer: Dipl.-Wirt.-Ing. W. Schlösser Dipl-Ing. Frank Rothgänger Bennet Bock - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Easy way to obtain an action's full url?
Hello, is there a simple way to obtain a full url for an Action mapping? Something like this: public String urlForActionMapping(String mapping) { // mapping = myaction/wildcardhere/view // returns http://host:port/context/myaction/wildcardhere/ view.action ... } - Thilo -- Mit freundlichen Grüßen, Thilo Ettelt Telefon: +49-421-6265-111 Carmunity.com GmbHTelefax: +49-421-6265-100 Mary-Astell-Strasse 2 E-Mail: [EMAIL PROTECTED] 28359 Bremen http://www.carmunity.de/ Developer (YourVids) Handelsregisternummer: HRB 19256 beim AG Bremen Geschäftsführer: Dipl.-Wirt.-Ing. W. Schlösser Dipl-Ing. Frank Rothgänger Bennet Bock - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help - pagination using struts2
Hello DharmaRao, take a look at the s:iterator and s:subset Tag. They allow you to iterate over a list for example and also take subsets out of it. http://struts.apache.org/2.0.11/docs/tag-reference.html - Thilo [EMAIL PROTECTED] wrote: HI I am not able to find out pagination using Struts2. Is there any tag lib ( which is similar to struts layout in Struts 1.x) available in Struts2. Could any one guide me or send me some sample code. thanks and regards DharmaRao This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how can i get my servlet result to jsp page
Access the ValueStack in your action, it allows you to store objects and you can retrieve them from your jsp. You might need to know about the ActionContext object accessable from your action. Read more from the docs :) - Thilo vijay vijay wrote: Hi i am writting a database connectionin action, here i wanted to put tth result back in to a jsp page. in jsp what i need to write any one help me here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how can i get my servlet result to jsp page
I forgot to ask are you using Struts 1 or 2? In any case you should define your action mappings in the struts.xml. There you will define the different jsp results for your action. I don't think you need the requestdispatcher for that? - Thilo vijay vijay wrote: Hi i am having small requirement like i have to connect to db from db i have select ted the emp table from there i need to show that result in my jsp.ihave written java code like this below in action .here i am not able to knw how to proceed from here can u help me here * public* *class* DbConnect { String result=*null*,SUCCESS; *public* String execute() { *try*{ Connection con; Class.*forName*(oracle.jdbc.driver.OracleDriver).newInstance(); con=DriverManager.*getConnection*(jdbc:oracle:thin:@192.168.0.186 :1521:earchive,scott,tiger); Statement stmt=con.createStatement(); ResultSet rs = stmt.executeQuery(select * from emp); *if*(rs.next()) { System.*out*.println(rs.getString(1)); System.*out*.println(rs.getString(2)); System.*out*.println(rs.getString(3)); System.*out*.println(rs.getString(4)); result=SUCCESS; *return* result; } // RequestDispatcher requestDispatcher=getServletContext().getRequestDispatcher(/test.jsp); //requestDispatcher.forward(request,response); } *catch*(Exception e){ e.printStackTrace(); } *return* result; On 11/16/07, Thilo Ettelt [EMAIL PROTECTED] wrote: sure, in your action method you can define: ValueStack stack = ActionContext.getContext().getValueStack(); and then fill whatever object you have into the valuestack: String sample = Hello World; stack.set(myIdentifier, sample); In your JSP you can use the s:property tag to display your String in this case: s:property value=myIdentifier/ you can put any ognl expression into the value part, read the docs for more info on ognl. for example you could have put an array onto the stack and call the object at index 5 by using: s:property value=myIdentifierArray[5]/ You can also call methods like this method of a String object: s:property value=myIdentifier.toLowerCase/ - Thilo vijay vijay wrote: Hi can u give me some sample code to me On 11/16/07, Thilo Ettelt [EMAIL PROTECTED] wrote: Access the ValueStack in your action, it allows you to store objects and you can retrieve them from your jsp. You might need to know about the ActionContext object accessable from your action. Read more from the docs :) - Thilo vijay vijay wrote: Hi i am writting a database connectionin action, here i wanted to put tth result back in to a jsp page. in jsp what i need to write any one help me here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how can i get my servlet result to jsp page
sure, in your action method you can define: ValueStack stack = ActionContext.getContext().getValueStack(); and then fill whatever object you have into the valuestack: String sample = Hello World; stack.set(myIdentifier, sample); In your JSP you can use the s:property tag to display your String in this case: s:property value=myIdentifier/ you can put any ognl expression into the value part, read the docs for more info on ognl. for example you could have put an array onto the stack and call the object at index 5 by using: s:property value=myIdentifierArray[5]/ You can also call methods like this method of a String object: s:property value=myIdentifier.toLowerCase/ - Thilo vijay vijay wrote: Hi can u give me some sample code to me On 11/16/07, Thilo Ettelt [EMAIL PROTECTED] wrote: Access the ValueStack in your action, it allows you to store objects and you can retrieve them from your jsp. You might need to know about the ActionContext object accessable from your action. Read more from the docs :) - Thilo vijay vijay wrote: Hi i am writting a database connectionin action, here i wanted to put tth result back in to a jsp page. in jsp what i need to write any one help me here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: access to bean property in struts2
You can expose a property or bean to the JSP Expression language (${myPropertyOrBean}) by using s:set taglib. - Thilo slideharmony wrote: ok, but I read somewhere that I can do that without setting a property User in my action, using the action stack, or something like this, I believed that last action I have used should be available, or not? Hernandez, David wrote: Set the Bean as a member of the Action class and use: s:property value=beanVarName.beanMemberName / -Original Message- From: slideharmony [mailto:[EMAIL PROTECTED] Sent: Thursday, November 15, 2007 11:28 AM To: user@struts.apache.org Subject: access to bean property in struts2 Hello, how can I access a bean properties from a jsp page? I have created an action to creare a new account for a generic user, and I want to print in a jsp page the full name of the new user. Usually I put the new User object in session and obtained his properties by this way form the jsp page, but probably there is some other way with strut2. thank you -- View this message in context: http://www.nabble.com/access-to-bean-property-in-struts2-tf4815028.html# a13774814 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how can I set autoreload of struts.xml in struts2
I think you have to tell your container to watch certain resources. (WatchedResource in Tomcat; http://tomcat.apache.org/tomcat-5.5-doc/config/context.html for example) - Thilo slideharmony wrote: I need to know how can I set autoreload of struts.xml in struts2, without restarting the container every time. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] How can I access the RequestMap from an Interceptor?
I'm sorry I didn't make it clear enough. I do not want to access the parameters. I would like to access all attributes of a request (i.e. remote host, request uri, headers, etc) and I thought Struts2 would wrap that up in a servlet independent map so I don't have to depend on Servlet specific stuff. Does it make sense to be servlet independent in this case anyway? - Thilo Gary Affonso wrote: Thilo Ettelt wrote: Yes, I know :) But I don't want to depend on HttpServletRequest. I would like to have the Request*Map*. Unfortunetely from looking at the code I only found out how to contruct a RequestMap from a HttpServletRequest. Omkar showed you how to get to the invocationContext(). From there isn't it just... invocationContext.getParameters() The API for ActionContext.getParameters() indicates: Returns a Map of the HttpServletRequest parameters when in a servlet environment or a generic Map of parameters otherwise. To be more specific, it should give you a generic map of name/value pairs. When in a servlet environment that map mirrors the request map (but is *not* the raw request params). That's what you want, right? - Gary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] How can I access the RequestMap from an Interceptor?
Hey, somehow I can't find a way to access the RequestMap from within an Interceptor. What is the right way? - Thilo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] How can I access the RequestMap from an Interceptor?
Yes, I know :) But I don't want to depend on HttpServletRequest. I would like to have the Request*Map*. Unfortunetely from looking at the code I only found out how to contruct a RequestMap from a HttpServletRequest. Isn't there some kind of function that provides me with the Map? (Except the IoC RequestAware interface which only works for Actions) - Thilo Omkar patil wrote: Thilo, You can directly access an HttpServletRequest in the Interceptor using following - ActionContext ac = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST); - Omkar Thilo Ettelt wrote: Hey, somehow I can't find a way to access the RequestMap from within an Interceptor. What is the right way? - Thilo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] s:url and wildcards
I have noticed that it doesn't seem to be possible to construct a wildcard action using s:url, is that correct? Or am I doing something wrong? s:url action='/content/'+someID+'/view' id=testURL/ The corresponding action would be mapped like content/*/view. This will output an URL like /content/'+someID+'/view', instead of /content/100/view.action Please help, thx in advance, Thilo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S.2.1] Wildcard Mappings + Struts s:url tag
Hello, I'm new to this list. I've learned a lot from the Confluence, but I couldn't figure out how to reassemble an wildcard action mapping using the s:url. I figured that when there is an wildcard action and it can put parts of the request uri into my action bean or result string, then how can I put my attributes into an action URL using s:url tag? This didn't work: s:url action=calendar/work/*/*/view id=myShinyURL s:param name=page value=1/ s:param name=time value=month/ /s:url It just append two parameters. Isn't there a way to somehow reverse creating a wildcard mapped URL, meaning Struts assembles the right URL using the Wildcard settings and not regular parameters? Thx in advance. - Thilo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S.2.1] Wildcard Mappings + Struts s:url tag
Ok, how embarassing. Struts 1 got me trapped in this one, thus I considered that I'd have to pass the same action name as specified in the action mappings. Which is stupid of me because now it's Struts 2 and now it's Wildcards. ;) Using: s:url action=calendar/work/%{var1}/%{var2}/view id=myShinyURL/ solved my problem easily... - Thilo Thilo Ettelt wrote: Hello, I'm new to this list. I've learned a lot from the Confluence, but I couldn't figure out how to reassemble an wildcard action mapping using the s:url. I figured that when there is an wildcard action and it can put parts of the request uri into my action bean or result string, then how can I put my attributes into an action URL using s:url tag? This didn't work: s:url action=calendar/work/*/*/view id=myShinyURL s:param name=page value=1/ s:param name=time value=month/ /s:url It just append two parameters. Isn't there a way to somehow reverse creating a wildcard mapped URL, meaning Struts assembles the right URL using the Wildcard settings and not regular parameters? Thx in advance. - Thilo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]