Re: struts2 (2.2.1) adds field error and doesn't return input!!
NEVER MIND it turns out that a co-worker had touched validate() method: public void validate(){ MapString, ListString fieldError = new HashedMap(); setFieldErrors(fieldError); } what i didn´t know is that (calling save action) after validateSave, Struts 2 continues executing validate, erasing, in this case, field errors. I'm so grateful with your support, keep working hard thanks!! 2013/3/26 Alejandro apar...@gmail.com he used onclick, cancel the click event 2013/3/26 Paul Benedict pbened...@apache.org Correct. Return true to submit; false to cancel the event. On Tue, Mar 26, 2013 at 1:10 PM, Maurizio Cucchiara mcucchi...@apache.orgwrote: I could be wrong, but if you don't return true on submit event, the form will never get submitted. Twitter :http://www.twitter.com/m_cucchiara G+ :https://plus.google.com/107903711540963855921 Linkedin:http://www.linkedin.com/in/mauriziocucchiara VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara Maurizio Cucchiara On 26 March 2013 18:44, Dave Newton davelnew...@gmail.com wrote: On Tue, Mar 26, 2013 at 1:42 PM, Alejandro apar...@gmail.com wrote: you don't put validate to true in the form That's only for client-side validation. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2-jQuery plugin
Hi Zoran I don't need to use the plugin, simple jQuery is good as long as it works Could you please show your code? Thanks. 2012/11/22 Zoran Avtarovski zo...@sparecreative.com Hi Lucas, I don't use the plugin as I find using jQuery without a plugin to be simple enough. I suspect that if you look at the generated javascript in your searchResult.jsp page the jQuery binding will be waiting for a document ready trigger which isn't fired for ajax requests. The way I get around this to use the jQuery live function for binding which works perfectly, but as I said not having used the sj plugin not sure what you need to do. Z. On 21/11/12 12:46 AM, lucas owen sr.ilus...@gmail.com wrote: Hi Struts users! I'm building a web app and I have a serious problem: index.jsp is a search form with 2 combo boxes which i populate with sj:select (this works correctly) when the user clicks search, the form sends the data to search.action and the results are displayed in searchResult.jsp in this searchResult.jsp i have the same 2 como boxes (same code) but 1.- they dont work (they dont call the sj:select href action) 2.- they dont get pre-selected with the value the user entered so the question is can i use sj:select after coming from search.action or this just can be used in jsp without any previous struts processing (like index.jsp)? thank you so much in advance!!
Re: Struts2-jQuery plugin
no no, sj:select is working perfectly in index.jsp but not in searchResults.jsp (it's the same code) why? 2012/11/20 Martin Gainty mgai...@hotmail.com Lukasz i assume this is what you are referring to: sj:select href=%{remoteurl} id=echo name=echo list=languageList emptyOption=true headerKey=-1 headerValue=Please Select a Language/ you will need to populate the remoteurl variable with a url tag that defines a 'registered' action e.g. s:url var=remoteurl action=jsonsample/ does this help? Martin __ Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Tue, 20 Nov 2012 14:46:49 +0100 Subject: Struts2-jQuery plugin From: sr.ilus...@gmail.com To: user@struts.apache.org Hi Struts users! I'm building a web app and I have a serious problem: index.jsp is a search form with 2 combo boxes which i populate with sj:select (this works correctly) when the user clicks search, the form sends the data to search.action and the results are displayed in searchResult.jsp in this searchResult.jsp i have the same 2 como boxes (same code) but 1.- they dont work (they dont call the sj:select href action) 2.- they dont get pre-selected with the value the user entered so the question is can i use sj:select after coming from search.action or this just can be used in jsp without any previous struts processing (like index.jsp)? thank you so much in advance!!
Re: how to remove .action suffix in struts 2.1
sorry to resurrect this thread but this solution doesn't work for me (and I'm using struts 2.1.6) do i have to change anything else in web.xml? I have tried from filter-mapping filter-namestruts2/filter-name url-pattern*.action/url-pattern /filter-mapping to filter-mapping filter-namestruts2/filter-name url-pattern*/url-pattern /filter-mapping then it works, but I have problems with the CSS any help is appreciated!! 2010/8/13 Dave Newton davelnew...@gmail.com Again, XML configuration is the preferred mechanism. Dave On Thursday, August 12, 2010, Ruben Cepeda ruben_cep...@hotmail.com wrote: If you haven't done so yet you'll have to create a struts.properties file and override it. Here http://struts.apache.org/2.0.11/docs/strutsproperties.html -Ruben Cepeda Date: Wed, 11 Aug 2010 14:57:33 +0530 Subject: how to remove .action suffix in struts 2.1 From: mail.supra...@gmail.com To: user@struts.apache.org Hi all, I need to remove the .action suffix associated with the actions. Please advise how to do this. Thanks and regards, Supratim - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: how to remove .action suffix in struts 2.1
thanks Lukasz, but I get the same error. my welcome file is index.html, so first of all it complains: HTTP 404 - There is no Action mapped for namespace / and action name index.html But now I can access my actions without the .action in the URL. The problem is that the CSS's dont display, I presume that it's requesting style.css and because of the new configuration it's expecting style.css to be an action... -- My configuration: constant name=struts.action.extension value=/-- in struts.xml filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping -- in web.xml thanks in advance!! 2012/7/10 Łukasz Lenart lukasz.len...@googlemail.com 2012/7/10 lucas owen sr.ilus...@gmail.com: filter-mapping filter-namestruts2/filter-name url-pattern*/url-pattern /filter-mapping It should be /* And what kind of error do you have with css ? Regards -- Łukasz mobile +48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
validation method is being executed twice in IE (jCaptcha img)
Hi Struts 2 Users! I have this little problem here, only in Internet Explorer (it works in Firefox and Chrome): the action is being executed twice I think because in the JSP form I have a captcha with an image and when it fetches the image it creates a new request. Anybody knows how to solve it? thanks in advance!!
Re: s:if test condition
OMG! that was it!!! I would never have figured out by myself, THANKS BILL!!! 2010/6/26 Bill Bohnenberger bill98...@gmail.com Since 'activated' is a String, try swapping your single double quotes, e.g. s:if test='%{warning.activated==Y}' -Bill On Sat, Jun 26, 2010 at 11:28 AM, lucas owen sr.ilus...@gmail.com wrote: Hi Struts 2 users: I was wondering if you can use a s:if test based on a pojo's attribute value: POJO: public class Warning{ String text; String activated; // Y or N } JSP: s:if test=*%{warning==null}* -- *Warning* null! /s:if s:else -- *Warning* not null! -- Activated: s:property value=*warning.activated*/ s:if test=*warning.activated == 'Y' * -- *Warning* *activated*. /s:if s:else -- *Warning* *deactivated*. /s:else /s:else The first test (check null value) works OK, but the second always goes through the else part. I have tried test=*%{warning.activated == 'Y' } and *test=*%{#warning.activated == 'Y' } *too but it doesnt work either. I dont know what is wrong, s:property value=*warning.activated*/ shows the value correctly... I know I can use an auxiliar boolean variable depending on the value Y/N but I would like to know why it doesnt work this way. THANKS IN ADVANCE
s:if test condition
Hi Struts 2 users: I was wondering if you can use a s:if test based on a pojo's attribute value: POJO: public class Warning{ String text; String activated; // Y or N } JSP: s:if test=*%{warning==null}* -- *Warning* null! /s:if s:else -- *Warning* not null! -- Activated: s:property value=*warning.activated*/ s:if test=*warning.activated == 'Y' * -- *Warning* *activated*. /s:if s:else -- *Warning* *deactivated*. /s:else /s:else The first test (check null value) works OK, but the second always goes through the else part. I have tried test=*%{warning.activated == 'Y' } and *test=*%{#warning.activated == 'Y' } *too but it doesnt work either. I dont know what is wrong, s:property value=*warning.activated*/ shows the value correctly... I know I can use an auxiliar boolean variable depending on the value Y/N but I would like to know why it doesnt work this way. THANKS IN ADVANCE
Re: different validate's() for different actions in java class
Burton, that was what i was looking for YOU #1 THANKS!!! 2010/6/24 David Lu l...@lululand.com I think having separate classes would be better. If the validations are almost the same, i.e. one for Add and one for Update of the same object, then perhaps you can have just one action extend another and they can share some common validation code in a method defined in the base action. On 06/24/2010 07:53 AM, lucas owen wrote: Hi Struts 2 users, I have in a class different actions, each one with its own method. I want a validate() method for each of these actions, I'm not sure if I can have more than one validate() method in a class, so all the actions would have the same validation. should i split all my actions in different classes so each one could have its own validate() method?? thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
different validate's() for different actions in java class
Hi Struts 2 users, I have in a class different actions, each one with its own method. I want a validate() method for each of these actions, I'm not sure if I can have more than one validate() method in a class, so all the actions would have the same validation. should i split all my actions in different classes so each one could have its own validate() method?? thanks
sx:dateTimePicker disable textfield
Hi Struts 2 users! I have a jsp in which I allow the users to enter a date: sx:datetimepicker name=*dDate* label=*Date* iconPath=* /images/ico-calendar.gif* displayFormat=*dd/MM/*/ If the user enters anything with wrong format (for instance, ), the datetimepicker changes this value to 01/01/1970 (I dont know why!!) so I want to disable the textbox so that the user only can introduce a date when she clicks on the calendar icon. Any ideas? Thanks in advance!
Struts 2 + dates
Hi Struts users! I need to present a java.util.Date in a jsp. It has to be within a s:textfield because the user can modify/edit this date. The problem is when I display the date s:textfield name=myDate/, it shows the date with a wrong format. I can use fmt:formatDate value=${myDate} pattern=dd/MM/ / but in this case the date wouldnt be editable... any ideas??? Thanks in advance!
Re: Struts 2 + dates
thanks to all what a cracks u r 2010/6/8 sandeep kotha sandeep4u.ko...@gmail.com I agree with ken simple best thing to do %@ taglib prefix=sx uri=/struts-dojo-tags% sx:head / sx:datetimepicker key=bean.date displayFormat=dd/MM//. On 8 June 2010 23:09, lucas owen sr.ilus...@gmail.com wrote: Hi Struts users! I need to present a java.util.Date in a jsp. It has to be within a s:textfield because the user can modify/edit this date. The problem is when I display the date s:textfield name=myDate/, it shows the date with a wrong format. I can use fmt:formatDate value=${myDate} pattern=dd/MM/ / but in this case the date wouldnt be editable... any ideas??? Thanks in advance!
Re: struts2 + javascript doubt
Hi, I have tried a href=*javascript:fPrimerNivel( ' *${info.id_html} ' *);* ( note the single quotes) and it works Thank you so much Cimballi, you are a crack 2010/5/24 Cimballi cimba...@cimballi.net Yes you can but instead of using s:property you can use directly JSP EL like {myBean.propertyName}. Cimballi On Mon, May 24, 2010 at 1:10 PM, lucas owen sr.ilus...@gmail.com wrote: Hi: is it possible to pass a dynamic parameter to a javascript function??? I'm trying this: h3 id=s:property value=*'info.id_html'*/ class=*head* a href=*javascript:fPrimerNivel(*s:property value=*'info.id_html'*/*);* s:property value=*info.titulo_menu*//a /h3 javascript function: fPrimerNivel(id){ alert(id); } yields [object] If I try the same, but with javascript:fPrimerNivel(this.id), I get [undefined] I dont know if this is possible, any help would be so much appreciated ciaooo -- Cimballi JAVA J2EE Freelance http://cimballi.elance.com/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts2 + javascript doubt
Hi: is it possible to pass a dynamic parameter to a javascript function??? I'm trying this: h3 id=s:property value=*'info.id_html'*/ class=*head* a href=*javascript:fPrimerNivel(*s:property value=*'info.id_html'*/*);* s:property value=*info.titulo_menu*//a /h3 javascript function: fPrimerNivel(id){ alert(id); } yields [object] If I try the same, but with javascript:fPrimerNivel(this.id), I get [undefined] I dont know if this is possible, any help would be so much appreciated ciaooo
previous action
Hi Struts users: An easy one: how can I figure out the struts 2 previous action, the one I come from? I have tried everything but nothing works... Thanks in advance!!!
Re: previous action
thanks for the answer, but I'm completely sure you can obtain it from ActionContext or ActionInvocation or something similar... the problem is I don´t know how. 2010/4/15 Kun Niu haoniu...@gmail.com You'll have to track it all by yourself with an action ID or something related, as a parameter of your request url. lucas owen wrote: Hi Struts users: An easy one: how can I figure out the struts 2 previous action, the one I come from? I have tried everything but nothing works... Thanks in advance!!! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
s:iterator status doubt
Hi Struts users: I'm wondering if it would be possible to pass status.index attribute of s:iterator to a javascript function. Something like this: s:iterator value=*notificationList* var=*notification* status=*stat* tr td scope=*row* s:checkbox name=*IdNotification* value=*%{selected}* fieldValue=* %{notificationID}* onclick=*javascript:markNotification(stat.index);*/ /td /tr Thanks in advance!
struts2 checkbox
Hi Struts users: I'm working with Struts 2 (v 2.1.6) and I have the following problem: I have a list of notifications, which I display in a table in a jsp: s:iterator value=*notificationList* var=*notification* tr td scope=*row*s:checkbox name=*notificationIdList* value=* %{selected}* fieldValue=*%{notificationId}*//td td scope=*row*s:property value=*notificationName*//td /tr /s:iterator s:submit action=*markNotifications* value=** As you can see, each notification has a checkbox: if the user selects a notification, its Id is sent to the action. So in my action I have a ListLong notificationIdList (with getters setters) to receive all the Id's of the notifications selected by the user. I iterate this list to operate with the notification id's received: IteratorLong iter=*notificationIdList*.iterator(); *while*(iter.hasNext()){ Long notificationId=iter.next(); When I debug the action, in my ListLong notificationIdList I get a XWorkList with the id's of the notifications selected and everything is right, but if no notification was selected, in the XWrokList I get a [ognl.NoConversionPossible] (NOT a NULL!!!) and when I try Long notificationId=iter.next(); it throws an exception... Anyone knows a workaround for this? In this case, I want to show a message to the user, warning him that at least he has to select one notification. Thanks in advace, Sr.Ilustre.
Re: possible s:submit with parameter?
thanks to all you have been very very helpful!!! 2010/3/8 Alex Rodriguez Lopez alo...@flordeutopia.pt You can use hidden fields inside of the form which will be sent too on submit as GET or POST params(usually good for IDs). Alex Em 05-03-2010 23:13, Adam Pinder escreveu: Any form textfield will be submitted when page submitted which is effectively a parameter. Adam On 5 Mar 2010, at 19:46, lucas owen sr.ilus...@gmail.com wrote: Hi Struts users: I'm wondering if it is possible to pass a parameter inside a s:submit tag. I'm working with the following form (this is just a sketch) on a webpage, in which I collect some user data and display a list of elements (let's say books): ___ Name:|___| Surname: || List of Books: Title Author Details XYZ ABC s:submit action=bookDetails param=bookId ... Note: it has to be a submit because if the user enters a name or surname, I want it to be displayed when the users comes back from the book details page! I dont know if this is possible with Struts 2 Thanks in advance - 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
problem with getText()
Hi Struts users: I'm working with Struts 2. I have following property file: solicitud.error.solicitante.enCalidad = Debe introducir en calidad de del solicitante. . . . solicitante.enCalidad = En calidad I know keys are similar, but not the same. When I try to retrieve getText(solicitud.error.solicitante.enCalidad), it yields En calidad Is this a bug? Thanks in advance!!
Re: possible s:submit with parameter?
Of course!! The problem is I can't use javascript, the application is supposed to work in any computer, any browser...no matter how old they are Any suggestions? 2010/3/5 Burton Rhodes burtonrho...@gmail.com Sounds like a good use for javascript , not a struts tag. On 3/5/10, lucas owen sr.ilus...@gmail.com wrote: Hi Struts users: I'm wondering if it is possible to pass a parameter inside a s:submit tag. I'm working with the following form (this is just a sketch) on a webpage, in which I collect some user data and display a list of elements (let's say books): ___ Name:|___| Surname: || List of Books: Title AuthorDetails XYZABC s:submit action=bookDetails param=bookId ... Note: it has to be a submit because if the user enters a name or surname, I want it to be displayed when the users comes back from the book details page! I dont know if this is possible with Struts 2 Thanks in advance -- Sent from my mobile device - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: possible s:submit with parameter?
yes, of course... but imagine you have a list of elements, how do you pass the Id of the element you want to display in other page with a s:submit??? (I cant use javascript) 2010/3/6 Adam Pinder apin...@hotmail.co.uk Any form textfield will be submitted when page submitted which is effectively a parameter. Adam On 5 Mar 2010, at 19:46, lucas owen sr.ilus...@gmail.com wrote: Hi Struts users: I'm wondering if it is possible to pass a parameter inside a s:submit tag. I'm working with the following form (this is just a sketch) on a webpage, in which I collect some user data and display a list of elements (let's say books): ___ Name:|___| Surname: || List of Books: Title AuthorDetails XYZABC s:submit action=bookDetails param=bookId ... Note: it has to be a submit because if the user enters a name or surname, I want it to be displayed when the users comes back from the book details page! I dont know if this is possible with Struts 2 Thanks in advance - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
possible s:submit with parameter?
Hi Struts users: I'm wondering if it is possible to pass a parameter inside a s:submit tag. I'm working with the following form (this is just a sketch) on a webpage, in which I collect some user data and display a list of elements (let's say books): ___ Name:|___| Surname: || List of Books: Title AuthorDetails XYZABC s:submit action=bookDetails param=bookId ... Note: it has to be a submit because if the user enters a name or surname, I want it to be displayed when the users comes back from the book details page! I dont know if this is possible with Struts 2 Thanks in advance
horizontal scroll in s:select
Hi struts users, I have a select with options too large (don't fit on the screen) so I need a horizontal scroll. By the way, it has to work on Firefox and IExplorer. anybody knows a possible solution for this problem? Thanks in advance, Sr. Ilustre
Re: checkbox array
I really think this is a bug in Struts 2 checkbox array behaviour! to solve this problem I have created a variable to keep the value of the previous selection. if the actual selection is equals to the previous selection that means the user want to uncheck the checkbox this at least works, and is more straightforward than writing an interceptor bye and thanks robert for your try!!! 2010/2/24 Robert Graf-Waczenski r...@lsoft.com Post the relevant part of your JSP, please. I know that at least for Struts 2.1.8.1 there is a new MultiselectInterceptor class that would solve your problem for a select with type=multiple. There is a CheckboxInterceptor class as well. Maybe there is none for a checkbox array. Anyway, let us have a look at your JSP to see what S2 tags you are using. If all else fails, you could write your own interceptor to deal with the issue. Robert lucas owen schrieb: mmm I'm using Struts 2 (struts2-core-2.1.6) and the last checkbox (of a checkbox array) doesn't get unchecked, as I have previously commented... WHY? It seems it has to be always selected one of the checkboxes at least 2010/2/23 Robert Graf-Waczenski r...@lsoft.com lucas owen schrieb: Hi struts users, I'm working with a checkbox array; the problem is that it doesn't work as a single checkbox: I can't have the checkbox array with all checkboxes unchecked (apart from the beginning) Example: I check checkbox1. I check checkbox2. I uncheck checkbox2 -- OK I uncheck checkbox1 -- checkbox1 doesnt get unchecked Is this working as normal or I'm performing wrong??? Thanks in advance Peter This should work correctly out of the box with Struts2 because there are interceptors and hidden parameters that work the magic for you. In Struts1, there is no such magic and the behavior you describe is normal because if none of the checkboxes is checked, then the resulting browser request does not contain the corresponding request parameters *at all*, meaning that your server-side state is unchanged. Solution: Implement the ActionForm.reset() method to deal with this properly, i.e. reset your form values to null (or whatever) when the request parameters are missing. Robert - 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
checkbox array
Hi struts users, I'm working with a checkbox array; the problem is that it doesn't work as a single checkbox: I can't have the checkbox array with all checkboxes unchecked (apart from the beginning) Example: I check checkbox1. I check checkbox2. I uncheck checkbox2 -- OK I uncheck checkbox1 -- checkbox1 doesnt get unchecked Is this working as normal or I'm performing wrong??? Thanks in advance Peter
Re: checkbox array
mmm I'm using Struts 2 (struts2-core-2.1.6) and the last checkbox (of a checkbox array) doesn't get unchecked, as I have previously commented... WHY? It seems it has to be always selected one of the checkboxes at least 2010/2/23 Robert Graf-Waczenski r...@lsoft.com lucas owen schrieb: Hi struts users, I'm working with a checkbox array; the problem is that it doesn't work as a single checkbox: I can't have the checkbox array with all checkboxes unchecked (apart from the beginning) Example: I check checkbox1. I check checkbox2. I uncheck checkbox2 -- OK I uncheck checkbox1 -- checkbox1 doesnt get unchecked Is this working as normal or I'm performing wrong??? Thanks in advance Peter This should work correctly out of the box with Struts2 because there are interceptors and hidden parameters that work the magic for you. In Struts1, there is no such magic and the behavior you describe is normal because if none of the checkboxes is checked, then the resulting browser request does not contain the corresponding request parameters *at all*, meaning that your server-side state is unchanged. Solution: Implement the ActionForm.reset() method to deal with this properly, i.e. reset your form values to null (or whatever) when the request parameters are missing. Robert - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org