Re: Prevent persisting data when validation fails
What are you using to manage persistence? Can we see your action's source code? On Mon, Jul 20, 2009 at 5:42 AM, taltun tunca...@gmail.com wrote: When submitting a form using manual validation in my action. Even when the validation fails and the action method supposed to be called is not called at all, the dirty data is persisted ? How can I prevent data from being persisted if the validation fails ? Note: I use prepare method to load e.g an user object from a manager/service. And the data relates to the user object that is about. -taltun -- View this message in context: http://www.nabble.com/Prevent-persisting-data-when-validation-fails-tp24566713p24566713.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Pb displaying image
Make sure the image is visible to your webserver, and then use an http://url to access it, rather than a file:// url. jk On Mon, Jul 20, 2009 at 11:08 AM, tutu tugdual.huer...@gmail.com wrote: Hi, I have a pb while trying to display an image that is not in my application but on the file system!! I've tried to put this in my jsp: file:///%=request.getAttribute( /1.png/img and that too: html:image src=file:///%=request.getAttribute(imageLocation)%/1.png/ html:img src=file:///%=request.getAttribute(imageLocation)%/1.png/ (imageLocation reference D:/images) but nothing is displayed. Does anybody knows how to display an image that is not in the web application? thanks, tugdual -- View this message in context: http://www.nabble.com/Pb-displaying-image-tp24571593p24571593.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: action-method-validation
Do you mean, can I write a validateFoo() method for my foo() action method and be sure validateFoo() will run before foo() does? Yes. jk On Mon, Jul 20, 2009 at 11:45 AM, Louis Voo jl...@yahoo.com wrote: Hi, Does struts2 support action-method-validation ? Regards Louis -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: struts 2 adoption/performance/scalability
I don't have any benchmark numbers, but we're using it in production at my current client, running a b2b ecommerce site with about 3,000 active customers that pushed through about 4,000 orders in the last month. jk On Thu, Jul 16, 2009 at 7:12 PM, Musachy Barroso musa...@gmail.com wrote: I am trying to sell the idea of using Struts 2 to my employer, and I know these questions will come up: 1. Who is using it? 2. How does it perform, compared to plain servlets and jsps? 3. How well does it scale? 4. Has anyone benchmark it under load? numbers? 2-4 are somewhat related. I am sure many of you have gone through this before, so if you can share some info with me I would appreciate it (believe it or not I haven't built a production application with struts 2 yet) thanks musachy -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts2 + JPA - Lazy Initialization During View Generation
I think I missed the early part of the discussion -- I assume that the OpenEntityManagerInViewFilter is not the solution for you? jk On Fri, Jul 17, 2009 at 2:53 PM, Nathan Schulte nathan.schu...@ngc.comwrote: So is this the only resolution out there? To lazily initialize the contents I know I'll need before the container decides to trash the persistence context? There is no way to extend the context such that the lazy initialization will work when rendering the view? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: dynamic return when validation failed
On Thu, Jul 9, 2009 at 5:26 AM, mailtolouis2020-str...@yahoo.com wrote: Well, if I remove my validation code in the validate() method and put it into execute() method, then I can easily control which logical name to be return, but I thought that is not a good way to do that right? While this might not be a good way to do that, it's what I would do and in fact have done. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Interceptors and Thread safety
The easiest (I'm not saying best) way to ensure thread safety is to keep your data in method local variables, rather than in fields on the interceptor. Local variables are threadsafe. jk On Wed, Jul 8, 2009 at 9:08 AM, ravi_eze ravichand...@ivycomptech.comwrote: hi, http://struts.apache.org/2.x/docs/writing-interceptors.html says that interceptors are not thread safe, i wanted a deeper understanding on this. Case: 1. Suppose i have 2 action tags each having an interceptor (I) referenced in it 2. 2 action tags with interceptors referenced *twice in each* of them If interceptors are not thread safe then how many instances of the objects are created in the above cases. My common-sense says 2 4 objects respectively. Now, I have an interceptor which takes data from the struts.xml in the form of params tags. The value of these param tags are held in the interceptor class's field variables. I have this interceptor included in my struts.xml as said in the case1 and 2 above. Now on concurrent requests do i get threading issues? Please clarify. Is it thread safe if i dont put the field variables related to the internal processing of the class? i.e.. i have field variables only related to the param tags only and nothing more. Now is the interceptor thread safe? Kindly clarify. -- View this message in context: http://www.nabble.com/Interceptors-and-Thread-safety-tp24391223p24391223.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
dojo ajax tags -- post vs. get
Hi gang, We are taking our first steps into using the dojo tags, in a Struts 2.1.7 project (yes, we jumped too soon, I don't think it's entirely relevant). Specifically I've got an s:select tag set up, and when its value changes, I publish a dojo event (/changeFamily). A div is set up with sx:div as follows: s:form id=familySelection s:select name=familyId listKey=id listValue=name headerKey=0 headerValue=Select One list=familyList onchange=dojo.event.topic.publish('/changeFamily'); / /s:form s:url id=catalogContentsUrl action=catalog-contents/ sx:div formId=familySelection indicator=bigRotationImage href=%{catalogContentsUrl} listenTopics=/changeFamily (No family selected) /sx:div When I change a value in the s:select, however, Firebug tells me that the page is executing a GET rather than a POST. So the value of familyId never gets posted (breakpoints indicate that the setter does not run). What do I have to do in order to get the value of familyId to be posted? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: dojo ajax tags -- post vs. get
It turns out that the problem was solved by removing nesting form tags. I hadn't noticed, originally, that the familySelection form described below was wrapped by another form tag. When I unwrapped it, everything worked correctly. Let this be a lesson to you. Somebody. jk On Tue, Jul 7, 2009 at 3:36 PM, Jim Kiley jhki...@summa-tech.com wrote: Hi gang, We are taking our first steps into using the dojo tags, in a Struts 2.1.7 project (yes, we jumped too soon, I don't think it's entirely relevant). Specifically I've got an s:select tag set up, and when its value changes, I publish a dojo event (/changeFamily). A div is set up with sx:div as follows: s:form id=familySelection s:select name=familyId listKey=id listValue=name headerKey=0 headerValue=Select One list=familyList onchange=dojo.event.topic.publish('/changeFamily'); / /s:form s:url id=catalogContentsUrl action=catalog-contents/ sx:div formId=familySelection indicator=bigRotationImage href=%{catalogContentsUrl} listenTopics=/changeFamily (No family selected) /sx:div When I change a value in the s:select, however, Firebug tells me that the page is executing a GET rather than a POST. So the value of familyId never gets posted (breakpoints indicate that the setter does not run). What do I have to do in order to get the value of familyId to be posted? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: adding values to a variable inside iterator tag
Does it work if you replace the += with a +? jk On Wed, Jul 1, 2009 at 4:39 PM, Bhaarat Sharma bhaara...@gmail.com wrote: Does anyone know how to calculate the total value by making use of the s:set tag? On Mon, Jun 29, 2009 at 1:16 PM, Bhaarat Sharma bhaara...@gmail.com wrote: for our purpose i'd prefer doing it in the iterator tag. I tried something like this s:set name=calcTotalDebtAmt value=%{calcTotalDebtAmt+=totalDebtAmt}/ but this does not seem to work. what can fix this? On Mon, Jun 29, 2009 at 12:08 PM, Jim Kiley jhki...@summa-tech.com wrote: You're far better off doing it inside the Action class. That said, you can probably use s:set to get what you want. jk On Mon, Jun 29, 2009 at 12:03 PM, Bhaarat Sharma bhaara...@gmail.com wrote: Hi, I have a simple iterator tag like the following s:iterator value=results s:property value=value1/ /s:iterator is there a way to get the total of value1 at the end of this iterator tag? basically in java we would do totalValue += value1; and then at the end of the loop we would have total of value1. Is that possible to do with an iterator tag? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: adding values to a variable inside iterator tag
I don't know how Struts 2 tags work under the hood, but it's possible that it's going out of scope because you declared it in the iterator, or it's silently throwing an error because it isn't initialized. Before your s:iterator starts, do s:set name=calcTotalDebtAmt value=0/. This could be handled inside your action class with like two lines of code, of course, and as a side benefit you could write meaningful unit tests to be sure you'd gotten it right. jk On Wed, Jul 1, 2009 at 4:55 PM, Bhaarat Sharma bhaara...@gmail.com wrote: no :( I tried the following s:iterator value=resultList status=status s:text name=number.formats:param value = totalCount//s:text s:set name=calcTotalDebtAmt value=%{calcTotalDebtAmt+totalCount}/ /s:iterator and tried to print it s:property value=#calcTotalDebtAmt/ but it shows nothing :( On Wed, Jul 1, 2009 at 4:41 PM, Jim Kiley jhki...@summa-tech.com wrote: Does it work if you replace the += with a +? jk On Wed, Jul 1, 2009 at 4:39 PM, Bhaarat Sharma bhaara...@gmail.com wrote: Does anyone know how to calculate the total value by making use of the s:set tag? On Mon, Jun 29, 2009 at 1:16 PM, Bhaarat Sharma bhaara...@gmail.com wrote: for our purpose i'd prefer doing it in the iterator tag. I tried something like this s:set name=calcTotalDebtAmt value=%{calcTotalDebtAmt+=totalDebtAmt}/ but this does not seem to work. what can fix this? On Mon, Jun 29, 2009 at 12:08 PM, Jim Kiley jhki...@summa-tech.com wrote: You're far better off doing it inside the Action class. That said, you can probably use s:set to get what you want. jk On Mon, Jun 29, 2009 at 12:03 PM, Bhaarat Sharma bhaara...@gmail.com wrote: Hi, I have a simple iterator tag like the following s:iterator value=results s:property value=value1/ /s:iterator is there a way to get the total of value1 at the end of this iterator tag? basically in java we would do totalValue += value1; and then at the end of the loop we would have total of value1. Is that possible to do with an iterator tag? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: adding values to a variable inside iterator tag
I will bet one dollar that the amount of time it takes to calculate this value inside your Action class is less than or equal to the time it takes it to calculate the value inside the iterator in your JSP. And it's a vanishingly small amount compared to network latency. Unless you're writing code that's going to be hammered at the requests-per-second scale, optimizing out a for loop is not the best use of your time as a developer. When you're doing initial development, optimize in favor of readability and testability. Once you're in or close to production, analyze to find bottlenecks. Finding the sum of a bunch of values is not going to be your bottleneck. jk On Wed, Jul 1, 2009 at 5:03 PM, Bhaarat Sharma bhaara...@gmail.com wrote: but if I do it in my action class then I am adding extra 'time'. to begin with I anyways have to iterate over the list in my JSP. Just to calculate total if I iterate over the list again in java code then I am doing two iterations through the list. Just didnt seem very efficient for my need. Thanks for your suggestion!! :) On Wed, Jul 1, 2009 at 4:59 PM, Jim Kiley jhki...@summa-tech.com wrote: I don't know how Struts 2 tags work under the hood, but it's possible that it's going out of scope because you declared it in the iterator, or it's silently throwing an error because it isn't initialized. Before your s:iterator starts, do s:set name=calcTotalDebtAmt value=0/. This could be handled inside your action class with like two lines of code, of course, and as a side benefit you could write meaningful unit tests to be sure you'd gotten it right. jk On Wed, Jul 1, 2009 at 4:55 PM, Bhaarat Sharma bhaara...@gmail.com wrote: no :( I tried the following s:iterator value=resultList status=status s:text name=number.formats:param value = totalCount//s:text s:set name=calcTotalDebtAmt value=%{calcTotalDebtAmt+totalCount}/ /s:iterator and tried to print it s:property value=#calcTotalDebtAmt/ but it shows nothing :( On Wed, Jul 1, 2009 at 4:41 PM, Jim Kiley jhki...@summa-tech.com wrote: Does it work if you replace the += with a +? jk On Wed, Jul 1, 2009 at 4:39 PM, Bhaarat Sharma bhaara...@gmail.com wrote: Does anyone know how to calculate the total value by making use of the s:set tag? On Mon, Jun 29, 2009 at 1:16 PM, Bhaarat Sharma bhaara...@gmail.com wrote: for our purpose i'd prefer doing it in the iterator tag. I tried something like this s:set name=calcTotalDebtAmt value=%{calcTotalDebtAmt+=totalDebtAmt}/ but this does not seem to work. what can fix this? On Mon, Jun 29, 2009 at 12:08 PM, Jim Kiley jhki...@summa-tech.com wrote: You're far better off doing it inside the Action class. That said, you can probably use s:set to get what you want. jk On Mon, Jun 29, 2009 at 12:03 PM, Bhaarat Sharma bhaara...@gmail.com wrote: Hi, I have a simple iterator tag like the following s:iterator value=results s:property value=value1/ /s:iterator is there a way to get the total of value1 at the end of this iterator tag? basically in java we would do totalValue += value1; and then at the end of the loop we would have total of value1. Is that possible to do with an iterator tag? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts2 Bean Setter Attack
Why worry if an object at your view layer gets a value set on it? Your real processing should be occurring at a service layer underneath the view layer. Only copy data from the view down into your application if you really need for it to be copied down. jk On Tue, Jun 30, 2009 at 6:40 PM, smart acer smarta...@gmail.com wrote: We need an object for example CustomerData in session. We have configured it through struts2 xml, session scope. Base Action class has a getter and setter for this bean. getCustomerData(), setCustomerData() Since it has a setter on action class (setter is needed to put it on session thru struts2), we believe it is open to object setter attack through Form Post. One can for example post with customerData.address and struts2 would automatically set this data on the object. This attribute is suppose to be READ ONLY or ONLY System can set it, not from UI. Any idea how we can prevent this issue? I am surprised this kind of security issue is there with struts2, what are we missing? Is there a interceptor we need to configure to prevent this? Thanks -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: adding values to a variable inside iterator tag
You're far better off doing it inside the Action class. That said, you can probably use s:set to get what you want. jk On Mon, Jun 29, 2009 at 12:03 PM, Bhaarat Sharma bhaara...@gmail.comwrote: Hi, I have a simple iterator tag like the following s:iterator value=results s:property value=value1/ /s:iterator is there a way to get the total of value1 at the end of this iterator tag? basically in java we would do totalValue += value1; and then at the end of the loop we would have total of value1. Is that possible to do with an iterator tag? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: prepare{MethodName} not working
You probably have the @Override annotation on prepareSave(), and you don't need it. On Sat, Jun 27, 2009 at 11:40 AM, Praveen.V.Kumar praveenkuma...@spanservices.com wrote: Hi, While referring the below link I came to know that we can have prepare{MethodName}() that will run before the invocation of the particular method. http://struts.apache.org/2.1.6/docs/prepare-interceptor.html I was trying the same. In my action class, I have a save() method and the action class is implemented with Preparable Interface. But when I add prepareSave() I get a error The method prepareSave() of type ManageGeneralSetupAction must override or implement a supertype method. Do I need to override any other method or do I need to implement any other Interface? Please advice me on this. Thanks Praveen -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: prepare{MethodName} not working
Reread what I wrote: You probably have the @Override annotation on prepareSave(), and *you don't need it*. Delete the annotation. jk On Sat, Jun 27, 2009 at 11:52 AM, Praveen.V.Kumar praveenkuma...@spanservices.com wrote: I have the @Override annotations on prepareSave() but still it is saying The method prepareSave() of type ManageGeneralSetupAction must override or implement a supertype method -Original Message- From: Jim Kiley [mailto:jhki...@summa-tech.com] Sent: Saturday, June 27, 2009 9:20 PM To: Struts Users Mailing List Subject: Re: prepare{MethodName} not working You probably have the @Override annotation on prepareSave(), and you don't need it. On Sat, Jun 27, 2009 at 11:40 AM, Praveen.V.Kumar praveenkuma...@spanservices.com wrote: Hi, While referring the below link I came to know that we can have prepare{MethodName}() that will run before the invocation of the particular method. http://struts.apache.org/2.1.6/docs/prepare-interceptor.html I was trying the same. In my action class, I have a save() method and the action class is implemented with Preparable Interface. But when I add prepareSave() I get a error The method prepareSave() of type ManageGeneralSetupAction must override or implement a supertype method. Do I need to override any other method or do I need to implement any other Interface? Please advice me on this. Thanks Praveen -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Interceptor Use
This is a very appropriate use for interceptors. You might also want to look at Spring Security, which does this and a lot more without too much configuration pain. jk On Sat, Jun 27, 2009 at 12:25 PM, Robin Mannering ro...@mtndesigns.co.ukwrote: Hello, Struts 2.1.6 I wish to ensure a user is logged into an application before allowing him/her to execute certain tasks. Would using an Interceptor be a good way to go? My idea is to retrieve session data in the intercept() method of the interceptor and verify a certain attribute is held in the session. If it is not, I would then like to redirect the user to a login page with an appropriate error message. Is this an approriate use of interceptors? Previously, I simply had a verifyLoginStatus() method in a base action class which I extended in actions I wanted to protect. I'd appreciate any thoughts... Thanks Robin - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts2 - freemarker error
Please for the love of all that is good in the world don't actually post all that. On Thu, Jun 25, 2009 at 5:52 PM, Martin Gainty mgai...@hotmail.com wrote: please post all jsp pages, all freemarker template code ,all java code and configuration files of applicationContext.xml, decorators.xml, dwr.xml, sitemesh.xml tiles.xml,validation.xml, web.xml, struts-actionchaining.xml,struts-ajax.xml , struts-chat.xml, struts-conversion.xml, struts-filedownload.xml, struts-fileupload.xml , struts-freemarker.xml, struts-hangman.xml, struts-integration.xml , struts-interactive.xml, struts-jsf.xml, struts-model-driven.xml, struts-person.xml ,struts-tags-non-ui.xml, struts-tags-ui.xml, struts-tags.xml, struts-tiles.xml ,struts-token.xml,struts-validation.xml, struts-wait.xml , struts-xslt.xml,struts.xml, as well as all properties files of globalMessages.properties,globalMessages_de.properties,globalMessages_fr.properties ,log4j.properties,*Action.properties,*-conversion.properties so we may better help you determine your problem (please feel free to re-post if i missed any items) Martin Gainty __ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. From: kishanchellapaand...@spanservices.com To: user@struts.apache.org Date: Thu, 25 Jun 2009 19:09:07 +0530 Subject: Struts2 - freemarker error Hi, I'm using struts 2.1.6, xwork-2.1.2, freemarker 2.3.13, ognl 2.6.11 and jboss 5.0.1. I'm having one ftl, where I'm doing the following #list ${additionalMethods}?split(,) as additional #assign tmpInner${additional?trim?substring(0, additional?trim?index_of(:))}/#assign /#list But this gives me the following error: Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1938) at freemarker.core.StringBuiltins$substringBI$1.exec(StringBuiltins.java:213) I checked the length of the string which is 28 and the index_of : is 7. Also I tried, ${additional?trim?substring(0, 1)} - this also gives the above error. I don't know what the problem here is. Please advice. Thank you. Regards, Kishan.G Team Leader. www.spansystems.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Lauren found her dream laptop. Find the PC that’s right for you. http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290 -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Generating Dynamic radio button list
You need to provide Struts with an actual List (or Set or the like). It looks like you are providing a single String. You will need to parse that String out into a List of Strings in order for s:radio to treat it as a List. jk 2009/6/24 BlackKnight ar3...@gmail.com Hi, I am trying to generate a dynamic raido buttom list using s:radio name=%{optionname} list=%{optionvalue} / where optionvalue is stored in database equal #{'Faculty':'FacultyBR','Staff':'StaffBR','Resident':'ResidentBR','Intern':'InternBR'} however struts2 doesn't generate the radio button list intead he generate only 1 radio button with value equals #{'Faculty':'FacultyBR','Staff':'StaffBR','Resident':'ResidentBR','Intern':'InternBR'} Any help? Thanks! Frank - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Exceptions thrown by constructor different from those thown by execute() ?
Presumably the code calling execute() wraps it in a try/catch, but the call that is instantiating the action in the first place doesn't do that. You'd have to look at the source to be sure, but of course that's the nice part about working on open-source projects. From a philosophical perspective, though -- no clue, I don't have a lot of insight into why the devs make all the decisions they make. jk On Tue, Jun 23, 2009 at 5:12 AM, Jan T. Kim j@uea.ac.uk wrote: On Tue, Jun 23, 2009 at 06:41:48AM -0200, Pawe? Wielgus wrote: Hi Jan, i'm not going into details of your solution but interceptors are a way better tool for that job, search the list for authentication subjects. You can also use libraries like acegi or similiar. thanks for this pointer, I agree that this is probably a bad example as such ad-hoc development of authentication mechanisms isn't really a good idea. My question is about exception handling in general, though: Why does my handler work as expected when the exception is thrown by execute(), but not when it's thrown by the constructor? Having run into this, I'd like to understand it before moving on. Best regards, Jan 2009/6/22, Jan T. Kim j@uea.ac.uk: Dear All, I'm trying to use exceptions to make sure a user is logged in, using struts 2.1.6. My idea is * a subclass of ActionSupport that checks that a user is logged in, and throws a NotLoggedInException if that's not the case * all other action handlers are subclasses of that subclass * use a global exception mapping to map the NotLoggedInException to a suitable login action I can't seem to get this to work, I get a 500 response with a stack trace, saying Unable to instantiate Action. If I arrange for the constructor to complete without an exception and for the execute() method to throw a NotLoggedInException, I get to the login action as I intend. So it seems that only exceptions thrown by execute(), but not those thrown by constructors, are handled as specified by the exception mappings (at least the global ones) -- is that right? And if so, why is that? Or do you thing I've just made some silly mistake here? Best regards, Jan -- +- Jan T. Kim ---+ | email: j@uea.ac.uk | | WWW: http://www.cmp.uea.ac.uk/people/jtk | *-= hierarchical systems are for files, not for humans =-* - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- +- Jan T. Kim ---+ | email: j@uea.ac.uk | | WWW: http://www.cmp.uea.ac.uk/people/jtk | *-= hierarchical systems are for files, not for humans =-* - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Display only 100 chars of a string
This seems like the kind of thing that is crying out for a custom tag -- and I don't say that lightly. I mean, a scriptlet could do it, but scriptlets are from the devil. A custom tag would be a better solution, especially since this is a pretty general problem. jk On Mon, Jun 22, 2009 at 11:37 AM, Stefano Tranquillini stefano.tranquill...@gmail.com wrote: Hi all. there's a possibility inside a jsp to display only the first 100 chars or the first 10 words of a string? if i have a long string, can i display only the first 100 chars directly in a jsp without modification in action or something like that? thanks -- Stefano - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts2 and Security
I can't speak in too much depth about JAAS in general, nor about certain aspects of Acegi, but we've been using Acegi (now Spring Security) in production with a Struts 2 site for a couple of months and we are very pleased with the relative ease of implementation. Without knowing what you want out of a security system I can't really provide more information. We're using Spring Security to access a few simple database tables that provide user authentication and authorization info. I haven't tried integrating it with the client's Active Directory setup yet so I can't speak to clever stuff like that. jk On Fri, Jun 19, 2009 at 3:20 AM, aum strut aum.str...@gmail.com wrote: Hi All, We are on the way to develop a new application using struts2. Currently we are analysing the area of authentication and authorization, we do have some options of using the following frame work for these 1) Acegi 2)JAAS my point is that we any one in the list is using any of the security frame work.please let me know about there experiences, so that it will help us in choosing the right security model. regarding the pltfrom we have decided to use is as follows 1) Struts2 2) JSP/Velocity 3) Hibernate 4) YUI these are the core building block rest technologies and frame work can be choosen as required looking forward for your valuable suggestions. thannks in advance aum -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts2 and Security
Hi Farshad, I hope you don't mind that your direct email to Todd went to the whole list. jk On Fri, Jun 19, 2009 at 8:02 PM, Farshad Rabbani farshadrabb...@hotmail.com wrote: Hi Todd, I hope you don't mind that I am emailing you directly. I am about to start work on an immigration project for Belize using Struts2. I am new to struts but wanted to use it for this project. I am using MySQL for my database and have 30+ tables. I also have a table for users, password etc. However, after reading your post, I became very interested in using jsecurity instead of having to worry about implementing authentication etc. myself. I have downloaded the zip file from the URL you provided. However, I was wondering if it is possible that I see some sample of your app where you actually use jsecurity with struts2. I am clueless about how to combine jsecurity with struts and also how to incorporate it with my existing database etc. I usually learn better by seeing a working example where I can adapt ideas of it to suite my needs. If it is not too much trouble, could you send me some aspects of your struts2 project where you used jsecurity? I would appreciate your help greatly. Thank you for any assistance you can provide. Kind Regards, Farshad Rabbani Subject: RE: Struts2 and Security Date: Fri, 19 Jun 2009 08:27:38 -0500 From: tkoff...@ku.edu To: user@struts.apache.org I developed an webapp about a year ago, using struts 2 and a security package called (at the time) jsecurity. Since then, jsecurity has become an apache project and has been renamed Apache Ki/Shiro. I guess that there was a naming conflict with the Ki name, so it is now called Apache Shiro (as of very recently). http://www.jsecurity.org/ (old independent website) http://incubator.apache.org/ki/ (apache website - probably soon to be renamed shiro) Naming issues aside, this was an excellent security package providing authentication and authorization that was pretty easy to learn, flexible, and very powerful. The support that I received from the project's founders was second to none (Thanks Les Jeremy!). One of my colleagues here at KU, Bruce Phillips, has also posted some tutorials (linked to from the apache website) to get you started. You should really check into it. Todd Kofford tkoff...@ku.edu University of Kansas - IT -Original Message- From: aum strut [mailto:aum.str...@gmail.com] Sent: Friday, June 19, 2009 2:20 AM To: Struts Users Mailing List Subject: Struts2 and Security Hi All, We are on the way to develop a new application using struts2. Currently we are analysing the area of authentication and authorization, we do have some options of using the following frame work for these 1) Acegi 2)JAAS my point is that we any one in the list is using any of the security frame work.please let me know about there experiences, so that it will help us in choosing the right security model. regarding the pltfrom we have decided to use is as follows 1) Struts2 2) JSP/Velocity 3) Hibernate 4) YUI these are the core building block rest technologies and frame work can be choosen as required looking forward for your valuable suggestions. thannks in advance aum - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009 -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: how to prevent users from directly accessing jsp files
Put the JSPs under /WEB-INF/ and refer to them as the destination of your Struts action results. jk On Thu, Jun 18, 2009 at 9:32 AM, abhishek reddy abhishek.c1...@gmail.comwrote: how to prevent users from directly accessing jsp files, rather they have to come thru sturts action? -- Abhishek -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts Flow in JSP,Servlets Project
RTFM is an English acronym best summarized as please read the documentation. By service routines what he means is this: Instead of writing an Action code that has your DB access code directly in it, write a service class that has DB access code in it, and have your actions call the service class's methods. That lets you reuse the DB access code, and keeps the processing in the Action class focused on the user interface. That makes development and maintenance far easier. jk On Wed, Jun 17, 2009 at 2:29 AM, sprani.kmraj sprani.km...@gmail.comwrote: Dear volker, Thank you so much. This is what i expected... Now i understood the things. Can u please tell me that, what you r mean by service routines RTFM. U r telling that DB access code should be in Action class, right So, where the Prepared statements should be in? what are all the things should be there in Servlet java Bean? Please explain. regards, Rani. Volker Karlmeier wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, 1) your submit button should submit to some action defined in struts.xml. 2) your action class is called (if you have not specified any other, execute is called. 3) the result of your action specifies, which jsp is called next your code for accessing the DB should be called in 2) (better call some service routines that access the database). for more information: RTFM Regards volker sprani.kmraj schrieb: Dear All, GoodDay...! Im beginner for Struts programming. I hv started developing a Struts project. I have many doubt can u please clarify my doubt i have a jsp page which contains the input data(name password). When i click the submit button, data will have to store in the database. i usally used to write DB connection code definition of DB(prepared Statements) in servlet. But while using struts Where i have to write the code for DB connection definition... When i click the submit button in JSP... what is the flow in the struts project. What are all the required files(servlets,java bean,action class,action form like that...) Please tell me the flow I hv refered many books... but i didnt get the answer to my point -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFKOCfYaEMQXBIqssERAsBiAJ9p5OK8mMT02ENsl9zFd4InzMCKhwCffefs d3wcCN/k+pbpxOHGOgdswXI= =Cwon -END PGP SIGNATURE- - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Struts-Flow-in-JSP%2CServlets-Project-tp24054020p24067708.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Save web page as pageName.doc
On Tue, Jun 9, 2009 at 4:31 PM, Dave Newton newton.d...@yahoo.com wrote: Jim Collings wrote: It's a report and the requirement I'm trying to satisfy is that you have to be able to save it as a MS Word *.doc file. What I've discovered is that you can take a stand-alone html file (i.e. no external files like images or CSS etc. ) change the file extension from *.html to *.doc and double clicking opens it in Word without any trouble. Only if your machine is configured to open up HTML files in Word, which strikes me as completely bizarre. Just for fun I just tried it -- made a trivial HTML file, named it foo.doc, and double-clicked, and it did open in Word. Properly formatted and so on too. Word is happy to open HTML files. It loves you and it wants you to be happy. jk
Re: Save web page as pageName.doc
On Tue, Jun 9, 2009 at 6:25 PM, Dave Newton newton.d...@yahoo.com wrote: Jim Kiley wrote: Just for fun I just tried it -- made a trivial HTML file, named it foo.doc, and double-clicked, and it did open in Word. Properly formatted and so on too. Word is happy to open HTML files. It loves you and it wants you to be happy. On *your* machine, perhaps. On all my Windows machines an HTML file will, by default, open in Firefox, or on a work machine I have no control over, IE. That surprises me, since I had always assumed that Windows based the application of choice on the file extension. I wonder what other guidance is being used. Content-type? This is reasonable behavior: it's a web page, not a word processor document. Unless you are controlling deployment, you don't have control over what a user's machine will open an HTML file in on a double-click. This I totally agree with. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Iterating over a List of Lists
I had no idea I was in the presence of royalty. On Tue, Jun 2, 2009 at 10:29 AM, Dave Newton newton.d...@yahoo.com wrote: DavidCAIT wrote: My JSP code looks like: s:iterator value=myList status=outerStat s:iterator value=myList[#outerStat.index] status=innerStat s:textfield value=%{property} name=myList[%{#outerStat.index}][%{#innerStat.index}].property/ /s:iterator /s:iterator I did something very similar to this quite some time ago, although it was actually a little worse (another layer, the name of one of the properties was dynamic) and was crowned the King of OGNL for my efforts. Maybe search the archives--there shouldn't be an issue doing things like this if things are set up right. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: why doesnt iterator tag provide 'next'
Assuming that you're iterating over a List, why not instead iterate over a List of Integers, and use those Integers as the index to your iterator? You can increment the counter inside the iterator. Or if you need to get foo[0] and foo[1] on the first run through, foo[2] and foo[3] on the next run, you could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and dataList [i + 1]. It's easy enough to dynamically generate the List of Integers in your action class. jk On Sun, May 31, 2009 at 9:58 AM, Bhaarat Sharma bhaara...@gmail.com wrote: sadly in my case i need to :( But this takes us back, the pseudocode you are suggesting is not possible using s:iterate, I dont think we have the ability to move the cursor (or current value in top stack) withtin the iterator tag. Neither does jstl provide this. So sadly, will my code have to sit back in time and use scriptlets. On Sun, May 31, 2009 at 9:49 AM, Dave Newton newton.d...@yahoo.com wrote: Bhaarat Sharma wrote: how would 'if' help with 'next'. can you please give an example? Pseudocode Java; this is something people should be able to figure out for themselves. In JSP I might just use the index. for (Foo curr : foos) { if (alt) { ... } else prev = curr; alt = !alt; } OTOH, I'd probably never *need* to do this. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: why doesnt iterator tag provide 'next'
I figured. The solution to I can't solve this problem is rarely let's add a new tag to the framework. jk On Sun, May 31, 2009 at 10:08 AM, Dave Newton newton.d...@yahoo.com wrote: Jim Kiley wrote: Assuming that you're iterating over a List, why not instead iterate over a List of Integers, and use those Integers as the index to your iterator? You can increment the counter inside the iterator. Or if you need to get foo[0] and foo[1] on the first run through, foo[2] and foo[3] on the next run, you could iterate over a List {0, 2, 4, 6, 8...} and get dataList[i] and dataList [i + 1]. It's easy enough to dynamically generate the List of Integers in your action class. Yep--that was the just use the index bit, but I'm grumpy today and didn't feel like spelling it out :) Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: [s2] strange (for me) OGNL behavior
Whenever you click an HTML button with your mouse, the browser will submit the X and Y coordinates of the area that you clicked. This is to support image maps. By giving the submit button a name (I think), the browser tries to provide those X and Y coordinates with respect to the button's name (thus name.x and name.y). Struts is trying to parse those input parameters but because you probably don't have an object in your action class that has the name that your submit button has, it is lost. This error won't actually cause you any real problems, but if you want to get rid of it I think you'll want to get rid of the 'name' attribute on your submit button. jk On Fri, May 29, 2009 at 5:46 AM, kindl...@arcor.de wrote: Hi, OGNL is a great mystery for me. It does magic and - well - strange things. :-) Perhaps you can help me out. The situation: I have a S2 (2.16) site where I use on some pages a form like this: s:form action=SatImgWetterSWR acceptcharset=UTF-8 s:textfield id=plzs_searchterm name=plzs_searchterm value=PLZ/Ort eingeben cssClass=dimmedInput onfocus=setActiveClass();/ s:submit type=image src=pages/img/nav/dosearch.gif id=plzs_submit name=plzs_submit cssStyle=margin-left: 5px; / /s:form This works great. The problem: when pressing the Submit-button, Struts throws exceptions that it (OGNL) cannot set the properties x and y which do not exist. This does not stop my app from working, its just ugly. Looking a bit into the problem I found that the form tries to transfer plzs_submit.x and plzs_submit.y and this causes the problem. I am puzzled. Any explanation and hint for stopping this will be greatly appreciated. Martin +--- Dipl. inf. Martin Kindler Julius-Leber-Str. 8 D-76448 Durmersheim Tel. +49 (0)7245 80 48 774 GSM +49 (0)160 977 636 14 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: I need to set s:property value in the action class
As a side note to Dave's point, opening a unique database connection within every execute() method of every action class is an extraordinary waste of your time, and will make debugging pretty painful. You'd be much better off writing a single service object to handle that stuff for you, and call the service object from your action classes. On Sun, May 24, 2009 at 9:53 AM, Dave Newton newton.d...@yahoo.com wrote: Prashant Singh wrote: s:iterator value=products trtda href=astralpharma/showpdtsupp.action s:property value=productName//a/td/tr /s:iterator There are a few ways to do it; here's two. s:iterator value=products a href=astralpharma/showpdtsupp.action?productId=s:property value='productId'/ s:property value=productName/ /a s:url var=pidUrl action=showpdtsupp namespace=/astralpharma s:param name=productId value=productId/ /s:url a href='s:property value=pidUrl/' s:property value=productName/ /a /s:iterator All of these topics are covered in the Struts 2 documentation, which I'd recommend reading before getting too much further into your project. There are at least a couple more variations, but this should be enough to get you started. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: How to keep information when a auto-checked type is done by struts?
You could access category with #session.category if I remember my OGNL right. Or you could add a 'category' field to your Action class, with public getter and setter, and then, instead of putting cat into the session, you could do this.setCategory(cat) -- and then your JSP would work fine. On Tue, May 19, 2009 at 11:02 AM, Stefano Tranquillini stefano.tranquill...@gmail.com wrote: So, i've done this: there's a init action that does: public String execute() throws Exception { Map session = ActionContext.getContext().getSession(); List cat = mgmt.getAllCategory(); session.put(category, cat); return SUCCESS; } after that a jsp is display: %@ taglib uri=/struts-tags prefix=s % s:form action=addItem namespace=/admin method=POST s:actionerror/ s:textfield name=title label=title required=true/ s:select label=category name=category list=category listKey=idCategory listValue=name multiple=false headerValue=-- Please Select -- required=true / s:textarea cols=15 rows=5 name=desc label=desc required=true/ s:textfield name=prize label=prize required=true/ s:textfield name=quantity label=quantity required=true/ s:submit/ /s:form but the problem is: tag 'select', field 'list', name 'category': The requested list key 'category' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] ideas? On Sat, May 9, 2009 at 14:19, Stefano Tranquillini stefano.tranquill...@gmail.com wrote: On Sat, May 9, 2009 at 00:49, Dave Newton newton.d...@yahoo.com wrote: Stefano Tranquillini wrote: i've a form. i've some field that are double type. if i put a string inside these fileds struts automatically check the incorrectness of the type. ok! but, inside this form i've a select that is created by a list. when the error comes out from struts, sruts goes back to the input page, the list become empty and in the page no item is display. how can i store the list in order to have its inside my page after the error? You could store it in session, you could implement Preparable and load the list. There are probably a few other reasonable solutions--those are what popped in to my head first. a ok, i thought about the same solution. PS: if i set required=true at a field, struts doesn't check if this value is present or not? what meaning has this property? From the documentation: If set to true, the rendered element will indicate that input is required It displays a required indicator. so only display a * near the label Dave ciaociao -- Stefano -- Stefano - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Problem dispatching in /content dir
What I've done in this situation is put in the dummy action. Inevitably I find myself needing some kind of pre-processing before the JSP is loaded up -- even when I don't initially believe that I will -- and the dummy action is the right place for it. jk On Fri, May 15, 2009 at 7:40 AM, Jim Collings jlistn...@gmail.com wrote: Here's a bit of clarification: page-one.jsp which is in /content | \-page-two --Have to use this to access page two because it, also is in /content. This means calling an empty execute(). | \-page-two.jsp | \page-two --Page two action page-two!dosomething Now I could put in a dummy action that just forwards to page-two.jsp but why? It seems like there should be a better way. Jim C. On Fri, May 15, 2009 at 7:16 AM, Jim Collings jlistn...@gmail.com wrote: So I have a jsp that needs to submit to another jsp. Both are in /content. When I use file-name.jsp I get 404. When I use file-name, I get the action that file-name.jsp submits to. Any ideas on how I can work around this? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Problem dispatching in /content dir
If you're using annotation-based results, and you extend ActionSupport, the dummy action class is just a few lines -- it has no class body at all. jk On Fri, May 15, 2009 at 9:53 AM, Jim Collings jlistn...@gmail.com wrote: I take it back. I only thought I had it figured out. I'll use the dummy action. I find it distasteful but it seems the best way. Jim C. On Fri, May 15, 2009 at 9:07 AM, Jim Kiley jhki...@summa-tech.com wrote: What I've done in this situation is put in the dummy action. Inevitably I find myself needing some kind of pre-processing before the JSP is loaded up -- even when I don't initially believe that I will -- and the dummy action is the right place for it. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Disabling JSP's
Put the JSP under /WEB-INF -- it is accessible to Struts routing but not directly viewable by end clients. jk On Fri, May 15, 2009 at 2:36 PM, Timothy Orme to...@genome.med.harvard.eduwrote: Hello All, I'm in the process of migrating pages from JSP's using snippets to struts actions. I'm wondering how people have disabled access to JSP's so that they cannot be accessed outside of the action anymore. Right now if I have an action like: action name=ViewIndex class=action.BaseAction result name=success/private/index.jsp/result /action There is nothing preventing the user from just browsing directly to /private/index.jsp instead of accessing it through the Action URL. This could have some bad implications about security, but also might just look bad if a page that should be receiving data from an action no longer has the source. How have people worked around this in the past? -Tim Orme - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: struts2+spring+hibernate, objects instantiate order?
1) is correct. I can't tell you the number of times that, on app startup, I've gotten reams and reams of error messages because Spring couldn't instantiate some bean or another.2) is both -- which you could determine for yourself pretty easily by putting a logging statement in the action's constructor. jk On Wed, May 13, 2009 at 10:03 PM, ren sky byzh...@gmail.com wrote: 1) before running my project, spring has already instantiate all the object defined in the applicationContext.xml? such as LoginAction,PersonServiceImpl and sessionFactory? 2) the action used in struts2 is instantiated before a request comes in? or is instantiated when a real request comes in? 3) with spring,what is the role of struts2 ? it seems that the responsibility of instantiate object is changed to spring, not struts2. thanks. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: How do I get a request header
ServletRequestAware? jk On Tue, May 12, 2009 at 9:03 AM, Jim Collings jlistn...@gmail.com wrote: Hmmm... So there isn't already an HeaderInterceptor? Seems odd. Jim C. On Tue, May 12, 2009 at 8:54 AM, Struts Two struts...@yahoo.ca wrote: Here is one way I did to get Authorization value in the header: 1- Define an interceptor that retrieves HttpServletRequest 2- Define an interface ,say HeaderAware. 3- In your interceptor retrieve related values from Header and then inject it into your action if it implements HeaderAware. That should do it. --- On Tue, 5/12/09, Jim Collings jlistn...@gmail.com wrote: From: Jim Collings jlistn...@gmail.com Subject: Re: How do I get a request header To: Struts Users Mailing List user@struts.apache.org Received: Tuesday, May 12, 2009, 12:40 PM I am also trying to retrieve an item in the header so that I can place it in the value stack. Any ideas on how best to accomplish this? Jim C. On Tue, May 12, 2009 at 8:37 AM, Norris Shelton norrisshel...@yahoo.com wrote: I looked in the interceptors and did not see one that pulled the heders. Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Shelton Consulting, LLC ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: default class to forward requests
It is ActionSupport. When you don't have access to a book you may find that you get faster results from Google[1] or the introductory documentation[2] than the mailing list. jk [1] http://www.google.com/search?rlz=1C1GGLS_enUS291US303sourceid=chromeie=UTF-8q=struts+2+action+class+execute+success+default [2]http://struts.apache.org/2.1.6/docs/hello-world.html On Tue, May 12, 2009 at 11:15 AM, Bhaarat Sharma bhaara...@gmail.comwrote: Is there a default class that we can use in struts.xml that can be used for just forward request to a new html page. Basically user clicking a link and going to a new page. I dont want to make an execute method that just returns SUCCESS. Rather there must be some default class that does that. I read about it in a struts2 book, however, dont have that book with me right now for reference. Does someone know what the class is called? -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Please help! Struts 2/Eclipse - List Object is not displaying in JSP
Even then it won't be OK. The OP is declaring myList as a local variable in getAllEmployees(), so getMyList won't return it. Change the line ListString myList = new ArrayListString(); in getAllEmployees() to just be myList = new ArrayListString(); and do as Lukasz suggests and you should be OK. jk On Thu, May 7, 2009 at 11:57 AM, Lukasz Lenart lukasz.len...@googlemail.com wrote: 2009/5/7 SofIAm sof.am...@yahoo.com: public String getAllEmployees() { This method is never called, renamed it to execute() and should be ok Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Please help! Struts 2/Eclipse - List Object is not displaying in JSP
The checkstyle, FindBugs, or PMD plugin does this for sure. On Thu, May 7, 2009 at 8:50 PM, Dave Newton newton.d...@yahoo.com wrote: SofIAm wrote: Thank YOU ALL! What a dumb JAVA 101 mistake! I was never populating the class member variable myList, but the local one in my method, unintentionally of course. DUH!!! It's working like a charm! Thanks again! There is a warning available in Eclipse to notify you when a local variable shadows a property. (I think.) Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: action call getting skiped
Just re-forwarding your message to the list won't necessarily improve the chances of its being responded to. Your message is hard to read and understand. That is probably why no one responded to it in the first place. It seems likely that the problem does not lie in your interceptor stack but rather in your action code or in your JSP. Can you please confirm that the unit tests you wrote for your action code validate that your action code functions as designed? jk On Mon, May 4, 2009 at 4:26 PM, srinivasa_v . srinivas...@sify.com wrote: -- Forwarded message -- From: srinivasa_v . srinivas...@sify.com Date: Mon, May 4, 2009 at 11:45 AM Subject: action call getting skiped To: Struts Users Mailing List user@struts.apache.org Hi ALL, I have list of emp details,I need to click on one of emp record,it will call an action class get the details from db display on the form,and edit the details and when i click on submit ,it will call an action calss where in based on DOB i need to redirect to and action say if age is 18 , i need to go to page ,where in I will have Yes and no button,if user clicks on yes,it goes to action class ,and call manager class BO ,and update detils in DB and call return back to action and goes to sucess page. for the first time its working fine , when I try to udate the same emp details again, same record age is 18 it will go to yes and no page ,when I click on yes now instead of going to action class, it is direcly going to sucess page, action name=DOBWArning method=update class=com.dh.action.client.EMPCRUDAction interceptor-stack name=gosInterceptor interceptor-ref name=prepare/ interceptor-ref name=chain/ interceptor-ref name=i18n/ interceptor-ref name=modelDriven/ interceptor-ref name=fileUpload/ interceptor-ref name=params/ interceptor-ref name=basicStack/ interceptor-ref name=validation/ interceptor-ref name=workflow/ interceptor-ref name=roles param name=allowedRoles2,3/param /interceptor-ref result name=DATA_SUCCESS../common/Confirm.jsp/result result name=FAILURE../common/Error.jsp/result result name=SUCCESS../common/success.jsp/result /action This a production issue for me , and this is occcuring when I try to go thru www.balbal.com, and in production iam going thru F5, and its working fine if I direcly access my ipaddress, and we have another module in prodution which is based on purely on servlets and jsp ,having similar flow , and its working fine . is any of the interceptors having cache problem regrads. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: How to develop a Wireframe using Struts UI?
The members of this mailing lists are users and volunteers; they are not very likely to take a lot of their personal time to provide step-by-step instructions based on an image file. Specific questions are welcome but general queries like this are not liable to get the detailed response that you are hoping for. jk On Thu, Apr 30, 2009 at 11:40 AM, kunduruswaroop swaroo...@hotmail.comwrote: Please see the UI drawing below and let me know the steps to follow to develop a wireframe. I need a expand and collapse version too as shown picture below. http://www.nabble.com/file/p23318872/Temp1.PNG Temp1.PNG Thanks in advance. Regards, Swaroop Kunduru -- View this message in context: http://www.nabble.com/How-to-develop-a-Wireframe-using-Struts-UI--tp23317576p23318872.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: pagination in struts2
Lots of possibilities here:* you need to have a class named TestList in your application * you need a constructor for your TestList class that accepts an int and a boolean as its arguments * you need to be sure you are appropriate importing the reference to TestList in your JSP On Thu, Apr 23, 2009 at 11:36 AM, Stefano elste...@gmail.com wrote: when i put % request.setAttribute( test, new TestList(2, false) ); % netbeans said: cannot find construtcto TestList(int,bool) and the application goes in a exception: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 1 in the jsp file: /jsp/shop/shop.jsp TestList cannot be resolved to a type 1: % request.setAttribute( test, new TestList(2, false) ); % 2: %@ taglib uri=/struts-tags prefix=s % 3: 4: idea? 2009/4/23 André Diniz adi...@gmail.com: It's just a sample pages... 2009/4/22 Dave Newton newton.d...@yahoo.com http://displaytag.sourceforge.net/1.2/tut_externalSortAndPage.html It pays to really spend some time looking over existing documentation; it's often quicker than waiting for someone on a list or forum to answer. Dave Bhaarat Sharma wrote: jim, I found this example http://displaytag.homeip.net/displaytag-examples-1.2/example-paging.jsp?d-49653-p=1 it says Ok, you have made a query that returns you back a list of 120 elements, but you don't want to show the user all 120 items at once, you want to allow them to page through the results (pretend 120 is really 1200 or 12000). they are iterating through a long 12000 record list and then just putting that into pages. What I was looking for was something that would show 50 results of 12000 on first page then when NEXT is cliked, it against goes to DB to get next 50 records. On Wed, Apr 22, 2009 at 4:22 PM, Jim Kiley jhki...@summa-tech.com wrote: I found this within thirty seconds of clicking Dave's link: http://displaytag.sourceforge.net/1.2/tut_sources.html Note that the contents of this page are actually fairly freakin' horrible and should not be done on a grownup application. But the instructions are right there and easy to find. jk On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma bhaara...@gmail.com wrote: I wanted to use it for the purpose so that when I click NEXT or 2nd page then again I go to the DB to fetch next set of 50 records. but didnt see any examples of that sort On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton newton.d...@yahoo.com wrote: Stefano Tranquillini wrote: someone has experience with this tag? i don't really understand how it works. What issues are you having? There are a number of tutorials and examples on the site: http://displaytag.sourceforge.net/1.2/tut_basic.html Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- André Diniz +55 (41) 9997-5567 e-mail alternativo: diniz...@msn.com -- Stefano - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: pagination in struts2
I found this within thirty seconds of clicking Dave's link: http://displaytag.sourceforge.net/1.2/tut_sources.html Note that the contents of this page are actually fairly freakin' horrible and should not be done on a grownup application. But the instructions are right there and easy to find. jk On Wed, Apr 22, 2009 at 4:18 PM, Bhaarat Sharma bhaara...@gmail.com wrote: I wanted to use it for the purpose so that when I click NEXT or 2nd page then again I go to the DB to fetch next set of 50 records. but didnt see any examples of that sort On Wed, Apr 22, 2009 at 4:13 PM, Dave Newton newton.d...@yahoo.com wrote: Stefano Tranquillini wrote: someone has experience with this tag? i don't really understand how it works. What issues are you having? There are a number of tutorials and examples on the site: http://displaytag.sourceforge.net/1.2/tut_basic.html Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: how remain in the same page
Are you recommending testing a user's privileges in the untrusted, untrustworthy, totally hackable client code? Really? On Tue, Apr 21, 2009 at 10:43 AM, elyes sallem elyes.sal...@gmail.comwrote: of course u make the test , in a javascript function, in your jsp Elyes 2009/4/21 elyes sallem elyes.sal...@gmail.com hi Stefano , in fact , i choosed to back to one page in every case, that's ok for me if u wanna remain in the same page u can declare a getter for a member in the form let's say test1 so in getTest1(){ you make the treatment u want and return a boolean resultat for example if true, u submit to an action else u don't submit and u declare test1 in the jsp page as a hidden field htm:hidden property=test1: like this u can remain in the same page and invoke only your action when the returned result is ok wish i was clear Regards Elyes } 2009/4/21 Stefano elste...@gmail.com have u solved? i've the same issues to do. On Mon, Apr 20, 2009 at 16:29, elyes sallem elyes.sal...@gmail.com wrote: Hello, i have a struts application, which can be used by different user profile among the profile, there is one who can access some pages so if he try to access to one page , i will diplay a warning message in the depart page so, i wanna know , after checking the user profile in the action, how can i forward him to the source page, i.e he remains in the same page, and i will display a warning message to inform him that this page is inaccessible Thanks Regards Elyes -- Stefano -- Elyes. -- Elyes. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: How to do matematical operation in jsp.
EVIL, wow, sounds serious. On Tue, Apr 21, 2009 at 12:02 PM, Lukasz Lenart lukasz.len...@googlemail.com wrote: 2009/4/21 Suneel sunee...@gmail.com: I'm not sure about this but can't you invoke a function in OGNL. I guess thats how the getText function works in ognl. Probably you can write a function in your action like getResult and invoke it using s:property value=getResult(key.price,value)/ Correct me if i'm wrong. Yes you can do that, but it's EVIL! DON'T DO THAT!!! Business logic has to be in your business model, not in a presentation layer! Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: struts2 show question
Have you tried writing a unit test to ensure that testList is populated after your action executes? I'm pretty sure you'll find that it isn't. It looks to me like you're declaring testList to be a local variable within your action method (you're doing List testList = instead of testList = ). So your local testList goes out of scope as soon as the action method is done executing. You need testList to be a field of your action, not a local variable. jk On Mon, Apr 20, 2009 at 12:01 PM, red phoenix rodphoe...@gmail.com wrote: I have a table named mytable,it has two cols,col1 and col2,the data are col1 col2 --- John 24 Kate 18 hibernate xml file is follows: hibernate-mapping auto-import=false class name=mytable table=mytable id name=col1 column=col1 type=java.lang.String generator class=assigned/ /id property name=col2 type=java.lang.String column name=col2 / /property /class /hibernate-mapping Then I user struts2 to get the data by following statement: List testList=this.getHibernateTemplate().find( from mytable); request.setAttribute(testList,testList); return SUCCESS; the action dispatch to following jsp page table c:forEach var=test items=${testList} trtd c:out value=${test.col1}/c:out c:out value=${test.col2}/c:out /td/tr /c:forEach /table Above codes run well,it can show correct result John 24 Kate 18 then I modify struts action,like following: List testList=this.getHibernateTemplate().find( select col1,col2 from mytable); request.setAttribute(testList,testList); return SUCCESS; the action dispatch to the same jsp,but this time,the jsp show nothing! Why? I don't understand what's wrong with my code? Anyone could help me to solve above problem? Thank -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: struts2 show question
Oh heck I misread your code there. This is Struts 1 and not Struts 2, isn't it? Sorry about that. jk On Mon, Apr 20, 2009 at 12:08 PM, Jim Kiley jhki...@summa-tech.com wrote: Have you tried writing a unit test to ensure that testList is populated after your action executes? I'm pretty sure you'll find that it isn't. It looks to me like you're declaring testList to be a local variable within your action method (you're doing List testList = instead of testList = ). So your local testList goes out of scope as soon as the action method is done executing. You need testList to be a field of your action, not a local variable. jk On Mon, Apr 20, 2009 at 12:01 PM, red phoenix rodphoe...@gmail.comwrote: I have a table named mytable,it has two cols,col1 and col2,the data are col1 col2 --- John 24 Kate 18 hibernate xml file is follows: hibernate-mapping auto-import=false class name=mytable table=mytable id name=col1 column=col1 type=java.lang.String generator class=assigned/ /id property name=col2 type=java.lang.String column name=col2 / /property /class /hibernate-mapping Then I user struts2 to get the data by following statement: List testList=this.getHibernateTemplate().find( from mytable); request.setAttribute(testList,testList); return SUCCESS; the action dispatch to following jsp page table c:forEach var=test items=${testList} trtd c:out value=${test.col1}/c:out c:out value=${test.col2}/c:out /td/tr /c:forEach /table Above codes run well,it can show correct result John 24 Kate 18 then I modify struts action,like following: List testList=this.getHibernateTemplate().find( select col1,col2 from mytable); request.setAttribute(testList,testList); return SUCCESS; the action dispatch to the same jsp,but this time,the jsp show nothing! Why? I don't understand what's wrong with my code? Anyone could help me to solve above problem? Thank -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Is there a way to make Struts2 working with other methods different than classic getter/setter?
You can do that right out of the box. I do it all the time. Give it a try. Create method with those names, and reference them in JSPs by those names. It should work. jk On Fri, Apr 17, 2009 at 9:31 AM, Federica Oltolina federica.oltol...@ubiquity.it wrote: Hi all, my head office yesterday asked me if it's possible to declare in some special file a mapping between actions and their methods because he'd like to use custom getter/setter methods containing some little formatting operations. For example, for the action attribute: / private String bankingCode;/ he liked having in our action more than one getter that would sound like: /getBankingCodePrecedeedByAnyZero(); getBankingCodePrecedeedByFiveZero(); and so on... /and then in the jsp that corresponds to the action cited above ho would Struts2 to be able to understanding the correct setter/getter method, for example he'd like to write /... s:property value=//bankingCodePrecedeedByAnyZero/// ...// / obtaining the result of the method /getBankingCodePrecedeedByAnyZero(); /Someone knows if there is a way to do this? No matter if this sounds like a swearword for a Struts2 good user or if this is not smart, he asked me this. Thanks in advance Federica -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Struts.properties question
If you have any power over the data, you should change that so that you are not getting the SSN as an integer. It's not a number in any sense of the word except that it has digits. You never do math on it. Save it as a String if you can. On Fri, Apr 17, 2009 at 4:20 PM, Bhaarat Sharma bhaara...@gmail.com wrote: great! it worked out for me. One last question, I was looking at the wiki but it seems like formatting is only available for numbers and dates. is it possible to format an SSN? I am getting the SSN as an integer. but would like to show it as ###-##- On Fri, Apr 17, 2009 at 10:54 AM, Terry Gardner terry.gard...@sun.com wrote: On Apr 17, 2009, at 10:49 AM, Bhaarat Sharma wrote: so I can create this new property file in the same folder where my struts.properties file resides or does it have to be in the package where action is. Good point. I forgot to mention that there is a search hierarchy. I usually put the properties files in the same directory as the action, but they can also be up the chain. So, if my Action class is com.slamd.struts2.actions.SlamdStartServerResultAction.java, then I put the SlamdStartServerResultAction_en.properties file in srcRootcom/slamd/struts2/actions. so if my action name is XXX.java the property file will be XXX_en.properties and the properties file will be picked automatically or does it require any changes in struts.properties? does it have to be registered there? Picked automagically by getText(). Remember to change the _en part to the two letter code for the language. I only speak English - and that badly - so mine are all _en for the moment. Thanks!! On Fri, Apr 17, 2009 at 10:44 AM, Terry Gardner terry.gard...@sun.com wrote: The resource bundles can also be in files named after the Action, for example, SlamdStartServerResultAction_en.properties, which contains keys and values (English) for the Action SlamdStartServerResultAction.java On Apr 17, 2009, at 10:36 AM, Bhaarat Sharma wrote: I know we can a property file in struts like this struts.custom.i18n.resources=nameofFile But is there a way to use multiple properties files? (nameofFile) we have a lot of labels for our application and if we put everything into one property file then it seems to get so overwhelmingly huge that its hard to find anything in it. Is there a way to over come this problem? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Storing interface instance in a user's session
If you use SessionAware in your actions, you can receive a Map that represents the session. You could pass that Map into your user manager class, and do the storage that way. On Thu, Apr 16, 2009 at 10:18 AM, Security Management list-subscripti...@secmgmt.com wrote: I want to store a list of interface instances (i.e. UserImpl which implements IUser), so I can have methods: public void setUser(ListIUser users) { This.getSession().put(SESSION_USER_LIST_KEY, users); } public ListIUser getUsers() { return (ListIUser) this.getSession().get(SESSION_USER_LIST_KEY); } I'm using Spring to manage struts objects. Can someone help, I'm having trouble with finding out how in the documentation. Maybe my google keywords are bad or something... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Validation - Simple Theme
Customizing the textfield in the xhtml theme takes about seven minutes. Really. 2009/4/15 André Diniz adi...@gmail.com How to validate my forms using simple theme? I can't see the message errors - - - x - - - I'd like to create my text fields side-by-side using ajax or xhtml themes, how can I do that? I have to customize a theme to do that? Oh my! How come? Minus bonus points for Struts... André. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: ClassCastException com.dev.model.Form cannot be cast to java.lang.String
Look at your execute() method or whatever method you're calling from your JSP. I suspect that you are returning a com.dev.model.Form object instead of a String like success or input. jk On Tue, Mar 24, 2009 at 11:26 AM, foward fow...@gmail.com wrote: Hello, I don't know if I m right posting here this, but I have this problem with my webapp and I couldn't find a solution I hope you can help me please: ERROR [httpSSLWorkerThread-8080-1] ActionComponent.executeAction(259) java.lang.ClassCastException: com.dev.model.Form cannot be cast to java.lang.String at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:409) I did search looking for an answer but I didnt find nothing... the thing is when I call an action method in a view: s:action name=createForm!getForm id=action namespace=default/ div id=box pstrongSurvey : /strong ${form.name}/p pstrongIntroduction : /strong ${form.introduction}/p pstrongClose Date:/strong ${form.close_date}/p br/ /div to show information about one Form. Please if you can guide me to solve this, Thanks in advance! Best Regards -- View this message in context: http://www.nabble.com/ClassCastException-com.dev.model.Form-cannot-be-cast-to-java.lang.String-tp22682861p22682861.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Global tag settings?
I don't know of any way to set those values globally for the application, but this isn't something I have put a lot of time into. This is the right list to ask questions on, but if you get no response by the second or third question it probably means that the folks reading don't know offhand and may not have time to find the answer. jk On Tue, Mar 24, 2009 at 12:55 PM, carlo latasa clat...@gmail.com wrote: So is this the wrong list to post a question? or is this a RTFM issue? On Mon, Mar 23, 2009 at 4:47 PM, carlo latasa clat...@gmail.com wrote: So should I post this to : https://issues.apache.org/struts/secure/Dashboard.jspa ?? going once, going twice??? can anyone tell me where the defaults are even set? I've looked through the struts-core jar with no luck. On Mon, Mar 23, 2009 at 1:57 PM, carlo latasa clat...@gmail.com wrote: org.apache.struts2.views.jsp.ui.SelectTag.labelPosition=right or org.apache.struts2.components.Select.labelPositioin=right don't work either. So does the default struts.properties file included in the struts jar define all the possible keys/values that can be set at runtime? On Fri, Mar 20, 2009 at 12:04 PM, clat...@gmail.com wrote: Hello, Is there any way to set common tag parameters like labelSeparator, labelposition etc.. in say the struts.properties file? I've tried struts.tag.labelposition, struts.ui.tag.labelposition. thanks, Carlo -- Carlo Latasa Cell: (415) 385-1567 -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: RE: Global tag settings?
Is there a reason you couldn't just overwrite the textfield tag with a custom theme? On Tue, Mar 24, 2009 at 5:23 PM, carlo latasa clat...@gmail.com wrote: I'm not sure I understand what you are getting at but this is what I'd like to do: At the moment all of my textfield tags render with labelposition=top - the default. I'd like to make a global setting for all textfield tags such that the labelposition=left. Instead of having to call it out in every tag on every page (thousands in my case). All other parameters for all other tags could use the default labelposition - unless I specified otherwise in say the struts.xml;) Make sense? On Mar 24, 2009 12:02pm, Martin Gainty mgai...@hotmail.com wrote: if you think labelPosition attribute should have a global default then you may want to update Struts 2 JIRA but in the case of labelPosition each struts tag is placed in different locations so having a global default of labelPosition=top is orthogonal as setting each and every struts tag labelPosition would still have to be done for each declared tag in the form Is there a practical use case for this scenario? Martin __ Disclaimer and confidentiality note This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. Date: Tue, 24 Mar 2009 13:02:18 -0400 Subject: Re: Global tag settings? From: jhki...@summa-tech.com To: user@struts.apache.org I don't know of any way to set those values globally for the application, but this isn't something I have put a lot of time into. This is the right list to ask questions on, but if you get no response by the second or third question it probably means that the folks reading don't know offhand and may not have time to find the answer. jk On Tue, Mar 24, 2009 at 12:55 PM, carlo latasa clat...@gmail.com wrote: So is this the wrong list to post a question? or is this a RTFM issue? On Mon, Mar 23, 2009 at 4:47 PM, carlo latasa clat...@gmail.com wrote: So should I post this to : https://issues.apache.org/struts/secure/Dashboard.jspa ?? going once, going twice??? can anyone tell me where the defaults are even set? I've looked through the struts-core jar with no luck. On Mon, Mar 23, 2009 at 1:57 PM, carlo latasa clat...@gmail.com wrote: org.apache.struts2.views.jsp.ui.SelectTag.labelPosition=right or org.apache.struts2.components.Select.labelPositioin=right don't work either. So does the default struts.properties file included in the struts jar define all the possible keys/values that can be set at runtime? On Fri, Mar 20, 2009 at 12:04 PM, clat...@gmail.com wrote: Hello, Is there any way to set common tag parameters like labelSeparator, labelposition etc.. in say the struts.properties file? I've tried struts.tag.labelposition, struts.ui.tag.labelposition. thanks, Carlo -- Carlo Latasa Cell: (415) 385-1567 -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com Express your personality in color! Preview and select themes for Hotmail®. See how. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Convention for keeping passwords out of struts.xml
Dave's right -- a good choice here is to keep that kind of data in a server settings config file, and set up your application to pull the database context info out of the JNDI context. Check out http://tomcat.apache.org/tomcat-5.5-doc/index.html http://tomcat.apache.org/tomcat-5.5-doc/index.htmlfor details on this sort of thing. jk On Thu, Mar 12, 2009 at 2:50 PM, Security Management list-subscripti...@secmgmt.com wrote: OK, my bad, I meant out of the applicationContext.xml I basically want to be able to tell someone to deploy a war file, edit a file outside of the webroot that has the settings in it, and startup tomcat. Then, my app would load that properties file and make the connection. -Original Message- From: Dave Newton [mailto:newton.d...@yahoo.com] Sent: Thursday, March 12, 2009 2:40 PM To: Struts Users Mailing List Subject: Re: Convention for keeping passwords out of struts.xml Security Management wrote: What's the convention for keeping database settings out of struts.xml? Hmm, I guess I never even considered putting them in there. JNDI, Spring, and property files are the obvious choices, most DB technologies support creating a datasource in their own config as well. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: Have a s:a href .. as the Label of a CheckBox
...and so I have to guess that your question is: How can I make a hyperlink be the label for a checkbox? Sometimes it helps to actually ask a question in your question. Anyway: Don't have the hyperlink actually be the label per se. Give the checkbox no label and just put the hyperlink next to the checkbox. jk On Wed, Mar 11, 2009 at 8:55 AM, Ransika de Silva rans...@gmail.com wrote: Hi all, There is a requirement of having a http link as the label of Struts CheckBox, so the the user can either select the checkbox or click the label and go to a different page. Thanks, Ransika -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Have a s:a href .. as the Label of a CheckBox
Can you solve this problem with s:label? On Wed, Mar 11, 2009 at 9:07 AM, Ransika de Silva rans...@gmail.com wrote: Yes, your assumption is absolutely correct. Thanks for the reply but sadly that technique is not good enough for us, we want the label to be a hyperlink. Regards, On Wed, Mar 11, 2009 at 6:32 PM, Jim Kiley jhki...@summa-tech.com wrote: ...and so I have to guess that your question is: How can I make a hyperlink be the label for a checkbox? Sometimes it helps to actually ask a question in your question. Anyway: Don't have the hyperlink actually be the label per se. Give the checkbox no label and just put the hyperlink next to the checkbox. jk On Wed, Mar 11, 2009 at 8:55 AM, Ransika de Silva rans...@gmail.com wrote: Hi all, There is a requirement of having a http link as the label of Struts CheckBox, so the the user can either select the checkbox or click the label and go to a different page. Thanks, Ransika -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com -- Ransika De Silva SCMAD 1.0, SCJP 1.4, BSc.(Hons) Information Systems -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: s:radio and s:checkboxlist - how to customize listValue property.
The easiest (I'm not going to say best) solution is to make a fake getter on your bean. Make a getListLabel() method that composes a String from the values that you want to display in the list label, and then set the listValue to be listLabel. This is the way I've done this in the past and it works OK. It isn't ideal if you want to keep your model carefully isolated from your UI but my own designs are a little less pure than that. jk On Wed, Mar 11, 2009 at 10:05 AM, boraldo bora...@hotbox.ru wrote: When I use that 2 components in my form I need to set attributes listValue and listKey. That attributes as I understand require a field of a bean that is a member of collection represented by list attribute. Example: s:radio list=types name=type label=Type listValue=name listKey=id / That means: 1) there will be one radiobutton for each element of collection getTypes(). 2) Each html radiobutton will have value = getId() and label = getName() . I want to compose label from several fields of my bean. So I can't write s:radio listValue=someField / because that class doesn't have getSomeField() method. How can I do this ? -- View this message in context: http://www.nabble.com/s%3Aradio-and-s%3Acheckboxlist---how-to-customize-listValue-property.-tp22455829p22455829.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: this is driving me nucking futs!
Musachy, I would refer to you as a cool dude if you did that. jk On Wed, Mar 11, 2009 at 5:10 PM, Musachy Barroso musa...@gmail.com wrote: That is something I have complained about for a long time, time to do something about it I guess. musachy On Wed, Mar 11, 2009 at 5:08 PM, Chris Pratt thechrispr...@gmail.com wrote: I guess one question I would ask is why s:a doesn't have an action paramter and allow nested s:param elements? That way there would be no need to create any variables. (*Chris*) On Wed, Mar 11, 2009 at 1:56 PM, mitch gorman mgor...@shadowtv.biz wrote: Wes Wannemacher wrote: On Wed, Mar 11, 2009 at 4:47 PM, mitch gorman mgor...@shadowtv.biz wrote: thanks for your responses, wes! No problem, next time, include me in your list of gurus and I'll be happy lol! you got it! (i knew for sure i was probably inadvertently dissing at least a couple people here... my apologies to any *other* deserving souls!) -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com
Re: How to render fields horizontally.
s:textfield name=more theme=simple/ s:textfield name=cowbell theme=simple/ On Tue, Mar 10, 2009 at 9:21 AM, Kra, Aime yao (TEK System) ak...@allstate.com wrote: Hello I am a new user of struts 2 and want to know how to force struts to render two fields on the same line. All my fields are rendered vertically even when I use html table to organize the fields positioning. Any sample will be appreciated. Thanks. Aimé Kra -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: HOWTO implement multiple submit buttons with type = image.
With image type submits, an x and y value are usually submitted (so that if the button is an imagemap, the server knows where the user clicked). Struts is complaining that you don't have any fields that accept an x or a y field on your action class. jk On Tue, Mar 10, 2009 at 2:46 PM, Kra, Aime yao (TEK System) ak...@allstate.com wrote: Hello I am implementing a form with two buttons CANCEL and REGISTER. I have followed the sample provided in the cookbook http://struts.apache.org/2.x/docs/multiple-submit-buttons.html This works fine if type=submit --- s:submit type=submit src=../images/button/cancel_bkgd.jpg name=buttonName value=Cancel / s:submit type=submit src=../images/button/register_bkgd.jpg name=buttonName value=Register / br --- For type=image I receive the following error [3/10/09 9:05:49:726 EDT] 0036 ParametersInt E com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'buttonName.x' on 'class com.ars.claims.view.action.CreateProviderOwner: Error setting expression 'buttonName.x' with value '[Ljava.lang.String;@7cf47cf4' In struts 1, we can use an ImagebuttonBean type to provide the getter/setter in the action class. (See http://www.java-samples.com/showtutorial.php?tutorialid=518) I can't see ImagebuttonBean in struts 2. Can someone know how to implement these two image type submit buttons and What should be the code in the Execute() method of the Action class to know the pressed button ? Any Help will be appreciated. Thanks Aimé Kra -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [OT] Authorization and Authentication Question
I'd agree. Have your UserDetailsService implementation hit LDAP for authentication, and pass GrantedAuthorities[] on to the returned object by asking DB2 about that info if the user is authenticated. jk On Tue, Mar 10, 2009 at 6:44 PM, Wes Wannemacher w...@wantii.com wrote: On Tuesday 10 March 2009 17:56:30 Ashish Kulkarni wrote: HiIs it possible to Authenticate user using LDAP, but authorize using a DB2 database, I have situation where i need to authenticate and authorize some web pages. I want to authenticate users against LDAP, but have to maintain authorization list, roles etc in DB2 database Has anyone done anything like this before, i am using Weblogic and tomcat application servers I would suggest using Spring Security. I think what you'll need to do is create a bean that implements the org.springframework.security.userdetails.UserDetailsService interface, then wire it into your configuration. -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Access ActionForm methods/varaibles in JSP
I suggest that you not embed Java code in JSPs in scriptlets like this. It's better to use Struts tags instead. Are you looking at using Struts 1 or Struts 2? jk On Thu, Mar 5, 2009 at 3:22 PM, Emi Lu em...@encs.concordia.ca wrote: Good morning, In JSP file, may I know how to get action bean please? form action=... name=f1 % if(f1.getCode().equals('abc')) { % table ... ... /table % } % /form In JSP, I'd like to know how to call methods, fields in action form bean? Thanks a lot! -- Lu Ying - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts Themes Problem - help
If I am understanding you correctly, your best bet might be to customize the fielderror.ftl template for a custom theme of your own. If I were going to display errors in a custom way more than once, that's what I would do. Make a template directory in the root of your webapp, then make a new folder that has the name you want to give your template. (Mine is cleverly named my.) Then copy fielderror.ftl out of the struts jar into webapp/my/fielderror.ftl, then customize the contents of fielderror.ftl. jk On Tue, Mar 3, 2009 at 5:53 AM, sajidbigler sajidbig...@gmail.com wrote: As said below is that a only solution or can we set theme=xhtml for fielderror tag with in the form which uses theme= simple. but we will be rendering error after the filed not the above as xhtml does.how can we make it to render it above the field instead below the field? s:fielderror s:paramclientname/s:param /s:fielderror -- View this message in context: http://www.nabble.com/Struts-Themes-Problem---help-tp18054982p22306342.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts 2 - After validation failure populating the drop downs
Populating the dropdowns in an input() method that returns Action.INPUT should do the trick. jk On Mon, Mar 2, 2009 at 1:19 PM, Sundararaman, Anand anand.sundarara...@ps.net wrote: Hi, I guess there is an elegant solution for this but I could not find out in the user list. I am using Struts 2 and creating some form validations. If a validation fails on a JSP screen, the input result takes back the control to the same screen, but the drop downs are not populated. I need to know the best way of showing the validation failures and also populating the drop downs. Thanks a Lot, Anand - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts 2 - After validation failure populating the drop downs
In your action class, write a method like so: public String input() { // populate my dropdowns return Action.INPUT; } Obviously you will have to write the code to populate your dropdowns there, as that depends on what you are up to. But the input() method of your action class will be called if validation fails, so if you have things that you want to make sure occur on validation failure, put them there. jk On Mon, Mar 2, 2009 at 1:30 PM, Sundararaman, Anand anand.sundarara...@ps.net wrote: Hi, Would you able to specify in little more detail? Sorry for that as I am new to Struts 2. Thanks, Anand -Original Message- From: Jim Kiley [mailto:jhki...@summa-tech.com] Sent: Monday, March 02, 2009 12:23 PM To: Struts Users Mailing List Subject: Re: Struts 2 - After validation failure populating the drop downs Populating the dropdowns in an input() method that returns Action.INPUT should do the trick. jk On Mon, Mar 2, 2009 at 1:19 PM, Sundararaman, Anand anand.sundarara...@ps.net wrote: Hi, I guess there is an elegant solution for this but I could not find out in the user list. I am using Struts 2 and creating some form validations. If a validation fails on a JSP screen, the input result takes back the control to the same screen, but the drop downs are not populated. I need to know the best way of showing the validation failures and also populating the drop downs. Thanks a Lot, Anand - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts 2 question about validation and forwarding
Just have the result of the input() method return them to a different page under that condition. On Fri, Feb 27, 2009 at 12:41 PM, laredotornado laredotorn...@gmail.comwrote: Hi, If request validation fails, how can I forward the user to a different page than that from which they came? The scenario is that an external web site is going to invoke our site with something like /ourForm.do?param1=xxxparam2= and if their parameters are not valid, we want to forward them to another page on our site. Thanks for your help, - Dave -- View this message in context: http://www.nabble.com/Struts-2-question-about-validation-and-forwarding-tp22250708p22250708.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: s:checkboxlist
The way I solved this was to add my own theme, and change the xhtml theme's checkboxlist template to match what I wanted 'my' checkboxlist to do. Under the root of your web app, add a directory named template. Under template add a directory called myapp. Then copy checkboxlist.ftl out of the Struts jar into template/myapp, and modify it as you wish. Finally, in your JSP, do s:checkboxlist theme=myapp .../ This comes up fairly often -- I am happy to add it to the FAQ if someone can tell me how I do that. jk On Thu, Feb 26, 2009 at 5:46 AM, k...@chalu.cz wrote: BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }Hallo, is there any way to set that all items (checkboxes) in s:checkboxlist are in their own line, one checkbox under other. Defaultly they are all on the same line and I cannot find the way how to set that each one checkbox has to have their own line :-( Thanks, Jiri -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: value truncated
My uncle had his value truncated back in the war. He doesn't like to talk about it much. Oh your actual question. Have you tried escaping the quote marks? Using \ instead of just ? jk On Thu, Feb 26, 2009 at 3:47 PM, Dravid sun.n...@gmail.com wrote: Any thoughts thanks in advance -- View this message in context: http://www.nabble.com/value-truncated-tp22211336p22233327.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: migration of Struts
It is OK to add features to your 1.2.6 app if it is otherwise running OK. Upgrading to 1.3.10 might not be too painful. Upgrading to 2.1.6 isn't an upgrade; it's a rewrite. There are vast differences. jk On Mon, Feb 23, 2009 at 4:27 PM, Ashish Kulkarni ashish.kulkarn...@gmail.com wrote: HiI have inherited a struts 1.2.6 application, i need to add some features to this web application. what will be the best migration policy to latest version of Struts without lot of efforts, Should i migrate it to struts 1.3.10 or to latest version 2.1.6? Is there any documentation for this migration to 1.3 or 2.1 version I am using myeclipseide for coding, does this version support 2.1.6? I don't want to put a lot of efforts in migration, but concentrate on adding this new function is it ok to add features using 1.2.6 struts? any advice -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Errors repopulating the list after validation.
(Dispatcher.java:468) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav a:395) It seems like the countries object has been poped off of the value stack during the validation firing, any ideas how to fix this?? The tag is as follows: s:select id=registration_countryCode name=country multiple=false emptyOption=true required=true list=countries listKey=code listValue=name label=Country thanks, Sid Bhatia Try not. Do... or do not. There is no try -- Yoda _ * mailto:sidharth.bha...@lehman.com mailto:sidharth.bhat...@gmail.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [S1]struts with hibernate
.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:80) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298) ... 25 more Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:241) at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:253) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:94) ... 38 more Feb 10, 2009 8:02:29 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Allocate exception for servlet action java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:241) at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:253) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:94) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65) at org.postgresql.jdbc2.AbstractJdbc2Connection.init(AbstractJdbc2Connection.java:117) at org.postgresql.jdbc3.AbstractJdbc3Connection.init(AbstractJdbc3Connection.java:30) at org.postgresql.jdbc3.Jdbc3Connection.init(Jdbc3Connection.java:24) at org.postgresql.Driver.connect(Driver.java:235) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:140) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:290) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:276) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:258) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:240) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:80) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137) at org.hibernate.impl.SessionImpl.connection(SessionImpl.java:345) at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:407) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:281) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:217) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174) at $Proxy73.getUseCaseRolesAndRolesBoss(Unknown Source) at acegisecurity.teamsoft.TSActionServlet.createMapViewResorce(TSActionServlet.java:47) at acegisecurity.teamsoft.TSActionServlet.init(TSActionServlet.java:36) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Thread.java:595) saludos lalchandra rampersaudVI Conferencia Internacional de Energía Renovable, Ahorro de Energía y Educación Energética 9 - 12 de Junio 2009, Palacio de las Convenciones ...Por una cultura energética sustentable www.ciercuba.com -- Jim
[s2] @Result annotation and namespace parameter
I'm feeling dim this morning and I hope you folks can help me out. To simplify, I have two classes: com.company.view.cust.my.order.FieldRepAction com.company.view.cust.my.rep.ChooseCustomerAction FieldRepAction has the following annotation: @Result(value = chooseCustomer!input.action, type = ServletRedirectResult.class, params={namespace, /cust/my/rep}) But when I navigate to fieldRep.action and get redirected, I get a beautiful Tomcat stack trace from Struts 2: There is no Action mapped for namespace /cust/my/order and action name chooseCustomer It seems that I have the wrong namespace parameter in the @Result annotation. Can someone point me in the direction of a fix? -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [s2] @Result annotation and namespace parameter
And of course the magic of sending my problem to the mailing list let me figure out the solution on my own: I should have been using ServletActionRedirectResult rather than ServletRedirectResult. jk On Wed, Feb 4, 2009 at 10:03 AM, Jim Kiley jhki...@summa-tech.com wrote: I'm feeling dim this morning and I hope you folks can help me out. To simplify, I have two classes: com.company.view.cust.my.order.FieldRepAction com.company.view.cust.my.rep.ChooseCustomerAction FieldRepAction has the following annotation: @Result(value = chooseCustomer!input.action, type = ServletRedirectResult.class, params={namespace, /cust/my/rep}) But when I navigate to fieldRep.action and get redirected, I get a beautiful Tomcat stack trace from Struts 2: There is no Action mapped for namespace /cust/my/order and action name chooseCustomer It seems that I have the wrong namespace parameter in the @Result annotation. Can someone point me in the direction of a fix? -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [S2] Passng a parameter with (multiple) Submit buttons
How bout: s:url id=deleteUrl action=productList!delete s:param name=deleteProductId value=id / /s:url s:a href=%{deleteUrl}Delete/s:a On Mon, Feb 2, 2009 at 11:37 AM, Greg Lindholm glindh...@yahoo.com wrote: Yes Musachy, that is correct. So is there some struts magic to do this? The only way I can think of doing this is to add some javascript to each button that would set the id as a hidden parameter before doing the submit. But I would prefer to do this without JS if possible. I guess what I'm thinking of would be an enhancement to the submit tag to allow passing an id in the same way you can pass the Action and Method. Musachy Barroso wrote: What you need to do is pass a different parameter on each submit, not call a different method. musachy On Mon, Feb 2, 2009 at 11:06 AM, Greg Lindholm glindh...@yahoo.com wrote: Thanks Miguel, but that doesn't sound workable with an arbitrary number of buttons. Anyone else? I'm looking for a method of dealing with a table with each row having a remove button. I need to pass a different rowId based on which button is clicked so I know which row to remove. I need to use a form (not a link) as there are other input fields that need to be submitted with the request. Is there a struts pattern for this? On Fri, Jan 30, 2009 at 15:54, Greg Lindholm glindh...@yahoo.com wrote: I have a CRUD action and jsp page for an entity, this entity has a list of attributes. I display these attributes in a table one per row. What I would like to do is have a s:submit action=removeAttr/ button on each row of the table so the user can click on the button to remove the attribute. In order to make this work I would need to pass the id of the attribute with the submit button and I can't find a way to do this. Is there a (struts) way to pass a parameter with a submit button? I can't use a link because I need all the other form fields to be posted with the request. The only way I can think of making this work is to add some javascript to each button that would set the id in a hidden field before the submit. Is there a pure struts or better way to do this? -- View this message in context: http://www.nabble.com/-S2--Passng-a-parameter-with-%28multiple%29-Submit-buttons-tp21756353p21793012.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts 2 session problem
Are there frameworks that handle this situation differently? It's a browser-side issue, so it isn't clear to me how a server-side framework could solve it. jk On Mon, Jan 19, 2009 at 3:02 PM, Greg Lindholm glindh...@yahoo.com wrote: Oh I fully understand this is a issue with how browsers deal with sessions. However these are the browsers our apps have to work with so as a developer I have to make the apps work with them and I expect any decent app framework to have good solutions to all the common use cases. And I consider having multiple windows/tabs open to the same app a very common use case. If some other framework (like SEAM) is handling this issue better then let see if we can implement the same solution in Struts 2. Correction: In my last post I meant to say Conversation token not Session token. Rubbinio wrote: This is not really a struts 2 issue but a browser issue. This is the way firefox persists sessions. If you try same thing in IE6 it will work fine, IE7 some times and IE8 fully emulates firefox. Furthermore you can try this with gmail and you will see the same behaviour. This is a fairly well known limitation of firefox if you want to call it a limitation, I for one think this is the correct thing to do, and since even IE8 starts doing this looks like it is. The solution for FF is to use profiles. Just google for 'Firefox multiple sessions. -Original Message- From: Greg Lindholm [mailto:glindh...@yahoo.com] Sent: January 19, 2009 2:19 PM To: user@struts.apache.org Subject: Re: Struts 2 session problem +1 I find I need this all the time when developing; I want to login as 2 different users and test multi-user interactions. Currently I'm forced to use 2 different browsers, login once with Firefox and once with IE. This works for development but wouldn't be an acceptable answer for users (plus many work places dictate the browser you will use and don't allow users to install other browsers.) Fortunately the only thing I store in the session is a Login object with user credentials and preferences etc. so this allows a user to have multiple browser windows open to the same application, they share the same session (this is the more common use case.) I have a harder time coming up with a legitimate use case for allowing an ordinary user to be logged into 2 different accounts at the same time. (I'm sure that there are legitimate cases but they are more fringe.) On the other hand, if you use conversation scope wizards etc. in your app I would expect a user to be able to have a separate conversation in each open window (shared session) without stomping on each other. This would mean the conversation state could not be stored in the session unless it is identified with a particular window/tab/frame etc. (a session token could be used in a hidden field). newton.dave wrote: dusty wrote: Creating a separate subsystem on the server to partition a single HTTP session for multiple users and maintain the conversation is classic overengineering. Seems like Seam has gone to a lot of trouble to provide just another way to persist state. It's not over-engineering to allow multiple tabs per user, each having their own state--some applications benefit from this functionality, for several different reasons. I bet if you gave it some thought you'd be able to come up with several trivial examples of when and why you'd need this functionality. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Struts-2-session-problem-tp21513305p21549675.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Struts-2-session-problem-tp21513305p21550453.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: struts 2 howto mulitiple dynamic buttons in a form
If nothing else, the error message tells you that you aren't closing your s:property tag. You have s:property value='id' and you should have s:property value='id'/. jk On Thu, Dec 11, 2008 at 6:42 PM, Ruel Loehr ruel.lo...@lombardi.com wrote: Guys, I've just started working with struts 2 but I am beating my head against a problem. I have a jsp which displays a number of rows by using an iterator. In each of those rows, I want a delete button. When the user clicks one of the delete buttons I kick off an action which will get the id to delete and delete it. I am stumped by how to do this! I tried following the code here: http://struts.apache.org/2.x/docs/html-form-buttons-howto.html But it throws an error saying javax.servlet.ServletException: /viewReleases.jsp(21,36) According to TLD, tag s:property must be empty, but is not org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:5 15) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher .java:422) My code jsp code is: s:iterator value=releases id=release status=cust_stat input type=submit name=delete[s:property value='id'] value=delete / How in the world can i get a value found through an iterator into my action class?? Thanks! Ruel -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: How to get last requested page?
Dan, I would include some kind of parameter with the request that gives your application a clue as to what path it should follow. Then use the value of that parameter to determine which route to respond with. I think this is superior to just relying on the name of the JSP or something like that, because it better decouples your Java code from your presentation layer. jk On Tue, Nov 25, 2008 at 8:07 AM, Dan [EMAIL PROTECTED] wrote: I know this question is more related to java by itself more than to struts, but need some help :) I have to re-use a method in a class, and then depending on from which jsp page comes, forward to one jsp or another: Page1.jsp (globalForward to method.do) endpage1.jsp \ / INPUTMethod.do (if request comes from page1) OUTPUT / ( if request comes from page2) Page2.jsp (globalforward to method.do) \endpage2.jsp Is any method that tells me the last request jsp? Or how could i manage this situation? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: disable a button if not selected any value
This is a pure Javascript activity -- it isn't something that Struts can directly help you with. On Fri, Oct 24, 2008 at 11:46 AM, Dravid [EMAIL PROTECTED] wrote: Hi, I have a dropdown box and and delete button on my jsp page. I have a requirement where user selects a value from dropdown box to delete it. If nothing is selected from the dropdown box then the delete button should be disabled. on selected it should be enabled. please help me how to do this. thanks in advance. -- View this message in context: http://www.nabble.com/disable-a-button-if-not-selected-any-value-tp20152579p20152579.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts2 Data Transfer
=bean2.anotherField/ each bean will contain whatever was entered in the form. 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Query
You're going to need to provide a lot more detail if you want a useful answer of any kind. On Sun, Sep 21, 2008 at 1:27 AM, greatshalu.6 [EMAIL PROTECTED]wrote: how we use grids in struts -- View this message in context: http://www.nabble.com/Query-tp19591765p19591765.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: session based pojo as form variables
On Sat, Sep 20, 2008 at 4:46 PM, 928572663 [EMAIL PROTECTED] wrote: The Tag Reference doc: http://struts.apache.org/2.0.11.1/docs/submit.html doesn't have much detail about what to expect: Set method attribute. Is my pageForward() method supposed to conform to a certain signature? Yup. It should accept no arguments, and return a String. Er, and be public: public String pageForward() { //... } -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Performance and High CPU utilization
What kind of server are you using here, how much memory, what CPU -- when we are getting to CPU utilization, all of these issues are relevant. On Thu, Sep 18, 2008 at 3:43 PM, sajanv007 [EMAIL PROTECTED] wrote: I have tried all the tuning parameters mentioned in the link somehow CPU utilization is always 80% ,I observed that it takes tags are rendered from free marker cache but still the cpu 80-90% . Regards Sajan Nils-Helge Garli wrote: Maybe this can help: http://struts.apache.org/2.0.11.2/docs/performance-tuning.html Nils-H On Thu, Sep 18, 2008 at 9:11 PM, sajanv007 [EMAIL PROTECTED] wrote: There is huge performance issue and CPU hogging with Struts2 tag , this was observed while rendering JSP. These are some performance results obtained Strut 2 Tag - With all performance tuning applied as per Struts 2 documentation - Freemarker caching etc... Load Runner Tool 40 users 900 hits per second 10 transaction per second Results CPU utilization 90% Response 3.5 sec Replaced some of Struts2 Tag , with Custom JSP Tags like (s:label, s:text,s:textfield,s:hidden,s:param) 40 users 900 hits per second 15 transaction per second Results CPU utilization 70% Response 2.0 sec Some where down the line Struts 2 tag are very cpu hungry , to people to adopt to strut2 framework cpu utilization should be optimized . Did anybody come across on how to over come this problem -- View this message in context: http://www.nabble.com/Performance-and-High-CPU-utilization-tp19559123p19559123.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/Performance-and-High-CPU-utilization-tp19559123p19560223.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: autowiring in html tag
How would the HTML input tag receive information from your Struts action? The s:textfield tag is designed to receive that data. HTML's basic input tag is not. On Wed, Sep 17, 2008 at 3:22 PM, MyAshok [EMAIL PROTECTED] wrote: Hi all, Is it possible to use html tag instead struts 2 tag which should implement the autowiring. I tried with input type=text name=username instead of s:textfield name=username . I can pass value form jsp to action but not from action to jsp. Where i did wrong. Please give me the solution ASAP. With Regards, Ashok, -- View this message in context: http://www.nabble.com/autowiring-in-html-tag-tp19539274p19539274.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Struts 2.1 Tree Problem
We aren't deliberately ignoring you... many readers of this list are in the Americas, and you sent your first message after most of us went to bed and your followup before most of us woke up. :-) (I have no idea what the answer to your question is, I have not used the tree control at all -- but what have you tried? Can you share your code with us so that we can help point you in the right direction?) jk On Thu, Sep 11, 2008 at 5:08 AM, Narayana S [EMAIL PROTECTED] wrote: did any one see this email please help me On Thu, Sep 11, 2008 at 10:17 AM, Narayana S [EMAIL PROTECTED] wrote: Hi, now i am working with tree control, when i load the tree i want to load it default extended and what ever the node id i pass that should be activated. how i can achieve this using struts 2.1 version. and one more thing is when i select a node in the jsp page itself i have to find out the parent of the node selected. please help me to solve this issue, i am kind of stuck.. Thanks in advance. -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: new to Struts
Start with Struts 2. It's a great improvement over the old beast. On Mon, Sep 8, 2008 at 8:25 AM, gbattine [EMAIL PROTECTED] wrote: Hello guys, I need an information. I'm going to learn struts.. I need some info, please help me: 1) what do you hint to me, to start from Struts 1.1 and later move to Struts 2.0, or starting from Struts 2.0? 2) I usually use Netbeans. Is there an editor WYSIWHG for Netbeans, to use Struts? 3) I know ASP.NET technology and I used lot of already developed components, like editable grid, dropdown list and so on...does exists such component for struts?where I can download them? Thanks, Regards -- View this message in context: http://www.nabble.com/new-to-Struts-tp19370925p19370925.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [S2] One hidden value doesn't get submitted (another one does). Why?
Ylva, You will probably get better results from the list if you can isolate your problem precisely and describe it more succinctly. jk On Mon, Sep 1, 2008 at 1:32 PM, Ylva Degerfeldt [EMAIL PROTECTED]wrote: Hi, My current problem is about a hidden value which isn't saved to the Action. This is the background information I think is needed: The value in question (called state) is an int property of a POJO called InfoObject. Other relevant properties of the POJO are id (a String) and name (Str.) In my application a List of these objects is generated and saved in the current HttpSession. The action that generates that list calls a JSP which iterates through the List (using #session.nameOfList) and for each object shows certain properties and gives the user a chance to change their values by using select boxes and buttons (One row equals one object in the list). The thing that isn't entirely working right now is this: In each generated row there's an Edit button. When the user clicks it, the name Label (to the left in the row) should change into a TextField (so the user can edit it) and stay a TextField until the user clicks the Save button of that row. This behaviour is controlled by the state variable of the InfoObject (0 means that name should be a Label and 1 means a TextField). The corresponding Action of the form that shows this List has get- and set properties for the List along with an index property. The index property takes the value of the index of the object in the List whose Edit button was pushed (e.g. the index of the row). By the way, this Action always returns to the input page. (I'm having another Action for proceeding) I get this far: When I click an Edit button for the first time the right index is saved to the index property of the Action and I change the state from 0 to 1 for the corresponding object. Then the JSP is rendered again and the name value of the corresponding row is shown in a TextField instead of a Label which is correct. Then I try clicking on the Edit button of another row, but when the JSP is rendered again the state value belonging to the first row has changed back to 0 and it's only the new row which shows the name as a TextField. When I debugged the code I noticed that the state value is not submitted to the Action (the setState method of the objects is never called). I have the state value as a Hidden field in the form. Another hidden field is the id field. The weird thing is that the id field gets submitted though state doesn't, and the s:hidden tags (and values) have the same structure: s:hidden name = MyList[%{#iterState.index}].name value = %{name}/ s:hidden name = MyList[%{#iterState.index}].state value = %{state}/ I've also searched for spelling errors but have not found any. I can add that at first I didn't have a field for state in the JSP but then I realized that I should have one, so I added the Hidden field and did a Clean and build of the app. Another important thing (which May be the cause of this problem but I can't tell yet) is that my List is saved in two places (though for a short while). I want to keep it in the Session and the first time the JSP is shown I have to pick the List from the session (#session.MyList), Don't I? Then each instance of the Action that is called afterwards gets its own copy of the list and (if I understand correctly), if I didn't do anything about it, the list would be in two places of the ActionContext when the JSP is to be rendered again (in the Session and in the Action instance). Though, in my Action I set the Session reference to the List (a HttpSession attribute) to point to the List instance of the Action (because I want to keep it updated). Could that be causing the problem? I think it would be good if I could reference the List in the JSP Only from the Action, but the First time that can't be done (and then I Always have to get it from the Session, right?) Is there anyone who has made a similar application and can tell me how he/she did it (I mean just this session and Action thing)? But.. Back at the first problem. I'm not sure if this list in two places thing is causing the problem but it might be. Anyway, I would really appreciate if someone could help me with this! (Meanwhile I'll read some more in Struts 2 in Action to see if that clears up anything.) Big Thanks in advance! /Ylva - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [S2] Problem with list of submit buttons
If each of the buttons is a Submit button, and you have each row of the table wrapped in a separate form, you can put a s:hidden within each form, and store/provide the ID of the row within it. jk On Fri, Aug 29, 2008 at 11:22 AM, Ylva Degerfeldt [EMAIL PROTECTED] wrote: Hi everyone, I have a List of POJOs that I've created, and for every POJO in the list I'm displaying some UI components corresponding to the properties of the POJO (textfields and select fields et.c.). I also have some submit buttons that belong to each row (and indirectly to each POJO), like Edit, Save and Remove buttons. My corresponding Action has a property for the List and it receives its values the way it should. My problem is that I need some way to tell the Action which of the buttons that had been pushed (which one of the Edit buttons for instance), and I don't know how to do that. To be more exact, I'd like some way to return the #state.index of that iteration/row when a specific button has been pushed. I'm also using the method tag for calling different methods on the Action depending on which of the three buttons that was pushed, so that's not a problem. I've tried to find more information about the s:submit but I didn't find anything in Struts 2 in Action and the Struts 2 API docs aren't explaining much either. I've tried using the name and value attributes like for other UI components, like: s:submit name = Edit value = %{#state.index} key = caption.editbutton method = Edit/ but that only caused the index value to be the caption of the button. So it looks like value means something else for submit components than for other UI components. (It turns into the caption, If a value is specified..) I've also checked the parameter names I receive from the action, but apart from the different properties of the List I only receive method: Edit (when an Edit button has been pressed). Though I recall that when not using Struts you could receive the name of the button as a request parameter, so how do I do that with Struts 2 - and connect a value to it? Maybe I could use the onclick attribute of s:submit but I don't know the syntax for sending a value to the Action there. (Isn't that javascript?) Can somebody please help me with this? Thanks in advance! /Ylva - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [OT] Re: [S2] Iterate through two lists
Have you bought any goats lately? On Thu, Aug 28, 2008 at 1:12 PM, Al Sutton [EMAIL PROTECTED] wrote: Define expesive... Do you mean expensive?, if so expensive in what terms; memory, speed, required goat sacrifices? Al. Milan Milanovic wrote: toArray() ? It works, but it is too expesive ? Milan newton.dave wrote: --- On Thu, 8/28/08, Al Sutton wrote: C... I love a puzzle.. Can you give us the 9 characters in an anagram?? A rotary? (Plus two non-alpha, but it's already too easy now.) Not having enough information sure is a pain, huh. Dave Dave Newton wrote: --- On Thu, 8/28/08, Milan Milanovic wrote: 9-character JSP trick, what is this ? It's a clue that you could (potentially) solve [1] your issue by adding 9 characters to your JSP, without having to change anything in the Java code. The Set Javadocs may help. Dave [1] ObCaveat: it's untested with your particular data and implementation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Al Sutton W: www.alsutton.com B: alsutton.wordpress.com T: twitter.com/alsutton - 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] -- Al Sutton W: www.alsutton.com B: alsutton.wordpress.com T: twitter.com/alsutton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Using iterator tag to retrieve list from session
This doesn't directly address your question, but it seems to me that it isn't a great idea to name your action method getList(). The default assumption a reader will make is that getList() is a method intended to return the value of a field called list. It is not clear to me how this would interact with Struts. Anyway -- I'd rename that method to execute() or something, if I were you. Anyway, as to your actual question, you appear to be iterating over the round field of the eventList object, which doesn't have a round field at all. I suspect that you just want to iterate over eventList itself (or #session.eventList, I forget offhand). jk On Tue, Aug 26, 2008 at 1:30 PM, Chriss Nold [EMAIL PROTECTED] wrote: Hello All, I am trying to retreive a list from the session and display that list on a jsp, but I am not entirely sure of the correct syntax for reading the list. Any help would be appreciated. Here is the code that I am cuurently using: Action class: package round; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import example.ExampleSupport; public class GetListAction extends ExampleSupport{ public String getList() throws SQLException { Round round = new Round(); ListRound eventList = new ArrayListRound(); Map session = (Map)ActionContext.getContext().get(session); String userName = String.valueOf(session.get(userName)); try { Statement stmt; Class.forName(com.mysql.jdbc.Driver); String url = jdbc:mysql://localhost:3306/Nexus; String sql = Select * + FROM round WHERE userName=' + userName + '; Connection con = DriverManager.getConnection( url,root, *); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); while(rs.next()){ round.setMatchID(rs.getInt(1)); round.setEventID(rs.getInt(2)); round.setUserName(rs.getString(3)); round.setRound(rs.getInt(4)); round.setPersona(rs.getString(5)); round.setResult(rs.getInt(6)); round.setOpponent(rs.getString(7)); eventList.add(round); } con.close(); }catch( Exception e ) { e.printStackTrace(); } session.put(eventList, eventList); System.err.println(Session objects: + session.get(eventList)); return SUCCESS; } } Query is successful, and System.err.println displays: Session objects: [EMAIL PROTECTED] JSP: [EMAIL PROTECTED] prefix=s uri=/struts-tags % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; html head titleWelcome to Nexus!!!/title LINK rel=stylesheet type=text/css href=../css/styles.css /head body background=../images/containment.jpg table width=100% tr td width=10% rowspan=4 s:include value=../includes/menu.jsp/ /td td table border=0 width=90% align=center tr td align=center h3 Welcome to the Nexus, s:property value=#session.userInfo.firstName/ /h3 /td /tr tr td align=center table class=round tr thfont color=whiteMatch ID/font/th thfont color=whiteEvent ID/font/th thfont color=whitePersona Used/font/th thfont color=whiteOpponent/font/th thfont color=whiteResult/font/th thfont color=whiteRound/font/th /tr tr s:iterator value=#eventList.round status=rowstatus tr s:if test=#rowstatus.odd == true td style=background: grey s:property value=matchID / s:property value=eventID / s:property value=persona / s:property value=opponent / s:property value=result / s:property value=round / /s:if s:else s:property value=matchID / s:property value=eventID / s:property value=persona / s:property value=opponent / s:property value=result / s:property value=round / /s:else /tr /s:iterator /tr /table /td /tr /table /table /body /html Displays users first name, but not the list. Struts2 mapping: action name=viewTournaments class=round.GetListAction method=getList result name=success/jsp/tournament/tournamentList.jsp/result interceptor-ref name=basicStack/ /action Thanks in advance for the help, Chriss -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [S2] Validating Forms with Wildcard Mapping
I can't see any reference anywhere that suggests that putting a wildcard in the form's action attribute will work. Even if it does work with client side validation turned off, I get the impression -- and I could be wrong -- that you've stumbled into a weird corner case that just happens to work. If you would like to have more consistency in your application's behavior, I think that Gabriel's advice is the way to go. Have each submit send Subscription_execute or Subscription_cancel, and rely on the wildcarding in struts.xml to route the request appropriately. jk On Tue, Aug 5, 2008 at 7:00 AM, Markus Stauffer [EMAIL PROTECTED]wrote: I have this in my form: s:form action=Subscription_* s:textfield key=something/ s:submit value=%{'Submit'} method=execute/ s:submit value=%{'Cancel'} method=cancel/ /s:form It works like a charm. But if i turn on client side validation there are warnings/errors. On 8/5/08, Gabriel Belingueres [EMAIL PROTECTED] wrote: AFAIK, wildcard mapping has sense only inside struts.xml. In your form, you must specify exactly which action will be called, like Subscribe_dosomething 2008/8/5 Markus Stauffer [EMAIL PROTECTED]: Hello all Say I have a struts2 form: s:form action=Subscribe_* validate=true s:textfield key=something/ /s:form The javascript validation generated for this form is unfortunately invalid. Firefox complains about the * character. Is there any way to get around this without turning to server side validation? kind regards -- Markus Stauffer - 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] -- Markus Stauffer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: dojo anchor: get widget id and targets attributes inside subscribed topic?
What did the dojo mailing list [1] [2] recommend? jk [1] [EMAIL PROTECTED] [2] http://dojotoolkit.org/* * On Wed, Jul 30, 2008 at 8:57 AM, holod [EMAIL PROTECTED] wrote: I use dojo anchor widget (s:a/). It successfully gets response in json from server, but I have several problems accessing widget, that published a topic. Please, see my code: dojo.event.topic.subscribe(/after, function(data, request, widget){ alert('inside a topic event. after request'); //data : text returned from request(the html) //request: XMLHttpRequest object //widget: widget that published the topic }); Problems: 1. Can't change data value. If I use inside dojo.event.topic.subscribe: data = this my new data!; alert(This is my new response from server: + data); alert shows, that data value was changed, but targets of dojo anchor get previous value (why???). 2.I can't get widget properties: id of widget or targets. That's terrible, I need them very much. I've dumped the object widget, but there are no fields like id or targets. -- View this message in context: http://www.nabble.com/dojo-anchor%3A-get-widget-id-and-targets-attributes-inside-subscribed-topic--tp18732617p18732617.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Possible to iterate through a java.util.Set using Struts 1?
Any reason you can't transform the Set into a List at the back end, and then iterate over the List? jk On Tue, Jul 29, 2008 at 2:16 PM, Ylva D [EMAIL PROTECTED] wrote: Hi everyone! I've just started learning Struts (1) and this is my current problem: I have a java.util.Set which is saved in the current session and I'm trying to use Struts for checking if it's not empty and in that case iterating through it (from a JSP). This is the beginning of that code: logic:notEmpty scope = session name = skillsFound logic:iterate collection = skillsFound id= thisSkill scope = session When I try stepping through the code, the logic:notEmpty tag is handled just fine, but when I get to the logic:iterate tag I get this exception: javax.servlet.jsp.JspException: Cannot create iterator for this collection Does anyone know if it's possible to iterate through a Set using Struts (1 and not 2) in any way? I could always make it work by writing a scriptlet and iterate through it the regular Java way, but I'm trying to use as much Struts as possible since I'm doing a thesis where one of the issues is what the benefits of Struts are. (And besides, I've read that using scriptlets is bad style nowadays.) So if anybody knows a Struts solution to this, I'd be very grateful! Thanks in advance! /Ylva -- View this message in context: http://www.nabble.com/Possible-to-iterate-through-a-java.util.Set-using-Struts-1--tp18718294p18718294.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Possible to iterate through a java.util.Set using Struts 1?
If this is new development, I don't understand why you would deliberately choose Struts 1 over Struts 2. Unless your goal is to prove that Struts has too many drawbacks to use. jk On Tue, Jul 29, 2008 at 2:50 PM, Ylva D [EMAIL PROTECTED] wrote: Yes, I suppose I could do that but then I consider that a drawback of Struts. Is there no other way? If there isn't, I think I'd rather use a scriptlet no matter how bad it looks.. (It's also because I'm doing this Struts project like a new version of a project where I didn't use Struts and in that project I didn't have to transform my Sets.) /Ylva Jim Kiley wrote: Any reason you can't transform the Set into a List at the back end, and then iterate over the List? jk On Tue, Jul 29, 2008 at 2:16 PM, Ylva D [EMAIL PROTECTED] wrote: Hi everyone! I've just started learning Struts (1) and this is my current problem: I have a java.util.Set which is saved in the current session and I'm trying to use Struts for checking if it's not empty and in that case iterating through it (from a JSP). This is the beginning of that code: logic:notEmpty scope = session name = skillsFound logic:iterate collection = skillsFound id= thisSkill scope = session When I try stepping through the code, the logic:notEmpty tag is handled just fine, but when I get to the logic:iterate tag I get this exception: javax.servlet.jsp.JspException: Cannot create iterator for this collection Does anyone know if it's possible to iterate through a Set using Struts (1 and not 2) in any way? I could always make it work by writing a scriptlet and iterate through it the regular Java way, but I'm trying to use as much Struts as possible since I'm doing a thesis where one of the issues is what the benefits of Struts are. (And besides, I've read that using scriptlets is bad style nowadays.) So if anybody knows a Struts solution to this, I'd be very grateful! Thanks in advance! /Ylva -- View this message in context: http://www.nabble.com/Possible-to-iterate-through-a-java.util.Set-using-Struts-1--tp18718294p18718294.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com -- View this message in context: http://www.nabble.com/Possible-to-iterate-through-a-java.util.Set-using-Struts-1--tp18718294p18718883.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Iterator index: how to index html elements? count works, but status doesn't
The version of IteratorStatus found in version 2.0.11 of the docs [1] has a getIndex() method; has it subsequently been vaporized? [1] http://struts.apache.org/2.0.11/struts2-core/apidocs/index.html?org/apache/struts2/views/jsp/IteratorStatus.html jk On Mon, Jul 28, 2008 at 4:28 AM, holod [EMAIL PROTECTED] wrote: tr id=attachedMainDocRows:property value=#document.count/ works fine. It just starts from 1, not from 0 Why? I can't understand what has happened to index. count is not so bad, thanks for you help and cooperation! -- View this message in context: http://www.nabble.com/Problem-accessing-iterated-object-%28%3Cs%3Aiterator%29-tp18614028p18686074.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Nothing helps
Just as a side note, message subject lines like Nothing helps and A similar problem should probably be avoided on this list. When someone looks at the archives because they're stumped about a problem with displaying problems within an iterator, there's no signal that this thread, for instance, might give them information about their problem. jk On Fri, Jul 25, 2008 at 8:35 AM, holod [EMAIL PROTECTED] wrote: Thank you, I've finally solved the problem! Previous solutions helped me, seems like I was making stupid mistakes. This code snippet prints links to my download action, my download action works fine. Thank you again! s:iterator value=lawDraft.docs id=doc s:url id=downloadAction action=DownloadLawDraftDocument namespace=/admin s:param name=lawDraftId value=lawDraft.id/ s:param name=documentTitle value=title/ /s:url tr td s:a href=%{#downloadAction} s:property value=title/ /s:a /td /tr /s:iterator -- View this message in context: http://www.nabble.com/Problem-accessing-iterated-object-%28%3Cs%3Aiterator%29-tp18614028p18650869.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: [s2] Making textfield input optional
Doesn't that exception usually get thrown when, in this case, ViewAction doesn't have a setInValue() method? jk On Thu, Jul 24, 2008 at 10:31 AM, Gabriel Belingueres [EMAIL PROTECTED] wrote: Which is the data type of inValue? 2008/7/24 Milan Milanovic [EMAIL PROTECTED]: Hi, I have one form with multiple textfields, and I want to one of that textfield be optional for user, i.e., he doesn't need to enter information in that particular field. Now, when user don't enter I get this in my log: ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'inValue' on 'class com.myProject.action.ViewAction: Error setting expression 'inValue' with value '[Ljava.lang.String;@1d3ac6e' How can I enable this but without getting this error ? -- Thx, Milan -- View this message in context: http://www.nabble.com/-s2--Making-textfield-input-optional-tp18632806p18632806.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com
Re: Problem accessing iterated object (s:iterator)
The 'status' variable does not hold the individual instance. It holds an IteratorStatus object, which does things like tell you whether this row is odd or even. You want to do var=document instead. On Wed, Jul 23, 2008 at 11:53 AM, holod [EMAIL PROTECTED] wrote: Plsease, see my code: table s:iterator value=%{lawDraft.docs} status=document tr td s:url id=downloadLink value=downloadLawDraftDocument.action namespace=/admin s:param name=lawDraftId value=# document.lawDraft.id / s:param name=documentTitle value=#document.title / /s:url a_ href=#downloadLink s:property value=#document.title/ /td td delete document img_ align=left src=s:url value=/images/admin/delete.gif/ onclick=/ /td /tr /s:iterator /table previous action has method getLawdraft(); LawDraft has method getDocs(); getDocs() returns a List List consists of Document objects, the have methods getLawDraft().getId() and others. Iterator repeat 5 times (correct), but output doesn't have values (they are! previous action prints them using logger) Please, see the output: tr td a_ href=#downloadLink /td td delete document img_ align=left src=/CLIAccess/images/admin/delete.gif onclick=/ /td /tr *Sorry for a_ and img_, Nabble doesn't escape html ( -- View this message in context: http://www.nabble.com/Problem-accessing-iterated-object-%28%3Cs%3Aiterator%29-tp18614028p18614028.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] -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com