Re: Simplified usage of:@com.company.Constants.StaticCOnstants
On Thu, May 1, 2008 at 5:21 PM, Jeromy Evans [EMAIL PROTECTED] wrote: I have a solution, but first... OGNL only provides access to static fields and static methods. It cannot reference a static class, nor even an inner static class. http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/apa.html Strange... because I succeeded in reading Enum values from an inner enum class, like: public interface MyInterface { enum MyEnum { MY_ENUM_VALUE; } } Using s:property value=@[EMAIL PROTECTED] / prints: MY_ENUM_VALUE (value returned by the .toString() from the Enum class) Note: it might be dumb to do this, BUT if you use a specific Struts2 (or XWork?) converter to translate your enum value into something different (e.g. introducing a label or something similar that would returns My Enum Value in our example) then it's useful when not only dealing with the Enum name (i.e. here MY_ENUM_VALUE). I also succeeded using s:property value=@[EMAIL PROTECTED] / that prints: 2.718281828459045 But strangely, some: s:property value=@[EMAIL PROTECTED] / does not work... why?! ... all this with Struts 2.0.11.1 However, there is a bearable solution / hack: 1. In your Constants *class*, create a public static singleton instance of itself. Lets call it C. (Remember, OGNL can reference static fields) public static final Constants C = new Constants(); 2. [...] And what if, as from my above explained example, you have an *interface*, not a class...? Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: S2 Refering to another key in the Resource Bundle?
On Wed, Jun 4, 2008 at 8:26 AM, Rubens [EMAIL PROTECTED] wrote: Does Struts 2 resource bundle support refering to previously defined parameter keys in the resources file? For example, something like this: software.version=1.0.1 software.text=Software version is ${software.version} s:text name=software.text / prints Software version is 1.0.1 I know I can use the {0}, {1}, ...{n} tokens and pass use s:param.../s:param with s:text.../s:text. However, I have cases where this is not possible to do. AFAIK, it's not working the way you excepted it to be, because this resource bundle system is provided by the Java Properties class. see: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nested Map List type conversion properties settings
Hello, Working on it for a while but couldn't find a solution. In my action I need the following Map: MapString, ListMyBean myList; ... where the class MyBean is something like: class MyBean { private Long id; private String name; // + appropriate getters/setters } What I'd like is setting each value back through some s:textfield / using the particular OGNL as described here: http://struts.apache.org/2.x/docs/type-conversion.html For generating all the appropriate s:textfield / I have two nested iterators; first one for the Map, second one for the List. But how do I do with my OGNL expressions to be put in the value= attribute of the text fields. I'm guessing it's something like: myList['mapKey'](beanId) but I could not find how to configure it properly because it seems there's a conflict between how to declare the Map conversion how to declare the pseudo-collection index for a single myList[...] value # conf. for the Map Key_myList=String Element_myList=java.util.Map CreateIfNull_myList=true # conf. for the Map...??? how to indicate here it's a value in the map, not the map itself!!? KeyProperty_myList=id Element_myList=com.mycompany.somepackage.www.bean.MyBean CreateIfNull_myList=true Thanks for your help! Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: The next version of the Struts2
Hello, I just asked this a week or two ago... it's imminent but not 100% confirmed. Seems it needs to be qualified before getting available as a GA. The only alternative is building it by our own using Maven. Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: For s:textfield tag how to get value for title attribute from resource bundle.
On Wed, Feb 27, 2008 at 10:48 AM, VJ22 [EMAIL PROTECTED] wrote: Hi, Thanks.This solution worked but can u tell me a way where in I dont have to use OGNL because I dont want dependancy on webworks for JSP's. I think you can't. WebWork ended few months ago, and went to be replaced by XWork as part of Struts2. Check: http://blogs.opensymphony.com/webwork/2007/04/webwork_225_released.html Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in populating Maps
On Sun, Feb 24, 2008 at 4:37 PM, Dave Newton [EMAIL PROTECTED] wrote: [...] the error is this: Error setting expression 'currentEvent.excludeRulesValues['dd']' with value '[Ljava.lang.String;@1f09665' which looks more like it's trying to set a single String with a String[]. And how do we might fix this thing..? I can understand that a s:select / can return several String values, but a s:textfield / ...?! And even if the HTML/HTTP or what-so-ever standard involved allows that multiple values are returned for the same parameter (what seems to be commonly argued in this situation), why setting the value for a single String field in an Action do not lead to this exception?! Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean utils copy properties
Try using the Dozer library on Sourceforge ( http://dozer.sourceforge.net/ ) It's test worth and even if it lacks some complex-hierarchy features, it's far advanced from BeanUtils (indeed, it uses BeanUtils for basic operations). Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Evaluate a string property containing some OGNL expression
Back on this: s:set name=testValue value=%{12} / testValue = s:property value=#testValue / // print 1 s:set name=testValueName value=%{'testValue'} / testValueName = s:property value=#testValueName / // print testValue // print nothing!!! testValue (via xxxName) = s:property value=%{%{#testValueName}} / Still no idea...? Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 design question
On Thu, Feb 21, 2008 at 2:03 AM, Jeromy Evans [EMAIL PROTECTED] wrote: Just thought I'd mention that Dave followed this up for you in struts-dev: http://www.nabble.com/StrutsStatics...-td15595866.html Just to let you know this link does not work (seems incomplete). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts2 design question
Strangely it first freezes my browser. Re-testing it now and it's working. I also thought the three dots could come from a shortened url, while it's effectively not. Apologies. Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unable to make Type Conversion work in Struts2
Thanks for your answer. I partially fixed this, noticing the square brackets notation is the same for Lists and Maps, which is not so clear on the related doc page (I posted a comment about this, having had a conversion with Dave Newton about this in a more recent thread on the mailing-list), as well as fixed the getter method which had a bad copy/paste issue. But I found another problem that might need some better formulation from me, and eventually a Jira: it seems Struts2 isn't able to fully support the java.lang.EnumMap object (e.g. using a EnumMapYourEnum, String), given that it's a particular Map (i.e. all keys are known, and they are NOT Strings) without any no-arg constructor - thus resulting in some cases in an InstanciationException. I tried some work-around with the introduction of an EnumTypeConverter (extending StrutsTypeConverter), which seemed to work fine at first sight, but unfortunately there's a buggy side effect: Struts2 then tried to convert the input value (which has to be the value of the map of type java.lang.String, if referring to the above example) ... in the corresponding Enum type of the key!!! Even if its declared in the youraction-conversion.properties with: Element_xxx=java.lang.String - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Availability of Struts 2.1.0? ... related to XWork 2.1.0
Hello, I'm wondering if the version 2.1.0 of Struts2 would have to be released one day as I found it was initially due in late October 2007. (see links below) Problem is I currently need a fix/enhancement about Enum native conversion, which was already resolved in... XWork 2.1.0 http://jira.opensymphony.com/browse/XW-564 As it seems both (XWork 2.1.0 current Struts2 GA = 2.0.11) are incompatible - I tested it, some XWork classes moved or disappeared -, I don't really know what to do actually. Any ideas...? Thanks, Maxx Version Notes 2.1.0 (due Oct. 29 2007) http://struts.apache.org/2.x/docs/version-notes-210.html Fix for 2.1.0 on JIRA https://issues.apache.org/struts/secure/IssueNavigator.jspa?reset=truepid=10030fixfor=21794 Struts 2.1.0 DONE https://issues.apache.org/struts/secure/IssueNavigator.jspa?mode=hiderequestId=10767 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: S2 insertnig key and pojo(as its value) into a map
On Feb 16, 2008 1:57 PM, Dave Newton [EMAIL PROTECTED] wrote: --- Maxx [EMAIL PROTECTED] wrote: I seriously doubt it is actually really working like presented in the Struts doc. I have a three-deep nested structure with a map between IDs and objects and it works fine. I would seriously like to see the complete config settings to see how it really works. The reason your iterator doesn't work is because you should just use s:property/ to display the item of iteration since it's not in a bean. OK for using only s:property / to display the value, but what about generating a s:textfield / referring to some nested field ?? What else isn't working? If it's something to do with the form submission I'd first check to make sure the form is rendering properly. If it's something else without the code of the action being submitted to it'll be hard to help. What is not working..? A simple s:iterator value=testList / does not iterate, simply because the referred testList is a ListString, even if the action-name-conversion.properties file exists and is properly loaded... I'm not sure if this post was in response to an answer to yours; if not you can't always expect an immediate answer. Some of us have jobs and other stuff to do. Effectively, this post is not an answer to my post, but mine does not even get one, while about a dozen of others get ones!!?! I know people here do have jobs, I have a job too; but for my job, I need Struts, and Struts isn't working as excepted. And curiously on this mailing-list, some basic questions get answers while more sophisticated ones (although being well documented) do NOT get answers. Strange, no..? Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: S2 insertnig key and pojo(as its value) into a map
On Feb 16, 2008 2:37 PM, Dave Newton [EMAIL PROTECTED] wrote: If you want people to help I'd probably suggest going about it a different way. Different people know different things, may not have the time to look at every single message, etc. I would not require people's help if the documentation would be clear enough. It is not really the case. Like I said: is the HTML being generated properly? Nothing get's generated... What is not working..? A simple s:iterator value=testList / does not iterate, simply because the referred testList is a ListString, You just said above that it does. Is it the *iteration* that doesn't work or the generation of the textfield name? No, in fact, the thing is a little bit confusing. There's too case : - first one is when iterating directly on a testList (ListString): nothing get's generated; it looks like the iterator does not iterate! - second one is when iterating on a testBean.testList, the ListString being UNDER a bean; the iterator works, but when trying to use a s:textField name=testBean.testList(#theStatus.index) / (which GETS generated) , values are not set properly after form submission! All this while setting the proper Element_xxx=java.lang.String into the *-conversion.properties file. Effectively, this post is not an answer to my post, Yeah. It is. Sometimes figuring out what's wrong is a *process* and it won't get answered in a single post. Complaining about not getting an immediate answer on a forum where people *volunteer* their time to solve *other people's* problems is counter-productive and impolite. Some people here volunteer by just giving links towards the documentation. I read the documentation. I re-read several times. And unfortunately, it lacks some more explicit examples. And in my case it does not work, while I applied everything described in the famous page: http://struts.apache.org/2.0.11/docs/type-conversion.html Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Evaluate a string property containing some OGNL expression
Hello, As I wasn't able to find this out at the moment, I'm posting my question here : Would it be possible, within Struts2 tags, to evaluate a (String) property which contains the OGNL expression referring to an other property?? Example : s:set name=testValue value=%{12} / testValue = s:property value=#testValue / // print 1 s:set name=testValueName value=%{'testValue'} / testValueName = s:property value=#testValueName / // print testValue testValue (via xxxName) = s:property value=%{%{#testValueName}} / // print nothing!!! Why I'm wanting this ? This might be tricky but because I'm getting complex OGNL expressions like myObj.someSubList(X).someSubMap[Y](Z).subObj.fieldName I'd like to set my OGNL prefix with a simple set s:set name=myPrefix value=%{'myObj.someSubList(X).someSubMap[Y](Z).subObj.'} / and then for each property call use something like %{#myPrefix + 'fieldName'} But unfortunately I'm unable to make it work at the moment. Could please someone explain me what I'm doing wrong? Thanks, Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Evaluate a string property containing some OGNL expression
Of course the JSP if for prensentation. But this kind of complex OGNL expression is computed as each iteration of multiple s:iterator tags (that's why I put some X/Y/Z variables, each resulting of a %{#someStatus.index} expression). In fact, the myObj is exposed by the Action class through regular getMyObj/setMyObj couple of getter/setter, and has to be used as the target of a form. It's just that it has a complex sub-/object hierarchy in its structure, and this structured object is linked to some other one, I'll call presentation structure (made of field categories, fields...) presented in my JSP (to sum up things). Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parameters in URL
On Fri, Feb 15, 2008 at 9:46 AM, Paranoid_Fabio [EMAIL PROTECTED] wrote: I'm sorry but I meant includeParams=none. I wrote it correctly in the code but I posted it wrong. The result is the same, params are included in the url. Which url(s) are talking about now ? If, as said above, it's within the other urls generated in your JSP, it's the same schema : generate them with the s:url tag and includeParams=none parameter. If you want to change this globally (it really helps!), set in your struts.properties the following line: struts.url.includeParams=none Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Evaluate a string property containing some OGNL expression
Well... Enough if it would only be for a presentation purpose, and as said I already have use this : the aforementioned multiple s:iterator tags. But when you have, let's say, about 50 s:textfield, each corresponding with a single myObj.someSubList(X).someSubMap[Y](Z).subObj or myObj.someSubList(X).someSubMap[Y](Z).subObj.fieldName ... you have to enter the WHOLE object path as name of the input field. That IS the problem :-p Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Evaluate a string property containing some OGNL expression
Currently searching, I found something that might be related : it's a security fix about recursive OGNL parsing http://struts.apache.org/2.x/docs/s2-001.html (related to WebWork bug WW-2030). As I can read: *As of XWork 2.0.4, the OGNL parsing is changed so that it is not recursive* ... is my problem. Is there a way to re-activate this on a per-case basis... or? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parameters in URL
OK, understood. Did you try what I advised you? To make it clear, what is the JSP code of the other links/actions..? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Unable to make Type Conversion work in Struts2
Hello, Refering to http://struts.apache.org/2.x/docs/type-conversion.html , I'm currently trying to make Type Conversion working on a really simple example. And unfortunately, nothing's working. Below are the sources. Could someone please tell what I'm doing wrong (I suspect something with the OGNL expressions but could not found what...) Greets, Maxx PS: the s:iterator doesn't display anything, but if you move the testList under a JavaBean (e.g. TestBean) and you change testList to testBean.testList as OGNL value everywhere it's used (esp. for the iterator), it displays the values in the list... BUT the textfields still do not work, as while submitting the form, there are some Exceptions in the log which say: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'testBean.testList(0)' on 'class com.mycompany.somepacakge.action.TestAction: Error setting expression 'testBean.testList(0)' with value '[Ljava.lang.String;@102011a' --- // TestAction.java public class TestAction { public String execute() { ListString testList = new ArrayListString(2); testList.add(LIST 1st VALUE); testList.add(LIST 2nd VALUE); setTestList(testList); return INPUT; } public ListString getTestList() { return (ListString) session.get(list); } public void setTestList(ListString list) { session.put(list, list); } } // TestAction-conversion.properties Element_testList=java.lang.String // test.jsp [EMAIL PROTECTED] language=java contentType=text/html; charset=ISO-8859-1% [EMAIL PROTECTED] prefix=s uri=/struts-tags% s:form id=testForm action=Test method=post pre Direct access: = does not work testList(0) = s:property value=testList(0) / testList(1) = s:property value=testList(1) / Regular iterator: = does not work s:iterator value=testList status=stat testList(s:property value=#stat.index/) = s:property value=top / // s:textfield name=testList(%{#stat.index}) / /s:iterator /pre s:submit id=submitBtn value=Submit Test action=Test / /s:form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: S2 insertnig key and pojo(as its value) into a map
Hello, I seriously doubt it is actually really working like presented in the Struts doc. As explained in a previous email today (entitled Unable to make Type Conversion work in Struts2), I'm currently facing a problem with this Type Conversion in a very *simple* example... Greets, Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP syntax errors through icnlude
On Jan 14, 2008 2:27 PM, Al Sutton [EMAIL PROTECTED] wrote: Just re-read your original message. So you have tried it on an app server and everything is OK. Doesn't that indicate the problem lies with eclipse and not struts?, shouldn't it be the Eclipse bug tracking system you put your report in and not Struts Jira? Well, I thought it might be related to the use of Struts2 tags/taglib, and then related to the translation into JSP's java code. But hey, I'm gonna try the Eclipse thing. Thanks, Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JSP syntax errors through icnlude
Hello! Before issuing a bug report on Struts' bug tracker, I'd like to have your advices about a rather stranger syntax error I'm getting with Eclipse (v.3.3/Europa) and JSP using Struts2 tags. Here's own I can reproduce it: Create the project: New Project Other... Web Dynamic Web Project = Project Name: Struts2Test = Other settings: use default Add Struts2 needed librairies (e.g. struts2-core-j4-2.0.11.jar xwork-j4-2.0.4.jar ) to your WebContent\WEB-INF\lib folder Now creating the test *.jsp(f) files under WebContent: /pages/action/index.jsp: (please respect the folders!!) --- [EMAIL PROTECTED] language=java contentType=text/html; charset=ISO-8859-1% [EMAIL PROTECTED] prefix=s uri=/struts-tags% [EMAIL PROTECTED] file=/pages/include/include.jspf% --- /pages/include/include.jspf: (folders too!) --- [EMAIL PROTECTED] prefix=s uri=/struts-tags% %-- Affichage des éventuels messages d'information ou d'erreur --% s:if test=actionMessages != null actionMessages.size 0 || actionErrors != null actionErrors.size 0 div class=content s:if test=actionMessages != null actionMessages.size 0 div id=actionMessages class=actionMessages s:actionmessage cssClass=actionMessage theme=fix / /div /s:if s:if test=actionErrors != null actionErrors.size 0 div id=errorMessages class=errorMessages s:actionerror cssClass=errorMessage theme=fix / /div /s:if /div /s:if --- Now clean build your project: you'll get two Syntax ERRORs on the [EMAIL PROTECTED] JSPF row in the index.jsp: Multiple annotations found at this line: - Syntax error on token catch, Identifier expected - Syntax error on token }, delete this token I first thought it could be due to the s:actionmessage s:actionerror tags not handling properly exceptions. But as there's seem to have no syntax error when putting both files (JSP JSPF) in the same folder, I'm getting dubious. This code works, these pages work (I compiled used them on Tomcat 4.x WebLogic 8.x)!! So what's the problem with the validation (JSP Syntax validator)? Any idea..? Thanks in advance... Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] message properties
In a JSP, it's quite easy, you just have to use a nested s:param inside the tag refering to your message, e.g. s:text name=message.remove s:param name=value value=item.name / /s:text (of course if item is available through your action via a getItem() method - same for property name on your item) For the Freemarker thing, I unfortunately don't know. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2]Using javascript to hide a struts tag
Of course the label can't be hidden as it's not the same element. It may also depend on the theme you're using. By default it's the xhtml one, and as this theme creates additional trtd stuff around (which is really annoying and shouldn't be default IMHO), what you're doing is only hiding the inner stuff in the table. document.LocationAddNode.elements(prodIpPort).style.display = 'none'; //Does not work are you sure this expression matches your div...? I don't think so, and as you're using old-style-IE-javascript, I can only advise you to use something like this : document.getElementById(prodIpPort).style.display = none; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: accessing url parameters in jsp.
On Dec 19, 2007 6:45 AM, j alex [EMAIL PROTECTED] wrote: Ideally, i would want the entire incoming query string be passed on to the iframe- but didn't find anything handy. Note : i can't use the s:action tag in this case, since the result is a jasperreport page, and it flushes the response within the result itself ; so had to go with iframe. Yes, you can't use the s:action tag, but instead you can use the s:url tag, like s:url action=yourActionName includeParams=get / and all your GET parameters will be copied in the new forged url. Oh... and please read the doc!!! ;) http://struts.apache.org/2.x/docs/url.html Greets, Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and SSL
Hello, Good idea, but when it's about annotations, is it about Java 5? How to handle/use this in Java (1.)4 ? Thanks, Maxx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]