Re: Type conversion questions
Hello Martin, this would be ok, but that method doesn't exist in StrutsTypeConverter as of struts 2.0.11, and most likely the framework won't call it when I implement it. Or am I missing something? Daniel Martin Gainty wrote: package org.apache.struts2.showcase.conversion public class EnumTypeConverter extends StrutsTypeConverter { //old methods.. //new method to convert map contents to Strings.. @Override public String[] convertToStrings(Map context, Object o) { int j=0; Strings[] s; List l = (List) o; String result =; for (Iterator i = l.iterator(); i.hasNext(); ) { s[j++]=i.next(); } return s; } //...other methods.. } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Jeromy Evans wrote: [...] Now my questions: 1. extending StrutsTypeConverter forces me to implement String convertToString(Map context, Object o). I think there is no common sense way of converting a collection back to a String in this context. It would, maybe, make sense to convert it to a String[]. But what I actually want is to have access to the unconverted collection in the JSP. This might seem strange from some point of view, and I could live without it, but is there a way to do this? Example: [...] It does really follow the intended contract of the interface, but I don't see why convertFromString can't return a different view of the object than convertToString. Have you tried it? This effectively gives you the databinding feature of ASP.net (which I personally cringe at, but can't argue with how productive it is to work with) Hi Jeromy, the problem here is that convertToString only allows returning .. a String. Accessing myObjects in a JSP would always call converter.convertToString(context, myaction.getMyObjects()) (as far as I can tell). So this way I can't return a collection of objects where I could, for example, iterate over. Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2 connection pooling using MySQL
Hi All, Since struts1 has connection pooling mechanism using data-source/ tag,what is the procedure of connection pooling mechanism in struts2? Can we do tht using bean class=/ tag?I have seen from some of the search results for oracle db using class:oracle.jdbc.pool.OracleConnectionCacheImpl. But I need to connect to MySQL database,how to implement connection pooling in struts.xml for mysql database? Please reply as soon as possible. Thanks. -- View this message in context: http://www.nabble.com/Struts2-connection-pooling-using-MySQL-tp15584715p15584715.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Hi Jeromy, Jeromy Evans wrote: Daniel Baldes wrote: [...] 2. Is there a way to define a type converter application wide, like always use this type converter for setting types which are subclasses of X and for setting types which are Collectionsubclass-of-X? This way I could define the type converter once for all persistence-capable classes. classpath:xwork-converters.properties allows you to define global converters by class name. You may be able to the the element_ feature for collections. Otherwise visitor validation will have to do I found out that this line in xwork-conversion.properties is sufficient to define my custom converter for all subclasses AND collections of subclasses: com.acme.SuperClass = com.acme.CustomConverter Perfect - this is what I need. Thanks for your Help, Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Daniel Baldes wrote: the problem here is that convertToString only allows returning .. a String. Accessing myObjects in a JSP would always call converter.convertToString(context, myaction.getMyObjects()) (as far as I can tell). So this way I can't return a collection of objects where I could, for example, iterate over. Daniel Ah, I see the problem better now. In your select: s:select multiple=true name=myObjects list=myObjects listKey=id listValue=name / you're trying to access myObjects as both a list of objects (list=) and as a string (name=). You can't do what you're describing because convertToString needs to provide the currently selected value for the select. I presume you don't really mean that, but rather want: s:select multiple=true name=mySelectedObject list=myObjects listKey=id listValue=name / where mySelectObject is the same class as the elements in the list, and type conversion ensures that the select contains id:name and sees just the selected object loaded from persistence and provides a list of objects loaded from persistence (no handling of strings what-so-ever). If I've misunderstood let me know. Posting to your action: When the params interceptor is invoked, it calls your custom converter with the selected id value. Your converter looks up the entity in the convertFromString method and returns the Object. The params interceptor sets this object in your action. Perfect Rendering the view: The options in the select are populated by calls to convertToString on each element in the list. The currently selected value is also populated by a call to convertToString on mySelectedObject So, you definitely can't mix purposes here. --- There has been talk on the developer list about providing a better model for selects so your action doesn't have to provide the list of possible values, and more importantly, the list of values is available after a validation error without any further effort by your action. Nothing has progressed AFAIK though. Hope that was helpful and on track. regards, Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Map instead of List in action
Change your property/method signatures from List... persons = new SomeList...(); public List getMap(); public void setMap(List value); to MapLong, Person persons = new HashMapLong, Person(); public MapLong, Person getMap(); public void setMap(MapLong, Person value); L. Sessizlik wrote: Hi Musachy, Thank you for your response, I am sorry but I can understand how to change getter and setter. How should be signatures of getter and setter? Just changing return type should not be enough ? Best Regards Sessizlik Musachy Barroso wrote: Change the setter and getter and access the map like: s:property value=map[id].prop.prop / musachy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: is session efficient way to persist the action properties
Prashant Khanal wrote: Hello all, I have two jsp pages say Page1 and Page2 backed by their corresponding action. When the Page1 is first loaded the corresponding action's prepare() method is used to provide the data for the page based on the parameter sent by the page that precedes the Page1. Upon submit the user is navigated to Page2 and upon submit on that page(Page2) the user is navigated back to Page1. Now the parameter used to provide the data for Page1 is lost as it was provided by another page. So Is there any way that i can persist the action properties during this process. Is session only efficient way to do that or is there any alternative? I have been using session to store the properties for now. You have at least a couple of choices: 1) use the session 2) propagate the parameter sent to Page1 by placing it as a hidden field in Page2 The second option may require additional work to pass the parameter from Page1 to Page2 back to Page1 again, but may simplify Page1's logic for using the data, since it can always find it in the same place (the request parameters) rather than having to check two places (the request parameters and the session). L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Hi Jeromy, Jeromy Evans wrote: Ah, I see the problem better now. In your select: s:select multiple=true name=myObjects list=myObjects listKey=id listValue=name / you're trying to access myObjects as both a list of objects (list=) and as a string (name=). You can't do what you're describing because convertToString needs to provide the currently selected value for the select. I presume you don't really mean that, but rather want: s:select multiple=true name=mySelectedObject list=myObjects listKey=id listValue=name / where mySelectObject is the same class as the elements in the list, and type conversion ensures that the select contains id:name and sees just the selected object loaded from persistence and provides a list of objects loaded from persistence (no handling of strings what-so-ever). Sorry, now I see that my example was misleading. Let me try again: F.e. I would want to display a list of myObjects, and a multiple select box where you can modify the list. List: s:iterator value=myObjects var=o ${o.name}/s:iterator Select: s:select multiple=true name=myObjects list=availableMyObjects listKey=id listValue=name / This way, the iterator would need to get a collection from getMyObjects() (without type conversion), but the select would send IDs which needed to be converted. Now the funny thing is that this seems to work. I got all sorts of exceptions at first, but they don't seem to be related to conversion. Thanks for all your help, and I'm sorry for wasting your time on this one. I'll get back when I find the real problem, should it be related to struts. Daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Laurie Harper wrote: Daniel Baldes wrote: [...] [...] s:select multiple=true name=myObjects list=myObjects listKey=id listValue=name / This way I could use getMyObjects() for displaying my objects and setMyObjects() for setting them (using only their IDs). Doesn't this imply that the myObjects property represents both the set of values that can be selected *and* the set of values that is / has been selected? What would happen if the user made their selection(s) and submitted the form, and the form was re-displayed due to a validation error? Maybe I'm missing the pattern, but this doesn't seem right to me :=) L. This example was actually misleading, I'm sorry. Please just ignore this part of my post, the problem may be non-existent ;-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Daniel Baldes wrote: [...] 1. extending StrutsTypeConverter forces me to implement String convertToString(Map context, Object o). I think there is no common sense way of converting a collection back to a String in this context. It would, maybe, make sense to convert it to a String[]. But what I actually want is to have access to the unconverted collection in the JSP. This might seem strange from some point of view, and I could live without it, but is there a way to do this? Example: s:select multiple=true name=myObjects list=myObjects listKey=id listValue=name / This way I could use getMyObjects() for displaying my objects and setMyObjects() for setting them (using only their IDs). Doesn't this imply that the myObjects property represents both the set of values that can be selected *and* the set of values that is / has been selected? What would happen if the user made their selection(s) and submitted the form, and the form was re-displayed due to a validation error? Maybe I'm missing the pattern, but this doesn't seem right to me :=) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Type conversion questions
Now the funny thing is that this seems to work. I got all sorts of exceptions at first, but they don't seem to be related to conversion. Thanks for all your help, and I'm sorry for wasting your time on this one. I'll get back when I find the real problem, should it be related to struts. Daniel No problem, no time wasted. Your technique has given me some ideas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
RajiR wrote: Can't we implement connection pooling in struts2 alone?If so ,may I know the reason please...!!! Thanks. Struts 2 itself doesn't provide a connection pooling implementation and probably shouldn't. MySql provide a pooled DataSource that you can use immediately. Set it up the same way as your current DataSource http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html Does that help? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
hi there i got a too many connection when try use spring-hibernate with struts2 and this is not struts2 problem i think the connection pool is not struts2 responsibility as the controller and if we use spring, this will become injection work with the database tech like ORM ot JDBC F - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
Can't we implement connection pooling in struts2 alone?If so ,may I know the reason please...!!! Thanks. nuwan chandrasoma-2 wrote: Hi, Why do not you give a try with Spring. as struts2 has built in support for spring, you can use springs connection pooling very easily. Thanks, Nuwan. RajiR wrote: Hi All, Since struts1 has connection pooling mechanism using data-source/ tag,what is the procedure of connection pooling mechanism in struts2? Can we do tht using bean class=/ tag?I have seen from some of the search results for oracle db using class:oracle.jdbc.pool.OracleConnectionCacheImpl. But I need to connect to MySQL database,how to implement connection pooling in struts.xml for mysql database? Please reply as soon as possible. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts2-connection-pooling-using-MySQL-tp15584715p15586219.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
Hi, Why do not you give a try with Spring. as struts2 has built in support for spring, you can use springs connection pooling very easily. Thanks, Nuwan. RajiR wrote: Hi All, Since struts1 has connection pooling mechanism using data-source/ tag,what is the procedure of connection pooling mechanism in struts2? Can we do tht using bean class=/ tag?I have seen from some of the search results for oracle db using class:oracle.jdbc.pool.OracleConnectionCacheImpl. But I need to connect to MySQL database,how to implement connection pooling in struts.xml for mysql database? Please reply as soon as possible. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
Right. The configuration file the mysql reference refers to is the Container configuration, for example, server.xml or context.xml provided with Tomcat. Every J2EE container provides that configuration. Struts 1 provides some config to simply it, but Struts 2 doesn't provide convenience config like that. Setup your DataSource for the Container, then reference it in web.xml. eg. http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html The only issue for Struts2 users is how you access the DataSource within your actions or services. If you use Spring it's easy via DI. If you Guice it's also easy via DI. If you don't use a DI container you can look-up the DataSource every time you need it, or place the instance in your Application Context, as you'd do with a servlet. Hope that helps. RajiR wrote: Hi, In this link : http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html, we can preform connection pooling only after configuring it in our configuration files.If it is in the case of struts1, struts-config.xml file has a tag called data-source/ and there we can configure.But,what about struts2 how can we configure in its configuration file(struts.xml)?I think only after configuring in the configuration file(for eg., struts.xml in the case of struts2),we can use the connection pool using a java program as it is explained in the link provided by you.So the problem is with how to configure the pool in the struts.xml?I think I am clear...!! Thanks. Jeromy Evans - Blue Sky Minds wrote: RajiR wrote: Can't we implement connection pooling in struts2 alone?If so ,may I know the reason please...!!! Thanks. Struts 2 itself doesn't provide a connection pooling implementation and probably shouldn't. MySql provide a pooled DataSource that you can use immediately. Set it up the same way as your current DataSource http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html Does that help? - 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: Struts2 connection pooling using MySQL
Struts1 provided a data-source configuration element because, at the time that was added, there was no consistent mechanism for configuring data sources that worked across servlet containers. That changed a long time ago and Struts first deprecated, and then removed, its support for the data-source configuration element. The preferred way to set up a data source (using a connection pool or not) is through JNDI using your servlet container configuration. The article Jeromy linked to mentions JNDI and links to more detailed documentation for various servlet containers and application servers. In short: 1) configure a data source (connection pool) and expose it via JNDI, using your servlet container or application server as described in the documentation linked from that article; 2) modify any code you have that uses a data source (connection pool) to obtain it from JNDI, using the code in that article You don't need Struts2 to be able to do this for you, as there are standard mechanisms you can use instead. Of course the prior reference to Spring is a good one to look into since Spring provides all sorts of help in configuring and using data sources and the database beneath them :-) L. RajiR wrote: Hi, In this link : http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html, we can preform connection pooling only after configuring it in our configuration files.If it is in the case of struts1, struts-config.xml file has a tag called data-source/ and there we can configure.But,what about struts2 how can we configure in its configuration file(struts.xml)?I think only after configuring in the configuration file(for eg., struts.xml in the case of struts2),we can use the connection pool using a java program as it is explained in the link provided by you.So the problem is with how to configure the pool in the struts.xml?I think I am clear...!! Thanks. Jeromy Evans - Blue Sky Minds wrote: RajiR wrote: Can't we implement connection pooling in struts2 alone?If so ,may I know the reason please...!!! Thanks. Struts 2 itself doesn't provide a connection pooling implementation and probably shouldn't. MySql provide a pooled DataSource that you can use immediately. Set it up the same way as your current DataSource http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html Does that help? - 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: Using Variables with Messages in Struts
Hello Nuwan. Doing it the way you proposed defeats the purpose since I have to place this string in a bean first. I would like to retrieve this string directly from message resources and display it with the html intact. Is there any to do this? Thank you for your suggestion. - Asad On Feb 20, 2008 1:07 AM, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: Hi, why dont you try the bean:write tag with filter attribute as false. Thanks, Nuwan Jeromy Evans wrote: Oh, sorry, I assumed you were using Struts 2. That's a feature of the default tag library. Sorry, I don't know the answer for Struts 1.x Asad Habib wrote: Hello Jeromy. What tag library are you using for this? - Asad On Feb 19, 2008 11:19 PM, Jeromy Evans [EMAIL PROTECTED] wrote: You may be able to do it with s:property, disabling escaping of the html: s:property value=getText('some.key') escape=false/ Asad Habib wrote: Hello. How do I represent the following in a message resources file? Representing a string literal is easy but the following string contains a link. Can this even be done? I have used variables with the validator before but there is no validator involved in this case. Thank you. Please a href=login.jspclick here/a to sign in. - Asad - 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] - 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: Struts2 connection pooling using MySQL
eg. http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html is this connectio data source is the best implementation we are using hibernate c3p0, any suggestion F - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
Hi, In this link : http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html, we can preform connection pooling only after configuring it in our configuration files.If it is in the case of struts1, struts-config.xml file has a tag called data-source/ and there we can configure.But,what about struts2 how can we configure in its configuration file(struts.xml)?I think only after configuring in the configuration file(for eg., struts.xml in the case of struts2),we can use the connection pool using a java program as it is explained in the link provided by you.So the problem is with how to configure the pool in the struts.xml?I think I am clear...!! Thanks. Jeromy Evans - Blue Sky Minds wrote: RajiR wrote: Can't we implement connection pooling in struts2 alone?If so ,may I know the reason please...!!! Thanks. Struts 2 itself doesn't provide a connection pooling implementation and probably shouldn't. MySql provide a pooled DataSource that you can use immediately. Set it up the same way as your current DataSource http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html Does that help? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts2-connection-pooling-using-MySQL-tp15584715p15586542.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
Ok,,thx for the repliesi'll try using JNDI and with spring integration.I have worked using struts2+hibernate,it works fine.. Laurie Harper wrote: Struts1 provided a data-source configuration element because, at the time that was added, there was no consistent mechanism for configuring data sources that worked across servlet containers. That changed a long time ago and Struts first deprecated, and then removed, its support for the data-source configuration element. The preferred way to set up a data source (using a connection pool or not) is through JNDI using your servlet container configuration. The article Jeromy linked to mentions JNDI and links to more detailed documentation for various servlet containers and application servers. In short: 1) configure a data source (connection pool) and expose it via JNDI, using your servlet container or application server as described in the documentation linked from that article; 2) modify any code you have that uses a data source (connection pool) to obtain it from JNDI, using the code in that article You don't need Struts2 to be able to do this for you, as there are standard mechanisms you can use instead. Of course the prior reference to Spring is a good one to look into since Spring provides all sorts of help in configuring and using data sources and the database beneath them :-) L. RajiR wrote: Hi, In this link : http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html, we can preform connection pooling only after configuring it in our configuration files.If it is in the case of struts1, struts-config.xml file has a tag called data-source/ and there we can configure.But,what about struts2 how can we configure in its configuration file(struts.xml)?I think only after configuring in the configuration file(for eg., struts.xml in the case of struts2),we can use the connection pool using a java program as it is explained in the link provided by you.So the problem is with how to configure the pool in the struts.xml?I think I am clear...!! Thanks. Jeromy Evans - Blue Sky Minds wrote: RajiR wrote: Can't we implement connection pooling in struts2 alone?If so ,may I know the reason please...!!! Thanks. Struts 2 itself doesn't provide a connection pooling implementation and probably shouldn't. MySql provide a pooled DataSource that you can use immediately. Set it up the same way as your current DataSource http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html Does that help? - 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] -- View this message in context: http://www.nabble.com/Struts2-connection-pooling-using-MySQL-tp15584715p15587014.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 connection pooling using MySQL
dont forget to share the code. Thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get method name in interceptor
Hi, I'm trying to access the ActionMapping from an interceptor, like the following test stub: public String intercept(ActionInvocation invocation) throws Exception { ActionMapping am=ServletActionContext.getActionMapping(); log.info(The method is +am.getMethod()); return invocation.invoke(); } According to the javadocs am.getMethod() should return a String (the method), but for some reason am.getMethod() always returns null. The am.getName() and am.getNamespace() methods seem to work correctly however. Is there a way (that works) to extract the name of the method that is going to be executed?
Re: Using Variables with Messages in Struts
If you bear in mind that it's usually best to seperate mark-up and content, then you would break the string down into smaller parts: fmt:message key=please.sign.in.part1/ a href=login.jspfmt:message key=please.sign.in.part2//a fmt:message key=please.sign.in.part3/ Then the problem is that in some languages you might break the string down differently. Ideally you would choose a different way of doing it, e.g. a href=login.jspPlease click here to sign in./a or Please click here to sign in: a href=loginimg src=nice.gif//a but if you don't have any choice in the matter, I guess you are stymied. Generally speaking, HTML in the message resources is best avoided. However it probably works with the fmt:message tag. I think I've done that before myself. My last thought is that it might be better to supply the URL to the href as a parameter fmt:message key=please.sign.infmt:paramlogin.jsp/fmt:param/fmt:message please.sign.in=Please a href={0}click here/a to sign in. - might make maintenance easier. Asad Habib on 20/02/08 11:18, wrote: Hello Nuwan. Doing it the way you proposed defeats the purpose since I have to place this string in a bean first. I would like to retrieve this string directly from message resources and display it with the html intact. Is there any to do this? Thank you for your suggestion. - Asad On Feb 20, 2008 1:07 AM, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: Hi, why dont you try the bean:write tag with filter attribute as false. Thanks, Nuwan Jeromy Evans wrote: Oh, sorry, I assumed you were using Struts 2. That's a feature of the default tag library. Sorry, I don't know the answer for Struts 1.x Asad Habib wrote: Hello Jeromy. What tag library are you using for this? - Asad On Feb 19, 2008 11:19 PM, Jeromy Evans [EMAIL PROTECTED] wrote: You may be able to do it with s:property, disabling escaping of the html: s:property value=getText('some.key') escape=false/ Asad Habib wrote: Hello. How do I represent the following in a message resources file? Representing a string literal is easy but the following string contains a link. Can this even be done? I have used variables with the validator before but there is no validator involved in this case. Thank you. Please a href=login.jspclick here/a to sign in. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get method name in interceptor
download the breadcrumb http://strutsschool.com/downloads/downloads.actioninterceptor and look at the intercept method. You will see what's happening right away. On Wed, Feb 20, 2008 at 5:40 AM, Toni Lyytikäinen [EMAIL PROTECTED] wrote: Hi, I'm trying to access the ActionMapping from an interceptor, like the following test stub: public String intercept(ActionInvocation invocation) throws Exception { ActionMapping am=ServletActionContext.getActionMapping(); log.info(The method is +am.getMethod()); return invocation.invoke(); } According to the javadocs am.getMethod() should return a String (the method), but for some reason am.getMethod() always returns null. The am.getName() and am.getNamespace() methods seem to work correctly however. Is there a way (that works) to extract the name of the method that is going to be executed? -- Scott [EMAIL PROTECTED]
Struts version
Hello. I want to show on the first page of my web application, the struts version I use. Is there a way to extract it dynamically? Thank you. -- View this message in context: http://www.nabble.com/Struts-version-tp15589157p15589157.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Date formatting?
I just checked that there is no JSTL configuration setting to apply a format type or pattern to fmt:formatDate across the whole webapp. I need the ISO date format on 99% of dates displayed on my current app, but there is no way to change the default globally for fmt:formatDate from dateStyle=medium. It seems like a prime target for a quick taglib, to avoid using the following everywhere, with x number of errors by sloppy coders (that would be me): fmt:formatDate value=myDate pattern=-MM-dd / Or is there something I'm missing? Somewhat off-topic I realise after checking the S2 taglib reference :O Regards Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts version
2008/2/20, George Dadulescu [EMAIL PROTECTED]: Hello. I want to show on the first page of my web application, the struts version I use. Is there a way to extract it dynamically? You could try extracting if from the manifest... But what for? Antonio
Passing data to Global Error Page
I need to pass data to my global error page I am attempting to setup a global error action instead of a jsp page as i want to post a message stored in my db on the error page. The action will grab data from the db and forward to jsp I am trying: global-results result name=fatal-error type=redirect-actionerrorHandlerAction/result /global-results action name=errorHandlerAction method=errorHandler class=ErrorAction result name=errorfatal-error.jsp/result /action But this does not seem to work with any of the result types. (redirect-action, chain...) I see where you can extend ExceptionMappingInterceptor but i need to put a variable in the context somewhere. If i extend ExceptionMappingInterceptor how can a place content in the request so that my error page: global-results result name=fatal-errorfatal-error.jsp/result /global-results can access it. on error page: div class=error s:property escape=false value=errorText / /div thanks in advance for any replies jm
reflect.InvocationTargetException
Hi All, I am getting the following error in my Struts 2 application. class java.lang.reflect.InvocationTargetException : null None of my classes are showing up in the stack trace. But it is happening at the same spot in my application. Has anyone encountered this before? Any suggestons on how to fix this? Here is the beginning of the stack trace: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reflect.InvocationTargetException
--- Richard Sayre [EMAIL PROTECTED] wrote: Has anyone encountered this before? Nope (well, I mean, *I* haven't, anyway). Any suggestons on how to fix this? Post the code (and its related configuration, and the URL you're using to invoke it) that you believe should be getting executed. Is there anything else in the stack trace of interest? Is logging turned up? Is devMode on? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Update from 2.0.9 to 2.0.11
I undestand the issue, but missed the clue, I'm a bit rookie on Struts2. If EL is forbidden, should OGNL be used, or is there a cleaner solution ? It might be a stupid question, but what would be the correct way of writing s:if test=${chapter!='Library'}${chapter}/s:if without EL. I translated it to : s:if test=%{#request.chapter== Library Have I to use % and #request or other context everywhere, and can't I simply use the valueStack ? Is there a good webpage, tuto or whatever, on EL / OGNL syntax ? https://issues.apache.org/struts/browse/WW-2107 You can still use OGNL though: s:if test=%{value_here} Eric Rank - Senior Web App Engineer www.referencevault.com On Jan 3, 2008, at 3:39 AM, Michał Letyński wrote: Hi, I did an update from version 9 to 11. And after that i got a lot of errors in jsp: /According to TLD or attribute directive in tag file, attribute test does not accept any expressions /I have many expressions in s:if test=${value_here}, s:submit src=${imgPath}/save_attachment.gif etc. From version 11 is not possible to put expression into tags ?!?!? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Update-from-2.0.9-to-2.0.11-tp14594912p15590474.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Update from 2.0.9 to 2.0.11
If you have a getter for 'chapter' in your action then this should work. s:if test=%{#chapter == 'Library'} Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: jcleve [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 20 Feb 2008 07:09:26 -0800 (PST) To: user@struts.apache.org Subject: Re: Update from 2.0.9 to 2.0.11 I undestand the issue, but missed the clue, I'm a bit rookie on Struts2. If EL is forbidden, should OGNL be used, or is there a cleaner solution ? It might be a stupid question, but what would be the correct way of writing s:if test=${chapter!='Library'}${chapter}/s:if without EL. I translated it to : s:if test=%{#request.chapter== Library Have I to use % and #request or other context everywhere, and can't I simply use the valueStack ? Is there a good webpage, tuto or whatever, on EL / OGNL syntax ? https://issues.apache.org/struts/browse/WW-2107 You can still use OGNL though: s:if test=%{value_here} Eric Rank - Senior Web App Engineer www.referencevault.com On Jan 3, 2008, at 3:39 AM, Michał Letyński wrote: Hi, I did an update from version 9 to 11. And after that i got a lot of errors in jsp: /According to TLD or attribute directive in tag file, attribute test does not accept any expressions /I have many expressions in s:if test=${value_here}, s:submit src=${imgPath}/save_attachment.gif etc. From version 11 is not possible to put expression into tags ?!?!? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Update-from-2.0.9-to-2.0.11-tp14594912p15590474.html 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 email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Actions without extending ActionSupport?
Hi, I was under the impression that I could write actions without extending ActionSupport or implementing any struts2/xwork interfaces. However, I cannot figure out how to add action errors (ActionSupport.addActionError()) to an action if not extending ActionSupport. I looked at ActionContext.getContext() and ServletActionContext, but don't see a way to add action errors. Anyone know how to do this? Thank you in advance for any suggestions. -- View this message in context: http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15591064.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Update from 2.0.9 to 2.0.11
--- Randy Burgess [EMAIL PROTECTED] wrote: If you have a getter for 'chapter' in your action then this should work. s:if test=%{#chapter == 'Library'} IIRC the # is only for named objects in the stack context (like #request, #attr, etc.) so I'm not sure that will work. For example, if I have a property foo on my action I can't access it with s:property value=#foo/. Dave Randy Burgess Sr. Web Applications Developer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Actions without extending ActionSupport?
--- tom_brokaw [EMAIL PROTECTED] wrote: I was under the impression that I could write actions without extending ActionSupport or implementing any struts2/xwork interfaces. You can. Doesn't mean you'd *want* to, if you want to use functionality provided by the framework. However, I cannot figure out how to add action errors (ActionSupport.addActionError()) to an action if not extending ActionSupport. I looked at ActionContext.getContext() and ServletActionContext, but don't see a way to add action errors. Anyone know how to do this? You don't *need* to extend ActionSupport to implement ValidationAware, it's just much easier. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Is it post or get?
This is a novice question about post and get form submission and I am confused. I really appreciate if you could help me. I have included some sample codes for explanation. I have following action mappings in struts-config file action parameter=methodToCall path=/viewUsersList type=com.company.myapp.user.UserAction scope=request validate=false id=View_Users_List forward name=load path=.user.usersListView / /action action parameter=methodToCall path=/viewUserDetails type=com.company.myapp.user.UserAction name=userForm scope=request validate=false input=.user.userEdit id=View_User_Details forward name=view path=.user.userView / forward name=edit path=.user.userEdit / forward name=save path=.user.userView / /action I have following definitions in tiles-defs file definition name=.user.usersListView extends=main.layout put name=title value=My App - View Users List / put name=body value=/user/usersListView.jsp / /definition definition name=.user.userView extends=main.layout put name=title value=My App - View User Details / put name=body value=/user/userView.jsp / /definition definition name=.user.userEdit extends=main.layout put name=title value=My App - Edit User Details / put name=body value=/user/userEdit.jsp / /definition I have following methods in UserAction (which extends DispatchAction) - viewList, view, edit, save In View Users List page, I am displaying list of users and link to View User Details page using c:url and c:param. So, when I go to View User Details page, the url looks something like this ../myApp/viewUserDetails.do?methodToCall=viewuserId=1. If the Edit button is clicked on that page, it forwards to Edit User Details and the url looks like this ../myApp/viewUserDetails.do. I have hidden fields for methodToCall with value 'edit' and userId with value '1'. Everything works fine, but my point is if the user directly types ../myApp/viewUserDetails.do?methodToCall=edituserid=1, it goes to Edit User page. Is this how it should behave even if it is POST or I am misunderstanding how POST and GET works? Am I following best-practices? My userEdit.jsp looks something like this. (By default, html:form method is POST) html:form action=/viewUserDetails First Name: html:text property=firstName /br / Last Name: html:text property=lastName /br / html:hidden property=userId / html:hidden property=methodToCall value=edit / html:submit value=Save / /html:form Thank you guys.. semaj -- View this message in context: http://www.nabble.com/Is-it-post-or-get--tp15592354p15592354.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Update from 2.0.9 to 2.0.11
Yeah I apologize for the bad advice, I whipped that out too fast. It should be: s:if test=chapter == 'Library' Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Dave Newton [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 20 Feb 2008 07:55:24 -0800 (PST) To: Struts Users Mailing List user@struts.apache.org Subject: Re: Update from 2.0.9 to 2.0.11 --- Randy Burgess [EMAIL PROTECTED] wrote: If you have a getter for 'chapter' in your action then this should work. s:if test=%{#chapter == 'Library'} IIRC the # is only for named objects in the stack context (like #request, #attr, etc.) so I'm not sure that will work. For example, if I have a property foo on my action I can't access it with s:property value=#foo/. Dave Randy Burgess Sr. Web Applications Developer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it post or get?
If the user types in the URL it is a GET. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: semaj.najraham [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 20 Feb 2008 08:52:11 -0800 (PST) To: user@struts.apache.org Subject: Is it post or get? This is a novice question about post and get form submission and I am confused. I really appreciate if you could help me. I have included some sample codes for explanation. I have following action mappings in struts-config file action parameter=methodToCall path=/viewUsersList type=com.company.myapp.user.UserAction scope=request validate=false id=View_Users_List forward name=load path=.user.usersListView / /action action parameter=methodToCall path=/viewUserDetails type=com.company.myapp.user.UserAction name=userForm scope=request validate=false input=.user.userEdit id=View_User_Details forward name=view path=.user.userView / forward name=edit path=.user.userEdit / forward name=save path=.user.userView / /action I have following definitions in tiles-defs file definition name=.user.usersListView extends=main.layout put name=title value=My App - View Users List / put name=body value=/user/usersListView.jsp / /definition definition name=.user.userView extends=main.layout put name=title value=My App - View User Details / put name=body value=/user/userView.jsp / /definition definition name=.user.userEdit extends=main.layout put name=title value=My App - Edit User Details / put name=body value=/user/userEdit.jsp / /definition I have following methods in UserAction (which extends DispatchAction) - viewList, view, edit, save In View Users List page, I am displaying list of users and link to View User Details page using c:url and c:param. So, when I go to View User Details page, the url looks something like this ../myApp/viewUserDetails.do?methodToCall=viewuserId=1. If the Edit button is clicked on that page, it forwards to Edit User Details and the url looks like this ../myApp/viewUserDetails.do. I have hidden fields for methodToCall with value 'edit' and userId with value '1'. Everything works fine, but my point is if the user directly types ../myApp/viewUserDetails.do?methodToCall=edituserid=1, it goes to Edit User page. Is this how it should behave even if it is POST or I am misunderstanding how POST and GET works? Am I following best-practices? My userEdit.jsp looks something like this. (By default, html:form method is POST) html:form action=/viewUserDetails First Name: html:text property=firstName /br / Last Name: html:text property=lastName /br / html:hidden property=userId / html:hidden property=methodToCall value=edit / html:submit value=Save / /html:form Thank you guys.. semaj -- View this message in context: http://www.nabble.com/Is-it-post-or-get--tp15592354p15592354.html 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 email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Update from 2.0.9 to 2.0.11
--- Randy Burgess [EMAIL PROTECTED] wrote: Yeah I apologize for the bad advice, I whipped that out too fast. Premature explication; it happens. I get email about that all the time. It should be: s:if test=chapter == 'Library' Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Date formatting?
On Feb 20, 2008 5:48 AM, Adam Hardy [EMAIL PROTECTED] wrote: I just checked that there is no JSTL configuration setting to apply a format type or pattern to fmt:formatDate across the whole webapp. I need the ISO date format on 99% of dates displayed on my current app, but there is no way to change the default globally for fmt:formatDate from dateStyle=medium. It seems like a prime target for a quick taglib, to avoid using the following everywhere, with x number of errors by sloppy coders (that would be me): fmt:formatDate value=myDate pattern=-MM-dd / Or is there something I'm missing? Somewhat off-topic I realise after checking the S2 taglib reference :O It's a bit counter intuitive, in my opinion, but I think the way Struts 2 does this type of formatting may be just what you need. Instead of providing a dedicated tag to do formatting, the s:text tag can be pressed into service as a formatter. Basically you need to set up a property file and configure it in your struts.xml that will hold all the i18n properties for your web site. Something like: constant name=struts.custom.i18n.resources value=application/ would direct struts to look for an application.properties file on the classpath (probably in WEB-INF/classes). Then in that file you need to define the formats you care about. Since you have a default format that you want to use throughout your site, you might have something like: format.date.default={0,date,-MM-dd} Then in your .jsp pages you would simply use: s:text name=format.date.defaults:param value=%{my.date.property }//s:text Since the job of s:text is to look up strings from the properties and run them through java.text.MessageFormat, passing in any supplied parameters, the output is formatted as a date in the format you want. You can have as many different formats as you need, and you can format anything that MessageFormat can format (dates, times, numbers). Hope that helps. (*Chris*)
Re: Actions without extending ActionSupport?
I was under the impression that I could write actions without extending ActionSupport or implementing any struts2/xwork interfaces. You can. Doesn't mean you'd *want* to, if you want to use functionality provided by the framework. I want to do this so that I can minimize the coupling between my actions and struts2. JSF permits this. You still have to call a static method to add validation errors messages from actions, but at least you don't have to extend a class or implement an interface. I was hoping struts2 had a similar approach. You don't *need* to extend ActionSupport to implement ValidationAware, it's just much easier. So I *must* implement an interface (ValidationAware) or extend a struts2 class in order to add errors messages from an action. Is that accurate? thanks very much, tom -- View this message in context: http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15593697.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Actions without extending ActionSupport?
--- tom_brokaw [EMAIL PROTECTED] wrote: I said: You don't *need* to extend ActionSupport to implement ValidationAware, it's just much easier. So I *must* implement an interface (ValidationAware) or extend a struts2 class in order to add errors messages from an action. Is that accurate? If you want the framework to recognize those errors, be able to use them in tags, etc. or make decisions based on their presence (or not), use the validation framework (which expects to be able to add messages based on the ValidationAware interface) then yes. If you want to create your own framework for handling errors then you can do whatever you want. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
URL encoding question
I'm having trouble getting s:url to stop encoding a parameter. Here's a snipped of my jsp code: s:url id=couponUrl action=Buy encode=false s:param name=coup value=%{'$codeInput'}/ s:param name=c1 value=c1/ s:param name=c2 value=c2/ /s:url s:textfield title=codeInput name=codeInput/br / s:a href=%{couponUrl}Apply/s:a Despite the encode=false, the url as rendered looks like this: /sf/WML/Buy.action?c1=CFWAP2734amp;c2=CFWAP712amp;coup=%24codeInput The problem is the $ is still being encoded. Anyone have any ideas? This is a WML page, in case anyone was wondering why I'm not using a form. -Tommy http://www.motricity.com NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information of Motricity. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Date formatting?
Hi, Please check the example at http://www.roseindia.net/struts/struts2/date/struts-2-date-format.shtml Thanks Original Message: - From: Adam Hardy [EMAIL PROTECTED] Date: Wed, 20 Feb 2008 13:48:18 + To: user@struts.apache.org Subject: Date formatting? I just checked that there is no JSTL configuration setting to apply a format type or pattern to fmt:formatDate across the whole webapp. I need the ISO date format on 99% of dates displayed on my current app, but there is no way to change the default globally for fmt:formatDate from dateStyle=medium. It seems like a prime target for a quick taglib, to avoid using the following everywhere, with x number of errors by sloppy coders (that would be me): fmt:formatDate value=myDate pattern=-MM-dd / Or is there something I'm missing? Somewhat off-topic I realise after checking the S2 taglib reference :O Regards Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mail2web.com What can On Demand Business Solutions do for you? http://link.mail2web.com/Business/SharePoint - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Actions without extending ActionSupport?
Hi David, Thanks again for the reply. I'm comparing MVC frameworks right now, and wondering if struts2 has a similar feature to JSF. In JSF, an action can look like this: public class MyAction { public String deleteUser() { // Here I can inject errors for display on the JSP by writing: FacesContext.getCurrentInstance().addMessage(userNameField, Sorry, that username is unknown); return input; } } Notice MyAction inherits no JSF-specific interfaces and extends no JSF-specific classes, which is I find very desirable. Just wondering if struts2 has a way to decouple actions in this manner. Spring-MVC does not and, of course, struts1 does not. Thank you. --- tom_brokaw [EMAIL PROTECTED] wrote: I said: You don't *need* to extend ActionSupport to implement ValidationAware, it's just much easier. So I *must* implement an interface (ValidationAware) or extend a struts2 class in order to add errors messages from an action. Is that accurate? If you want the framework to recognize those errors, be able to use them in tags, etc. or make decisions based on their presence (or not), use the validation framework (which expects to be able to add messages based on the ValidationAware interface) then yes. If you want to create your own framework for handling errors then you can do whatever you want. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** IMPORTANT NOTE* The opinions expressed in this message and/or any attachments are those of the author and not necessarily those of Brown Brothers Harriman Co., its subsidiaries and affiliates (BBH). There is no guarantee that this message is either private or confidential, and it may have been altered by unauthorized sources without your or our knowledge. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice. BBH accepts no responsibility for loss or damage from its use, including damage from virus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: Is it post or get?
--- semaj.najraham [EMAIL PROTECTED] wrote: my point is if the user directly types ../myApp/viewUserDetails.do?methodToCall=edituserid=1, it goes to Edit User page. Is this how it should behave even if it is POST or I am misunderstanding how POST and GET works? You appear to be misunderstanding not how they work, but what they are. A form submission may be GET or POST. An *action* is just an action; you don't define an action as a GET or POST action. Actions (in general) it will get the parameters regardless of how the request was made. The only way an action will differentiate between the two methods is if you explicitly code different paths for the different request types. For example, you may wish to only allow POST form submissions. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts2+MyEclipse
hi all, I am using MyEclipse 6.0.1 to develop my application.but i am facing some problems in it. i followed the follwing process: 1) in the new project wizard under the option of MyEclipse--- selected Web Project 2) after this i manually put the following Jar file under the WEB-INF\lib folder commons-logging-api-1.1 freemarker-2.3.8 ognl-2.6.11 struts-core-1.3.5 xwork-2.0.4 what when i created the follwoing Action * package* com.wantii.struts; * import* com.opensymphony.xwork2.ActionSupport; * import* com.wantii.biz.Counter; * public* *class* CountableAction *extends* ActionSupport { *public* *int* getCount() { Counter count = *new* Counter(*this*.getClass().getName()); *return* count.getCount(); } The IDE is giving the following errors: 1) the import com.opensymphony.xwork2.ActionSupport can not be resolved 2)ActionSupport can not be resolved to a type. Please tell me where i am doing the mistake. Thanks Umesh }
[OT] Re: Struts2+MyEclipse
--- aum strut [EMAIL PROTECTED] wrote: struts-core-1.3.5 You should probably use an S2 library instead. The IDE is giving the following errors: 1) the import com.opensymphony.xwork2.ActionSupport can not be resolved 2)ActionSupport can not be resolved to a type. Please tell me where i am doing the mistake. You need to add the libraries to the project build path. Right-click on the project, select properties, and fix your java build path (not sure which version of Eclipse MyEclipse is using these days, but finding the right place should be fairly obvious). Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Date formatting?
--- [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Please check the example at http://www.roseindia.net/struts/struts2/date/struts-2-date-format.shtml How does that address the question? Dave From: Adam Hardy [EMAIL PROTECTED] Date: Wed, 20 Feb 2008 13:48:18 + To: user@struts.apache.org Subject: Date formatting? I just checked that there is no JSTL configuration setting to apply a format type or pattern to fmt:formatDate across the whole webapp. I need the ISO date format on 99% of dates displayed on my current app, but there is no way to change the default globally for fmt:formatDate from dateStyle=medium. It seems like a prime target for a quick taglib, to avoid using the following everywhere, with x number of errors by sloppy coders (that would be me): fmt:formatDate value=myDate pattern=-MM-dd / Or is there something I'm missing? Somewhat off-topic I realise after checking the S2 taglib reference :O Regards Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mail2web.com What can On Demand Business Solutions do for you? http://link.mail2web.com/Business/SharePoint - 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]
struts2 design question
Hi, I'm curious why the developers of struts2 chose to define constants in an interface (StrutsStatics) and then implement that interface in at least 18 classes (see http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/StrutsStatics.html). Theinterface constant pattern has been out-of-favor since at least the publication of Joshua Bloch's landmark book, Effective Java in mid-2001 (see item #17, pages 69-70). This anti-pattern is repeated in the XWork code, too (example: http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/XWorkMessages.html), and I'm wondering if it's systemic. Can anyone comment on why this particular design decision was made? Thank you. *** IMPORTANT NOTE* The opinions expressed in this message and/or any attachments are those of the author and not necessarily those of Brown Brothers Harriman Co., its subsidiaries and affiliates (BBH). There is no guarantee that this message is either private or confidential, and it may have been altered by unauthorized sources without your or our knowledge. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice. BBH accepts no responsibility for loss or damage from its use, including damage from virus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Actions without extending ActionSupport?
--- [EMAIL PROTECTED] wrote: public class MyAction { public String deleteUser() { // Here I can inject errors for display on the JSP by writing: FacesContext.getCurrentInstance().addMessage(userNameField, Sorry, that username is unknown); return input; } } Notice MyAction inherits no JSF-specific interfaces and extends no JSF-specific classes, which is I find very desirable. Well... Obviously code-coupling is bad. You're still coupled to the FacesContext, though, and in some ways I like being coupled to static methods even less because it's not injectable. Just wondering if struts2 has a way to decouple actions in this manner. Not that I know of, although it has some appeal. The ActionContext docs pretty much state what is available in the current iteration of S2/XWork. An action's errors / messages / etc. are part of the action itself, and the validation framework and the tags that retrieve those messages rely on calling those action methods for adding / retrieving the collection of messages etc. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Is it post or get?
Thank you for replying Dave. How do I allow only POST form submission? Do I need to check on each Struts Action method request.getMethod() is POST? If that's true, then I'm screwed. I will need to make changes on all my action classes. Thank you, semaj newton.dave wrote: --- semaj.najraham [EMAIL PROTECTED] wrote: my point is if the user directly types ../myApp/viewUserDetails.do?methodToCall=edituserid=1, it goes to Edit User page. Is this how it should behave even if it is POST or I am misunderstanding how POST and GET works? You appear to be misunderstanding not how they work, but what they are. A form submission may be GET or POST. An *action* is just an action; you don't define an action as a GET or POST action. Actions (in general) it will get the parameters regardless of how the request was made. The only way an action will differentiate between the two methods is if you explicitly code different paths for the different request types. For example, you may wish to only allow POST form submissions. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Is-it-post-or-get--tp15592354p15595291.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Is it post or get?
--- semaj.najraham [EMAIL PROTECTED] wrote: How do I allow only POST form submission? Do I need to check on each Struts Action method request.getMethod() is POST? If that's true, then I'm screwed. I will need to make changes on all my action classes. If you actually *care*, then yes, you'd need to implement that across the application somehow. There are several ways you could go about this, including creating a custom request processor (which could be combined with a struts configuration property, marker interface, or whatever), implement an action sub-class (that's what I always used to do, IIRC), or put it in each action, or... I seriously doubt that you're screwed to any great degree. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2: simple ajax form - returns value to a new page (not to a DIV)
:-( I think I have an issue with the ajax configuration (I'm not sure). How can I verify that my theme=ajax is configured properly? thank you! Jeromy Evans - Blue Sky Minds wrote: No, it seems fine now. Turn on debugging: s:head theme=ajax debug=true/ Also use FireBug to see if there's any javascript errors reported. xianwinwin wrote: thanks you for the reply. I added the code: s:head theme=ajax/ on top, plus s:submit value=GO2 showLoadingText=false theme=ajax targets=two / but I get the same result - it goes to an empty page with the result and not to the DIV? :-( any idea? xianwinwin wrote: Hi all, I'm trying to return a result to DIV in a form (in the example id='two') this is my form: div id='two' style=border: 1px solid yellow;initial content/div s:form id='theForm2' cssStyle=border: 1px solid green; action='testing_AjaxRemoteForm' method='post' theme=ajax input type='text' name='data' value='Struts User' s:submit value=GO2 theme=ajax targets=theForm2/ /s:form when the user clicks the GO2 -- the action, AjaxRemoteForm, is 'activated' (showing the 'data' the user has input) public String AjaxRemoteForm() { System.out.println(active ajax test 1 with data: +data); return test.ajax.2; } and routed to AjaxResult3.jsp: action name=testing_* method={1} class=com.struts.user.account.TestingAction result name=test.1 type=tilestest_1/result result name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result interceptor-ref name=user/ /action The result comes in a NEW page with the 'data' value the user has input AjaxResult3.jsp - %@ taglib prefix=s uri=/struts-tags % % request.setAttribute(decorator, none); response.setHeader(Cache-Control,no-cache); //HTTP 1.1 response.setHeader(Pragma,no-cache); //HTTP 1.0 response.setDateHeader (Expires, 0); //prevents caching at the proxy server % The value you entered was: s:property value=data/br/ Q: How can I incorporate the 'data' value in the DIV and not in a new page? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15595878.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 design question
--- [EMAIL PROTECTED] wrote: I'm curious why the developers of struts2 chose to define constants in an interface (StrutsStatics) and then implement that interface in at least 18 classes It's likely you'd need to ask the original WebWork developers. Item #17, Use interfaces only to define types, is on page 89 in my copy, btw. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Struts2+MyEclipse
Struts2-core is what you should be using. On 2/20/08, Dave Newton [EMAIL PROTECTED] wrote: --- aum strut [EMAIL PROTECTED] wrote: struts-core-1.3.5 You should probably use an S2 library instead. The IDE is giving the following errors: 1) the import com.opensymphony.xwork2.ActionSupport can not be resolved 2)ActionSupport can not be resolved to a type. Please tell me where i am doing the mistake. You need to add the libraries to the project build path. Right-click on the project, select \properties\, and fix your java build path (not sure which version of Eclipse MyEclipse is using these days, but finding the right place should be fairly obvious). Dave - 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: Date formatting?
Yea thats what I was thinking...but i am a n00b so thought maybe I am wrong... On 2/20/08, Dave Newton [EMAIL PROTECTED] wrote: --- \[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Please check the example at http://www.roseindia.net/struts/struts2/date/struts-2-date-format.shtml How does that address the question? Dave From: Adam Hardy [EMAIL PROTECTED] Date: Wed, 20 Feb 2008 13:48:18 + To: user@struts.apache.org Subject: Date formatting? I just checked that there is no JSTL configuration setting to apply a format type or pattern to fmt:formatDate across the whole webapp. I need the ISO date format on 99% of dates displayed on my current app, but there is no way to change the default globally for fmt:formatDate from dateStyle=\medium\. It seems like a prime target for a quick taglib, to avoid using the following everywhere, with x number of errors by sloppy coders (that would be me): fmt:formatDate value=\myDate\ pattern=\-MM-dd\ / Or is there something I\'m missing? Somewhat off-topic I realise after checking the S2 taglib reference :O Regards Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mail2web.com – What can On Demand Business Solutions do for you? http://link.mail2web.com/Business/SharePoint - 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: Date formatting?
Chris Pratt on 20/02/08 17:07, wrote: On Feb 20, 2008 5:48 AM, Adam Hardy [EMAIL PROTECTED] wrote: I just checked that there is no JSTL configuration setting to apply a format type or pattern to fmt:formatDate across the whole webapp. I need the ISO date format on 99% of dates displayed on my current app, but there is no way to change the default globally for fmt:formatDate from dateStyle=medium. It seems like a prime target for a quick taglib, to avoid using the following everywhere, with x number of errors by sloppy coders (that would be me): fmt:formatDate value=myDate pattern=-MM-dd / Or is there something I'm missing? Somewhat off-topic I realise after checking the S2 taglib reference :O It's a bit counter intuitive, in my opinion, but I think the way Struts 2 does this type of formatting may be just what you need. Instead of providing a dedicated tag to do formatting, the s:text tag can be pressed into service as a formatter. Basically you need to set up a property file and configure it in your struts.xml that will hold all the i18n properties for your web site. Something like: constant name=struts.custom.i18n.resources value=application/ would direct struts to look for an application.properties file on the classpath (probably in WEB-INF/classes). Then in that file you need to define the formats you care about. Since you have a default format that you want to use throughout your site, you might have something like: format.date.default={0,date,-MM-dd} Then in your .jsp pages you would simply use: s:text name=format.date.defaults:param value=%{my.date.property }//s:text Since the job of s:text is to look up strings from the properties and run them through java.text.MessageFormat, passing in any supplied parameters, the output is formatted as a date in the format you want. You can have as many different formats as you need, and you can format anything that MessageFormat can format (dates, times, numbers). Hope that helps. Yes it helps, thanks. I hadn't come across that, probably because I only use a couple of the S2 tags. But it's good to know it's there, if I start using those tags more. Ideally I don't want to specify a format at all when I only want the default, however I guess that's not an option. I did start writing lots of little taglib functions, so I could do something like this: ${adam:defaultDateFormat(bean.dateModified)} but the current drawback with this is that the Eclipse WTP JSP validator hates the syntax and displays error markers and lots of red underlining :( Thanks for the input, regards Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Is it post or get?
../myApp/viewUserDetails.do?methodToCall=edituserid=1, it goes to Edit User page. so whats wrong with that? even if you are using \'hidden\' fields you will retrieve them as request.getParameter(). If you dont pass the hidden field but just type it in the url then also it will work. If you are worried that user with userid 1 might be able to see edit page for user with userid 20 by just changing the url(/myApp/viewUserDetails.do?methodToCall=edituserid=20) then really your action should be checking whether logged in urerid matches userid coming from request.getParameter() or whatever logic your application requires... On 2/20/08, Dave Newton [EMAIL PROTECTED] wrote: --- \semaj.najraham\ [EMAIL PROTECTED] wrote: How do I allow only POST form submission? Do I need to check on each Struts Action method request.getMethod() is POST? If that\'s true, then I\'m screwed. I will need to make changes on all my action classes. If you actually *care*, then yes, you\'d need to implement that across the application somehow. There are several ways you could go about this, including creating a custom request processor (which could be combined with a struts configuration property, marker interface, or whatever), implement an action sub-class (that\'s what I always used to do, IIRC), or put it in each action, or... I seriously doubt that you\'re \screwed\ to any great degree. Dave - 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: struts2: simple ajax form - returns value to a new page (not to a DIV)
you can try the following. change: div id=\'two\' style=\border: 1px solid yellow;\initial content/div to s:div id=\two\ theme=\ajax\ (close this tag after your /s:form tag, so that the whole form will be inside the div tag. ) also change: s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/ to s:submit value=\GO2\ theme=\ajax\ targets=\two\/ also nowhere in your page (where users enter data) do i see how you would be displaying the information to the user...even if data wasnt being submitted to a new page. you can try the following somewhere inside the s:div tag: s:actionmessage/ ofcourse then in your action you will have to do: addActionMessage(\Put w/e data you want in here\); Hopefully it works out for your.. On 2/19/08, xianwinwin [EMAIL PROTECTED] wrote: Hi all, I\'m trying to return a result to DIV in a form (in the example id=\'two\') this is my form: div id=\'two\' style=\border: 1px solid yellow;\initial content/div s:form id=\'theForm2\' cssStyle=\border: 1px solid green;\ action=\'testing_AjaxRemoteForm\' method=\'post\' theme=\ajax\ input type=\'text\' name=\'data\' value=\'Struts User\' s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/ /s:form when the user clicks the GO2 -- the action, AjaxRemoteForm, is \'activated\' (showing the \'data\' the user has input) public String AjaxRemoteForm() { System.out.println(\active ajax test 1 with data: \+data); return \test.ajax.2\; } and routed to AjaxResult3.jsp: action name=\testing_*\ method=\{1}\ class=\com.struts.user.account.TestingAction\ result name=\test.1\ type=\tiles\test_1/result result name=\test.ajax.2\/pages/welcome/AjaxResult3.jsp/result interceptor-ref name=\user\/ /action The result comes in a NEW page with the \'data\' value the user has input \AjaxResult3.jsp\ - %@ taglib prefix=\s\ uri=\/struts-tags\ % % request.setAttribute(\decorator\, \none\); response.setHeader(\Cache-Control\,\no-cache\); //HTTP 1.1 response.setHeader(\Pragma\,\no-cache\); //HTTP 1.0 response.setDateHeader (\Expires\, 0); //prevents caching at the proxy server % The value you entered was: s:property value=\data\/br/ Q: How can I incorporate the \'data\' value in the DIV and not in a new page? -- View this message in context: http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15562626.html Sent from the Struts - User mailing list archive at Nabble.com. - 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: struts2: simple ajax form - returns value to a new page (not to a DIV)
thank you for your reply. I made the changes - still no good. I took one step backwards and I suspect that my theme=ajax doesn't work properly. I tried to use a simple TABS and the result on the screen was text (the names of the tabs). Do you think that what causing the problem? How can I tell if I have the theme=ajax installed correctly? omnipresent wrote: you can try the following. change: div id=\'two\' style=\border: 1px solid yellow;\initial content/div to s:div id=\two\ theme=\ajax\ (close this tag after your /s:form tag, so that the whole form will be inside the div tag. ) also change: s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/ to s:submit value=\GO2\ theme=\ajax\ targets=\two\/ also nowhere in your page (where users enter data) do i see how you would be displaying the information to the user...even if data wasnt being submitted to a new page. you can try the following somewhere inside the s:div tag: s:actionmessage/ ofcourse then in your action you will have to do: addActionMessage(\Put w/e data you want in here\); Hopefully it works out for your.. On 2/19/08, xianwinwin [EMAIL PROTECTED] wrote: Hi all, I\'m trying to return a result to DIV in a form (in the example id=\'two\') this is my form: div id=\'two\' style=\border: 1px solid yellow;\initial content/div s:form id=\'theForm2\' cssStyle=\border: 1px solid green;\ action=\'testing_AjaxRemoteForm\' method=\'post\' theme=\ajax\ input type=\'text\' name=\'data\' value=\'Struts User\' s:submit value=\GO2\ theme=\ajax\ targets=\theForm2\/ /s:form when the user clicks the GO2 -- the action, AjaxRemoteForm, is \'activated\' (showing the \'data\' the user has input) public String AjaxRemoteForm() { System.out.println(\active ajax test 1 with data: \+data); return \test.ajax.2\; } and routed to AjaxResult3.jsp: action name=\testing_*\ method=\{1}\ class=\com.struts.user.account.TestingAction\ result name=\test.1\ type=\tiles\test_1/result result name=\test.ajax.2\/pages/welcome/AjaxResult3.jsp/result interceptor-ref name=\user\/ /action The result comes in a NEW page with the \'data\' value the user has input \AjaxResult3.jsp\ - %@ taglib prefix=\s\ uri=\/struts-tags\ % % request.setAttribute(\decorator\, \none\); response.setHeader(\Cache-Control\,\no-cache\); //HTTP 1.1 response.setHeader(\Pragma\,\no-cache\); //HTTP 1.0 response.setDateHeader (\Expires\, 0); //prevents caching at the proxy server % The value you entered was: s:property value=\data\/br/ Q: How can I incorporate the \'data\' value in the DIV and not in a new page? -- View this message in context: http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15562626.html Sent from the Struts - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15598163.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need help with Struts Interceptor/session problem.
Hi, I have a BillingInterceptor that throws up a Confirmation Screen after submitting the input parameters and before processing the action. I am using the session to hold the parameter map so it's available to the action after the user Confirms their purchase. I have confirmed that the PARMS is being stored in the session. Sometimes PARMS manages to keep its value, and sometimes the value disappear. This seems to have something to do with the weather or the alignment of the stars. I see absolutely no rhyme or reason for why it only works sometimes! I've been struggling with this off and on for weeks. Thanks to those who have tried to help with this issue in the past. Any more ideas would be greatly appreciated! BillingInterceptor.java: public class BillingInterceptor extends AbstractInterceptor implements StrutsStatics { private static final String URL_GOING_TO = URL_GOING_TO; public String intercept (ActionInvocation invocation) throws Exception { ActionContext context = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST); HttpSession session = request.getSession(false); if ((request.getParameter(CONFIRM_SCREEN) != null) (request.getParameter(CONFIRM_SCREEN).equals(TRUE))) { String urlGoingTo = invocation.getProxy().getNamespace()+ invocation.getProxy().getActionName()+ .action; session.setAttribute(URL_GOING_TO, urlGoingTo); session.setAttribute(PARMS, request.getParameterMap()); return confirm; } else { Object action = invocation.getAction(); if (action instanceof BillingAware) { if (session.getAttribute(PARMS) != null) { BeanUtils.populate(action, (Map) session.getAttribute(PARMS)); session.setAttribute(PARMS, null); } } return invocation.invoke(); } } } confirm.jsp %@ taglib prefix=s uri=/struts-tags% html headtitleConfirm/title/head body table width=750trtd align=center h2Please confirm purchase./h2 br pThis could take several minutes depending on the request./p s:form action=%{#session.URL_GOING_TO} method=post s:submit value=Confirm align=center s:param name=colspan value=%{2} / s:param name=align value=%{'center'} / /s:submit /s:form /td/tr/table /body /html My interceptor-stack: interceptor-stack name=defaultLoginStack interceptor-ref name=servlet-config/ interceptor-ref name=billing/ interceptor-ref name=params/ interceptor-ref name=login/ interceptor-ref name=prepare/ interceptor-ref name=chain/ interceptor-ref name=model-driven/ interceptor-ref name=fileUpload/ interceptor-ref name=static-params/ interceptor-ref name=params/ interceptor-ref name=conversionError/ interceptor-ref name=validation execute /interceptor-ref interceptor-ref name=workflow execute /interceptor-ref /interceptor-stack -- View this message in context: http://www.nabble.com/Need-help-with-Struts-Interceptor-session-problem.-tp15598155p15598155.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help with Struts Interceptor/session problem.
--- daveck [EMAIL PROTECTED] wrote: Sometimes PARMS manages to keep its value, and sometimes the value disappear. I don't see anything immediately obvious; IIRC you had already checked the session ID to make sure you were always dealing with the same session, correct? Have you done extensive logging / tracing / etc. to make sure the value of PARMS in the session is getting set *only* when you believe it should be (this is what I would be most suspicious of first)? That said, I'm pretty uncomfortable with this use of an interceptor: is this functionality really required across broad swaths of your application? Is the order not stored in some application-specific object that could be stored in the session (or somewhere else) then retrieved again in a confirmation action? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help with Struts Interceptor/session problem.
I've done some pretty extensive troubleshooting, but will try and expand on it. The product is a generated and delivered (as a pdf) right after the user clicks on the Confirm button. I thought that the use of an interceptor for this purpose was ideal, but I'm a Struts novice and far from an expert Java programmer. Can you explain why the use of an interceptor is not the right way to go about this? Thanks! newton.dave wrote: --- daveck [EMAIL PROTECTED] wrote: Sometimes PARMS manages to keep its value, and sometimes the value disappear. I don't see anything immediately obvious; IIRC you had already checked the session ID to make sure you were always dealing with the same session, correct? Have you done extensive logging / tracing / etc. to make sure the value of PARMS in the session is getting set *only* when you believe it should be (this is what I would be most suspicious of first)? That said, I'm pretty uncomfortable with this use of an interceptor: is this functionality really required across broad swaths of your application? Is the order not stored in some application-specific object that could be stored in the session (or somewhere else) then retrieved again in a confirmation action? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Need-help-with-Struts-Interceptor-session-problem.-tp15598155p15599632.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
strut2 Ajax/dojo: rrrrrr what's wrong with my settings? cant get the theme=ajax to wrork (pictures included)
WHAT am I possibly doing wrong here? I want to get this result: (attention on the tabs example) http://www.nabble.com/file/p15600219/good.jpeg but I get this result: http://www.nabble.com/file/p15600219/wrong.bmp the code is: %@ include file=/pages/layouts/taglibs.jsp % html h2 class=menu id=titleWelcome s:property value=%{#session.USER_SESSSION_HANDLE.fname}/; last login s:property value=%{#session.security_user_last_logged_in}//h2 %@ include file=tabMenu.jsp %body class=section-3 head titleAjax examples - tabbled panel/title s:head theme=ajax/ link rel=stylesheet type=text/css href=s:url value=/struts/tabs.css/ body s:tabbedPanel id=test2 theme=simple cssStyle=width: 500px; height: 300px; doLayout=true closeButton=pane labelposition=bottom s:div id=left label=test1 theme=ajax I'm a Tab!!! /s:div s:div id=middle label=test2 theme=ajax I'm the other Tab!!! /s:div /s:tabbedPanel /body /html -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600219.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts1.1 - Value of ActionForm in second Action that is chained
This is the scenario using Struts 1.1: User Interface - MyAction1 (input is Form1)- MyAction 2 (input is Form2) -User Interface MyAction1 and MyAction2 are Action classes. MyAction1 and MyAction1 are configured in struts-config.xmxl. MyAction1 takes Form1 as input. MyAction2 takes Form2 as input. Form1 and Form2 are ActionForms. Following are the questions: 1. If Form1 and Form2 are of the same class, will Form2 get magically populated by the values obtained from Form1, when Action1 forwards to Action2? 2. Will Form2 values be empty? 3. If Form1 and Form2 are of different class, then what value will Form2 have? 4. If Form1 and Form2 are of the same class, then what value will Form2 have? 5. Is it a good idea to do Action chaining? Servlet chaining was never recommended. -- View this message in context: http://www.nabble.com/Struts1.1---Value-of-ActionForm-in-second-Action-that-is-chained-tp15600395p15600395.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help with Struts Interceptor/session problem.
--- daveck [EMAIL PROTECTED] wrote: The product is a generated and delivered (as a pdf) right after the user clicks on the Confirm button. I thought that the use of an interceptor for this purpose was ideal, but I'm a Struts novice and far from an expert Java programmer. Can you explain why the use of an interceptor is not the right way to go about this? I'm definitely not saying it's *wrong*, I'm just saying I would question it. The idea behind interceptors (IMO only, of course!) is that they are best used to encapsulate broad functionality across the entire system (or portions of it). For example, large portions of a web app need validation flow control, type conversion of request parameters to action properties, etc. I don't know how your application is set up, but many webapps have a single shopping-cart-like action that handles checkout, which might involve confirmation, after which any deliverables would be returned to the user. I (again, this is just me) don't see any point to using an interceptor for this: I'd have a shopping cart (or whatever) action. Upon moving through that action I'd have a confirmation action that re-displays my order. After that I'd have the action that actually delivers whatever it is (in your case a PDF, could be actual order submission, a thank you page, whatever). It's a very tightly-focused use-case, hence an interceptor is adding an additional layer of complexity and configuration that is just as easily (or, more likely, easier) handled with an interim action that handles confirmation and the next step in the process. I can't overstate enough that I have no idea how your application is designed--it's possible an interceptor *is* the best way to handle your needs, but I'm having trouble coming up with a reason why it would be better than just using another action, which would also probably eliminate the problem you're currently experiencing. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strut2 Ajax/dojo: rrrrrr what\'s wrong with my settings? cant get the theme=ajax to wrork (pictures included)
Pretty long subject eh.. use the labelposition property for your first s:div tag so it will be something like s:div id=\left\ label=\test1\ theme=\ajax\ labelposition=\top\ I\'m a Tab!!! /s:div s:div id=\middle\ label=\test2\ theme=\ajax\ I\'m the other Tab!!! /s:div and lose all the css and theme=\simple\ from the s:tabbedPanel tag. just to see if it works.. s:tabbedPanel id=\test2\ theme=\simple\ cssStyle=\width: 500px; height: 300px;\ doLayout=\true\ closeButton=\pane\ labelposition=\bottom\ s:div id=\left\ label=\test1\ theme=\ajax\ I\'m a Tab!!! /s:div s:div id=\middle\ label=\test2\ theme=\ajax\ I\'m the other Tab!!! /s:div On 2/20/08, xianwinwin [EMAIL PROTECTED] wrote: WHAT am I possibly doing wrong here? I want to get this result: (attention on the tabs example) http://www.nabble.com/file/p15600219/good.jpeg but I get this result: http://www.nabble.com/file/p15600219/wrong.bmp the code is: %@ include file=\/pages/layouts/taglibs.jsp\ % html h2 class=\menu\ id=titleWelcome s:property value=\%{#session.USER_SESSSION_HANDLE.fname}\/; last login s:property value=\%{#session.security_user_last_logged_in}\//h2 %@ include file=\tabMenu.jsp\ %body class=\section-3\ head titleAjax examples - tabbled panel/title s:head theme=\ajax\/ link rel=\stylesheet\ type=\text/css\ href=\s:url value=\/struts/tabs.css\/\ body s:tabbedPanel id=\test2\ theme=\simple\ cssStyle=\width: 500px; height: 300px;\ doLayout=\true\ closeButton=\pane\ labelposition=\bottom\ s:div id=\left\ label=\test1\ theme=\ajax\ I\'m a Tab!!! /s:div s:div id=\middle\ label=\test2\ theme=\ajax\ I\'m the other Tab!!! /s:div /s:tabbedPanel /body /html -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600219.html Sent from the Struts - User mailing list archive at Nabble.com. - 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: strut2 Ajax/dojo: rrrrrr what's wrong with my settings? cant get the theme=ajax to wrork (pictures included)
--- xianwinwin [EMAIL PROTECTED] wrote: WHAT am I possibly doing wrong here? Not sure: does it work if you're not using your own CSS? It's weird that only one of your tab headers is showing up and that the text of both tabs is visible. I don't see anything immediately obvious about the JSP itself. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strut2 Ajax/dojo: rrrrrr what's wrong with my settings? cant get the theme=ajax to wrork (pictures included)
thanks for replying. No, the tabs.css is not mine. I realized it comes from struts2-core. Musachy Barroso wrote: Is tabs.css your css? I am guessing that there is some style applied to the tabs that is breaking it. (because the text on the other tab should be hidden, and it isnt) musachy On Wed, Feb 20, 2008 at 5:21 PM, xianwinwin [EMAIL PROTECTED] wrote: WHAT am I possibly doing wrong here? I want to get this result: (attention on the tabs example) http://www.nabble.com/file/p15600219/good.jpeg but I get this result: http://www.nabble.com/file/p15600219/wrong.bmp the code is: %@ include file=/pages/layouts/taglibs.jsp % html h2 class=menu id=titleWelcome s:property value=%{#session.USER_SESSSION_HANDLE.fname}/; last login s:property value=%{#session.security_user_last_logged_in}//h2 %@ include file=tabMenu.jsp %body class=section-3 head titleAjax examples - tabbled panel/title s:head theme=ajax/ link rel=stylesheet type=text/css href=s:url value=/struts/tabs.css/ body s:tabbedPanel id=test2 theme=simple cssStyle=width: 500px; height: 300px; doLayout=true closeButton=pane labelposition=bottom s:div id=left label=test1 theme=ajax I'm a Tab!!! /s:div s:div id=middle label=test2 theme=ajax I'm the other Tab!!! /s:div /s:tabbedPanel /body /html -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600219.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600787.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strut2 Ajax/dojo: rrrrrr what's wrong with my settings? cant get the theme=ajax to wrork (pictures included)
Is tabs.css your css? I am guessing that there is some style applied to the tabs that is breaking it. (because the text on the other tab should be hidden, and it isnt) musachy On Wed, Feb 20, 2008 at 5:21 PM, xianwinwin [EMAIL PROTECTED] wrote: WHAT am I possibly doing wrong here? I want to get this result: (attention on the tabs example) http://www.nabble.com/file/p15600219/good.jpeg but I get this result: http://www.nabble.com/file/p15600219/wrong.bmp the code is: %@ include file=/pages/layouts/taglibs.jsp % html h2 class=menu id=titleWelcome s:property value=%{#session.USER_SESSSION_HANDLE.fname}/; last login s:property value=%{#session.security_user_last_logged_in}//h2 %@ include file=tabMenu.jsp %body class=section-3 head titleAjax examples - tabbled panel/title s:head theme=ajax/ link rel=stylesheet type=text/css href=s:url value=/struts/tabs.css/ body s:tabbedPanel id=test2 theme=simple cssStyle=width: 500px; height: 300px; doLayout=true closeButton=pane labelposition=bottom s:div id=left label=test1 theme=ajax I'm a Tab!!! /s:div s:div id=middle label=test2 theme=ajax I'm the other Tab!!! /s:div /s:tabbedPanel /body /html -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600219.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help with Struts Interceptor/session problem.
newton.dave wrote: I can't overstate enough that I have no idea how your application is designed--it's possible an interceptor *is* the best way to handle your needs, but I'm having trouble coming up with a reason why it would be better than just using another action, which would also probably eliminate the problem you're currently experiencing. In our situation, some products are free while others are not. There's an interceptor stack for each. All are dynamically generated immediately as an html page or a pdf. An order is only generated for the products that aren't free. For those, once the page is delivered successfully, an order is generated and the customers account (already established) is charged. The BillingInterceptor is only used for the confirmation. Maybe I should call it ConfirmationInterceptor. Does an interceptor make more sense in this case? You've got me thinking. Thanks. -- View this message in context: http://www.nabble.com/Need-help-with-Struts-Interceptor-session-problem.-tp15598155p15600866.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2: simple ajax form - returns value to a new page (not to a DIV)
Use the FireBug plugin for FF. Check that dojo is setup in the head of your page (view the html) and that all of the resources it requires are loaded (using the net tab). Ensure that struts filter is receiving requests for the /struts/* resources. xianwinwin wrote: :-( I think I have an issue with the ajax configuration (I'm not sure). How can I verify that my theme=ajax is configured properly? thank you! Jeromy Evans - Blue Sky Minds wrote: No, it seems fine now. Turn on debugging: s:head theme=ajax debug=true/ Also use FireBug to see if there's any javascript errors reported. xianwinwin wrote: thanks you for the reply. I added the code: s:head theme=ajax/ on top, plus s:submit value=GO2 showLoadingText=false theme=ajax targets=two / but I get the same result - it goes to an empty page with the result and not to the DIV? :-( any idea? xianwinwin wrote: Hi all, I'm trying to return a result to DIV in a form (in the example id='two') this is my form: div id='two' style=border: 1px solid yellow;initial content/div s:form id='theForm2' cssStyle=border: 1px solid green; action='testing_AjaxRemoteForm' method='post' theme=ajax input type='text' name='data' value='Struts User' s:submit value=GO2 theme=ajax targets=theForm2/ /s:form when the user clicks the GO2 -- the action, AjaxRemoteForm, is 'activated' (showing the 'data' the user has input) public String AjaxRemoteForm() { System.out.println(active ajax test 1 with data: +data); return test.ajax.2; } and routed to AjaxResult3.jsp: action name=testing_* method={1} class=com.struts.user.account.TestingAction result name=test.1 type=tilestest_1/result result name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result interceptor-ref name=user/ /action The result comes in a NEW page with the 'data' value the user has input AjaxResult3.jsp - %@ taglib prefix=s uri=/struts-tags % % request.setAttribute(decorator, none); response.setHeader(Cache-Control,no-cache); //HTTP 1.1 response.setHeader(Pragma,no-cache); //HTTP 1.0 response.setDateHeader (Expires, 0); //prevents caching at the proxy server % The value you entered was: s:property value=data/br/ Q: How can I incorporate the 'data' value in the DIV and not in a new page? - 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: struts2: simple ajax form - returns value to a new page (not to a DIV)
Check that dojo is setup in the head of your page (view the html) how do I do that? Thank you! Jeromy Evans - Blue Sky Minds wrote: Use the FireBug plugin for FF. Check that dojo is setup in the head of your page (view the html) and that all of the resources it requires are loaded (using the net tab). Ensure that struts filter is receiving requests for the /struts/* resources. xianwinwin wrote: :-( I think I have an issue with the ajax configuration (I'm not sure). How can I verify that my theme=ajax is configured properly? thank you! Jeromy Evans - Blue Sky Minds wrote: No, it seems fine now. Turn on debugging: s:head theme=ajax debug=true/ Also use FireBug to see if there's any javascript errors reported. xianwinwin wrote: thanks you for the reply. I added the code: s:head theme=ajax/ on top, plus s:submit value=GO2 showLoadingText=false theme=ajax targets=two / but I get the same result - it goes to an empty page with the result and not to the DIV? :-( any idea? xianwinwin wrote: Hi all, I'm trying to return a result to DIV in a form (in the example id='two') this is my form: div id='two' style=border: 1px solid yellow;initial content/div s:form id='theForm2' cssStyle=border: 1px solid green; action='testing_AjaxRemoteForm' method='post' theme=ajax input type='text' name='data' value='Struts User' s:submit value=GO2 theme=ajax targets=theForm2/ /s:form when the user clicks the GO2 -- the action, AjaxRemoteForm, is 'activated' (showing the 'data' the user has input) public String AjaxRemoteForm() { System.out.println(active ajax test 1 with data: +data); return test.ajax.2; } and routed to AjaxResult3.jsp: action name=testing_* method={1} class=com.struts.user.account.TestingAction result name=test.1 type=tilestest_1/result result name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result interceptor-ref name=user/ /action The result comes in a NEW page with the 'data' value the user has input AjaxResult3.jsp - %@ taglib prefix=s uri=/struts-tags % % request.setAttribute(decorator, none); response.setHeader(Cache-Control,no-cache); //HTTP 1.1 response.setHeader(Pragma,no-cache); //HTTP 1.0 response.setDateHeader (Expires, 0); //prevents caching at the proxy server % The value you entered was: s:property value=data/br/ Q: How can I incorporate the 'data' value in the DIV and not in a new page? - 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] -- View this message in context: http://www.nabble.com/struts2%3A-simple-ajax-form---returns-value-to-a-new-page-%28not-to-a-DIV%29-tp15562626p15601041.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2: simple ajax form - returns value to a new page (not to a DIV)
View the html source in the browser. The head should contain a script like this one from the struts2-showcase: script type=text/javascript // Dojo configuration djConfig = { baseRelativePath: /struts2-showcase/struts/dojo, isDebug: false, bindEncoding: UTF-8, debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes }; /script script type=text/javascript src=/struts2-showcase/struts/dojo/dojo.js/script script type=text/javascript src=/struts2-showcase/struts/simple/dojoRequire.js/script script type=text/javascript src=/struts2-showcase/struts/ajax/dojoRequire.js/script script type=text/javascript src=/struts2-showcase/struts/CommonFunctions.js/script In FireBug, you should see all those scripts being found. xianwinwin wrote: Check that dojo is setup in the head of your page (view the html) how do I do that? Thank you! Jeromy Evans - Blue Sky Minds wrote: Use the FireBug plugin for FF. Check that dojo is setup in the head of your page (view the html) and that all of the resources it requires are loaded (using the net tab). Ensure that struts filter is receiving requests for the /struts/* resources. xianwinwin wrote: :-( I think I have an issue with the ajax configuration (I'm not sure). How can I verify that my theme=ajax is configured properly? thank you! Jeromy Evans - Blue Sky Minds wrote: No, it seems fine now. Turn on debugging: s:head theme=ajax debug=true/ Also use FireBug to see if there's any javascript errors reported. xianwinwin wrote: thanks you for the reply. I added the code: s:head theme=ajax/ on top, plus s:submit value=GO2 showLoadingText=false theme=ajax targets=two / but I get the same result - it goes to an empty page with the result and not to the DIV? :-( any idea? xianwinwin wrote: Hi all, I'm trying to return a result to DIV in a form (in the example id='two') this is my form: div id='two' style=border: 1px solid yellow;initial content/div s:form id='theForm2' cssStyle=border: 1px solid green; action='testing_AjaxRemoteForm' method='post' theme=ajax input type='text' name='data' value='Struts User' s:submit value=GO2 theme=ajax targets=theForm2/ /s:form when the user clicks the GO2 -- the action, AjaxRemoteForm, is 'activated' (showing the 'data' the user has input) public String AjaxRemoteForm() { System.out.println(active ajax test 1 with data: +data); return test.ajax.2; } and routed to AjaxResult3.jsp: action name=testing_* method={1} class=com.struts.user.account.TestingAction result name=test.1 type=tilestest_1/result result name=test.ajax.2/pages/welcome/AjaxResult3.jsp/result interceptor-ref name=user/ /action The result comes in a NEW page with the 'data' value the user has input AjaxResult3.jsp - %@ taglib prefix=s uri=/struts-tags % % request.setAttribute(decorator, none); response.setHeader(Cache-Control,no-cache); //HTTP 1.1 response.setHeader(Pragma,no-cache); //HTTP 1.0 response.setDateHeader (Expires, 0); //prevents caching at the proxy server % The value you entered was: s:property value=data/br/ Q: How can I incorporate the 'data' value in the DIV and not in a new page? - 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: Need help with Struts Interceptor/session problem.
--- daveck [EMAIL PROTECTED] wrote: In our situation, some products are free while others are not. There's an interceptor stack for each. All are dynamically generated immediately as an html page or a pdf. An order is only generated for the products that aren't free. For those, once the page is delivered successfully, an order is generated and the customers account (already established) is charged. The BillingInterceptor is only used for the confirmation. Maybe I should call it ConfirmationInterceptor. Does an interceptor make more sense in this case? Not to me. It's just normal order processing: used in only one place (order processing), doesn't encompass any functionality needed anywhere else, and doesn't require any interceptor functionality. I'd just redirect to a confirmation action when necessary. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strut2 Ajax/dojo: rrrrrr what's wrong with my settings? cant get the theme=ajax to wrork (pictures included)
try putting labelposition=top as a property in your div tag for the first tab. and remove all css just to see if it atleast works On Wed, Feb 20, 2008 at 5:44 PM, xianwinwin [EMAIL PROTECTED] wrote: thanks for replying. No, the tabs.css is not mine. I realized it comes from struts2-core. Musachy Barroso wrote: Is tabs.css your css? I am guessing that there is some style applied to the tabs that is breaking it. (because the text on the other tab should be hidden, and it isnt) musachy On Wed, Feb 20, 2008 at 5:21 PM, xianwinwin [EMAIL PROTECTED] wrote: WHAT am I possibly doing wrong here? I want to get this result: (attention on the tabs example) http://www.nabble.com/file/p15600219/good.jpeg but I get this result: http://www.nabble.com/file/p15600219/wrong.bmp the code is: %@ include file=/pages/layouts/taglibs.jsp % html h2 class=menu id=titleWelcome s:property value=%{#session.USER_SESSSION_HANDLE.fname}/; last login s:property value=%{#session.security_user_last_logged_in}//h2 %@ include file=tabMenu.jsp %body class=section-3 head titleAjax examples - tabbled panel/title s:head theme=ajax/ link rel=stylesheet type=text/css href=s:url value=/struts/tabs.css/ body s:tabbedPanel id=test2 theme=simple cssStyle=width: 500px; height: 300px; doLayout=true closeButton=pane labelposition=bottom s:div id=left label=test1 theme=ajax I'm a Tab!!! /s:div s:div id=middle label=test2 theme=ajax I'm the other Tab!!! /s:div /s:tabbedPanel /body /html -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600219.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/strut2---Ajax-dojo%3A-rr-what%27s-wrong-with-my-settings--cant-get-the-theme%3Dajax-to-wrork-%28pictures-included%29-tp15600219p15600787.html Sent from the Struts - User mailing list archive at Nabble.com. - 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]
Iterator action setObject param
Hiya, I'm quite new to struts 2. I'm trying to write a jsp page for an action which iterates through a list of 'note' object and passing each of the 'note' object into another model-driven action (NoteAction) which renders the information for the note passed in. Now I have a method in NoteAction called setNote(Note value) which sets the note field to the value. I also have getModel which returns a new note object if it's null. I however keep encountering the following error: ERROR [com.opensymphony.xwork2.interceptor.ParametersInterceptor] - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'note' on 'class blah.blah.NoteAction: Error setting expression 'note' with value '[BlahObject... blag... ]' Below is my interator loop bits: s:iterator value=notes status=recordStat s:action name=iml_row namespace=/emergency_iml executeResult=true ignoreContextParams=true s:param name=note value=[0]/ s:if test=#recordStat.odd s:param name=bgcolorsilver/s:param /s:if /s:action /s:iterator Now tell me can I actually put an object in the action param that's from a iterator? Or does it only work with strings or whatever standard type converter stuff struts uses? Do I have to write a custom type converter for it to work? I hope it makes sense :/ thanks, CrappyCrumpet -- View this message in context: http://www.nabble.com/Iterator-action-setObject-param-tp15602495p15602495.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Actions without extending ActionSupport?
Dave Newton wrote: --- [EMAIL PROTECTED] wrote: public class MyAction { public String deleteUser() { // Here I can inject errors for display on the JSP by writing: FacesContext.getCurrentInstance().addMessage(userNameField, Sorry, that username is unknown); return input; } } Notice MyAction inherits no JSF-specific interfaces and extends no JSF-specific classes, which is I find very desirable. Well... Obviously code-coupling is bad. You're still coupled to the FacesContext, though, and in some ways I like being coupled to static methods even less because it's not injectable. Agreed. Using a static method call is NOT a form of decoupling from the framework. In fact, it's less desirable than an interface because its harder to test and override. Just wondering if struts2 has a way to decouple actions in this manner. Either: Implementing ValidationAware and delegating to the ValidationAwareSupport mixin is best; or if you really desire an equivalent static call: - add a ValidationAware instance to the ActionContext via a custom Interceptor; and - ((ValidationAware) ActionContext.getActionContext().get(myValidation)).addActionError(); may work. ie. the context contains a ValidationAware object rather than your action being the ValidationAware object. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 design question
Dave Newton wrote: --- [EMAIL PROTECTED] wrote: I'm curious why the developers of struts2 chose to define constants in an interface (StrutsStatics) and then implement that interface in at least 18 classes Just thought I'd mention that Dave followed this up for you in struts-dev: http://www.nabble.com/StrutsStatics...-td15595866.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterator action setObject param
--- crappycrumpet [EMAIL PROTECTED] wrote: Now I have a method in NoteAction called setNote(Note value) which sets the note field to the value. I also have getModel which returns a new note object if it's null. I however keep encountering the following error: ERROR [com.opensymphony.xwork2.interceptor.ParametersInterceptor] - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'note' on 'class blah.blah.NoteAction: Error setting expression 'note' with value '[BlahObject... blag... ]' Below is my interator loop bits: s:iterator value=notes status=recordStat s:action name=iml_row namespace=/emergency_iml executeResult=true ignoreContextParams=true s:param name=note value=[0]/ [...] The s:iterator... tag pushes the current object of iteration onto the stack. One way to implement this functionality is to simply s:include.../ the desired page; your note object will be on the top of the stack, and can be accessed appropriately. As you suspected, you can't pass an actual object as a parameter to an action; s:action... is basically making a request for that page, so you're forced to follow the same conventions as if you were, say, submitting a form: strings only. If you were dead-set on implementing your note component this way you'd have to do something like pass a note ID and create it via J. Random Mechanism in the sub-action (like type conversion, via the Preparable interface, etc.) You could also use Tiles here, similar to s:include..., but perhaps a bit less hokey than just including a JSP. I dunno; I've done both, and for simple models I don't really have much of an issue just including a JSP, but others will probably laugh and point at me for that :) Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
s:datetimepicker version 2.0.11 issue
Hi, My code is: s:datetimepicker label=Time name=validityTimeTime id=vtTime type=time displayFormat=HH:mm:ss staticDisplay=true value=%{#sr.validityTime} language=en-us required=true / Issue: 1. Time cannot be edited by going straight to the text field and entering using keyboard. It only allows to pick up the time from the popup. However popup only gives minutes granularity in 5 minutes interval. Any workaround? Is there a better mailing list to post this question. Thanks, -Akash - Never miss a thing. Make Yahoo your homepage.
Re: s:datetimepicker version 2.0.11 issue
akash agrawal wrote: Issue: 1. Time cannot be edited by going straight to the text field and entering using keyboard. It only allows to pick up the time from the popup. However popup only gives minutes granularity in 5 minutes interval. Any workaround? Is there a better mailing list to post this question. Unfortunately... Answer: usability of the time picker in Dojo 0.4 sucks Work around: 1. I use selects for time with javascript to combine the selections into a string in a hidden field (and vice versa). Not as pertty, but it works well! 2. google javascript time picker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterator action setObject param
newton.dave wrote: One way to implement this functionality is to simply s:include.../ the desired page; your note object will be on the top of the stack, and can be accessed appropriately. Yeah I ended up doing using s:include.../ in the end. Was wondering if iterator passing object into action should work or not. (since it works when it's not in the iterator) Quite few things wasn't what I expected like when I call an action (let's call it theOther action) from an action and both has id attribute, when I pass in the id from another attribute in the caller action (say blahId) the id in the caller action ended up getting the blahId's value if you refer to it later after theOther action has finished! Now I've learnt that I can workaround it (or maybe that how it's meant to be used...) using caller.id and theOther.id (where caller and theOther is an model object in the caller and the other action). And to use ignoreContextParams=true in my s:action.../ so that the action attribute doesn't mysteriously get set to other stuff. I hope there isn't too much other things to workout -_- . Thank you for your response! cheers, CrappyCrumpet -- View this message in context: http://www.nabble.com/Iterator-action-setObject-param-tp15602495p15604651.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
about sitemesh in struts 2.0.11
when i try to use sitemesh and use s:tabbedpanel it can not work why? it is not give any error but tabbedpanel can not work -- View this message in context: http://www.nabble.com/about-sitemesh-in-struts-2.0.11-tp15605222p15605222.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about sitemesh in struts 2.0.11
hardik_982 wrote: when i try to use sitemesh and use s:tabbedpanel it can not work why? it is not give any error but tabbedpanel can not work Either: - you're missing decorator:head/ in your decorator, so the javascript included by s:head is missing; or - you need to an and excludes to decorators.xml because it's decorating a resource needed by dojo (/struts/* should be exluded) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about sitemesh in struts 2.0.11
Thanks for your great advise i have tried u say but i think i still do any mistake it shows javascript error on page 'dojo' is required do you have any idea why? my decorater excludes excludes pattern/styles/*/pattern pattern/scripts/*/pattern pattern/images/*/pattern pattern/index.html/pattern pattern/Error.jsp/pattern pattern/Login.jsp/pattern pattern/struts/* /pattern pattern/dojo/*/pattern /excludes -- View this message in context: http://www.nabble.com/about-sitemesh-in-struts-2.0.11-tp15605222p15605885.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get method name in interceptor
Thanks. This approach works, but isn't quite as elegant as I was hoping. On Wed, Feb 20, 2008 at 2:47 PM, [EMAIL PROTECTED] wrote: download the breadcrumb http://strutsschool.com/downloads/downloads.actioninterceptor and look at the intercept method. You will see what's happening right away. On Wed, Feb 20, 2008 at 5:40 AM, Toni Lyytikäinen [EMAIL PROTECTED] wrote: Hi, I'm trying to access the ActionMapping from an interceptor, like the following test stub: public String intercept(ActionInvocation invocation) throws Exception { ActionMapping am=ServletActionContext.getActionMapping(); log.info(The method is +am.getMethod()); return invocation.invoke(); } According to the javadocs am.getMethod() should return a String (the method), but for some reason am.getMethod() always returns null. The am.getName() and am.getNamespace() methods seem to work correctly however. Is there a way (that works) to extract the name of the method that is going to be executed? -- Scott [EMAIL PROTECTED]
Re: about sitemesh in struts 2.0.11
hardik_982 wrote: it shows javascript error on page 'dojo' is required That means the the dojo files were not found or were not even included. Does the head of your page (in html) include the scripts to load the dojo files? If not: does your JSP include s:head does your decorator include decorator:head/ If yes: use FireBug (net tab) to see if the resources were found, and if so, examine them to see if sitemesh decorated something it should have. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about sitemesh in struts 2.0.11
First of all i want to say thanks for favorable replies does your JSP include s:head-yes does your decorator include decorator:head/-yes how to use FireBug (net tab) to see if the resources were found, and if so, examine them to see if sitemesh decorated something it should have. i dont know about anything of firebug -- View this message in context: http://www.nabble.com/about-sitemesh-in-struts-2.0.11-tp15605222p15606336.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]