Pre-populated option values of a select not got on Submit
I have a select/option in my JSP like this: html:select size=3 styleClass=menu styleId=catsel property=category multiple=yes html:options collection=catSelList labelProperty=displayName property=id/ /html:select I have also defined the bean for catSelList: bean:define id='catSelList' property='catSelList' name='editEPForm'/ In the Form java file, I have the method public Collection getCatSelList(), that returns the list of values that needs to be displayed in the select/option menu. The page works fine when opened. The values that need to be displayed in the options are displayed correctly. But the problem occurs on submit. Whatever I do, the property category (which refers to the html:select) is always null. Even if I add values from another list into this select/option menu, the value of category on submit is null. How do I rectify this problem? This is what I want - if the user doesn't change anything in that field, the pre-populated values needs to be stored under category. If he does change anything, the new values needs to be stored under category. How do I do this? Thanks, Sridhar
RE: problem in formbean
Is this value a long or int, or whatever numeric value, And u r trying to enter characters in it then validation fails ? Cuz if so the Struts won't be able to populate the long with the string value U entered and in this case it'll keep it's old numeric value. In case of validating numeric fields always make them Strings in the form, To be able to keep the updated value after the validation fails. -Original Message- From: notify@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of prkumar_1234 Sent: Thursday, November 30, 2006 5:46 AM To: struts-user@jakarta.apache.org Subject: problem in formbean I got some problem in struts can you please help me. 1) in jsp iam displaying values from javabean in textboxes.(i can change these values) 2) when i submit with modified values , iam doing validation in formbean. 3) When validatio fails i formbean returning to same jsp but it is displaying old values not modified values can you give me some hint how to do this. thank you verymuch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validator without Struts
U can use the nn-validation.js, have a look : http://www.siteexperts.com/tips/functions/ts21/page10.asp -Original Message- From: Jim Reynolds [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 12:22 AM To: user@struts.apache.org Subject: Validator without Struts Hello, I have the need to do some form validations, but the site in question is not running Struts, nor WW or any framework. :-( It is an older site and I have been commissioned to do some validtion within it. I was hoping that the Validator that comes with Struts may be able to work as a stand-alone entity. I am having trouble finding info on the validator that is not linked directly with struts. Is this info available, and if so where? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Does Struts 2 solve the action chaining problem?
Craig and Mark, Thanks a lot for pointing out the Preparable interface. I think that solves a major problem with Struts 1. I'm yet to experiment heavily with WW/Struts 2, but I feel like the Interceptor concept is a very powerful approach, though a bit dangerous if not well controlled. Craig, We, actually, decided that we don't want to get into JSF yet. But if this prerender method is equivalent to the onPageLoad() method in ASP .NET, then it's a very important piece that is really missing from the JSF spec. Yujun, Your idea is brilliant and it never crossed my mind. If we stick with Struts 1, I think I will try that. Christopher, I really wonder if the Struts you're talking about is the one I've using for years now!! The Struts I know sucks big time when it comes to action chaining. I'm afraid I don't understand how defining two mappings, one with validation turned on and the other turned off, solves the first problem! As for the second problem, your solution still involves action chaining which should be avoided unless you've done something equivalent to what Yujun did. Thanks everyone for your help. -Original Message- From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 29, 2006 5:36 PM To: Struts Users Mailing List Subject: Re: Does Struts 2 solve the action chaining problem? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tarek, Tarek Nabil wrote: One of the problems with Struts was that if you had a page that requires some setup and this page submits to an Action, then you would not be able to set validate to true on that action because if validation problems occur then Struts will take you directly to the input JSP without performing the setup and your JSP wouldn't work. A solution to that would be to specify the input of the action as the setup action, which means you're doing action chaining and Struts is not good at that (it will reset your form among other things). The solution of choice for us so far was to call validate() ourselves in the action and if a validation problem occurs then we call the setup method (eventually you start using your action methods as an API which still was not good). I totally disagree. If you have an action that you want to use like this, you can always set up two different mappings -- one that /does/ validate and another that does /not/ validate. My experience has been that Struts is very good at action chaining... in fact, that's the major advantage of Struts in the first place: the ability to map URIs to actions and specify their relationships through forward mappings. Another problematic scenario is the case when you're editing some database record for example. When you go to your setup action for the first time, you will populate drop down lists for example, and then load the existing values from the database to your JSP fields. If the user attempts to save and some problem occurs then in the setup action, you will need to again populate the drop down lists, but you will NOT want to overwrite the user's inputs with the existing data. This is very similar to the first problem, but you would also need to pass some flag to the setup method to tell it whether to copy the data from the database to your ActionForm. In this case, what you want is something like: LoadAction - EditAction - Display form Form submits to SaveAction, which has EditAction as input (not LoadAction). This is pretty standard stuff, and works beautifully. Does Struts 2 or even WW 2.2.4 solve that problem in an elegant way? I really hope so, since Struts 1.x also does. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFbYyx9CaO5/Lv0PARArpHAJ0U3fHybMWepSZxPjciDU3+6M2PwQCgoy8B FRlfdQsyONpgqGvrHBuZuFw= =EbD/ -END PGP SIGNATURE- DISCLAIMER This email and any files transmitted with it are confidential and contain privileged or copyright information. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify us of the receipt thereof. If you have received this message in error, please notify the sender immediately, and delete this email from your system. Please note that e-mails are susceptible to change.The sender shall not be liable for the improper or incomplete transmission of the information contained in this communication,nor for any delay in its receipt or damage to your system.The sender does not guarantee that this material is free from viruses or any other defects although due care has been taken to minimise the risk. ** - To unsubscribe, e-mail: [EMAIL
VALIDATION
hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Tiles, Lose of Performance ? :-(
I could just use this : ** tiles-defs.xml ** definition name=.base page=/layout/base.jsp /definition ** base.jsp ** body id=base_body div id=base_header [EMAIL PROTECTED] page=incl/header.jsp % /div div id=base_info jsp:include page=incl/info.jsp.jsp/ /div [...] And use the base.jsp-layout in different pages. And u see I'm not using tiles:insert tag ...
Re: Struts Tiles, Lose of Performance ? :-(
Thomas Thomas ha scritto: I could just use this : ** tiles-defs.xml ** definition name=.base page=/layout/base.jsp /definition ** base.jsp ** body id=base_body div id=base_header [EMAIL PROTECTED] page=incl/header.jsp % /div div id=base_info jsp:include page=incl/info.jsp.jsp/ /div [...] And use the base.jsp-layout in different pages. And u see I'm not using tiles:insert tag ... I can't see your point, you're using base.jsp as a normal JSP page, not a layout page. Your base.jsp will always render the same. If you use tiles:insert attribute... you can fill those attributes with different JSP subpages, reusing base.jsp as a layout page. By the way, are you sure you WANT to use Tiles? Maybe you should try SiteMesh instead, that probably is what you need. Ciao Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts, AJAX, JSP, and JavaScript question
From: Chris Pratt [mailto:[EMAIL PROTECTED] eval() evaluates JavaScript, not XML or HTML. Well, in FF, apparently it evaluates XML to some degree, huh? Dave On 11/29/06, Dave Newton [EMAIL PROTECTED] wrote: From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] (interestingly, in IE I get a syntax error, because it's trying to interpret the markup as script, but in FF it just quietly doesn't work, not even a notice in Firebug). Something else interesting in FF: eval(foobar/foo/bar) XML tag name mismatch eval(foo) unexpected end of XML source - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Tiles, Lose of Performance ? :-(
But u suggested me to use the [EMAIL PROTECTED] ... % if I want to add static jsp content. Well then it's in contradiction with what u say ! I understand that tiles:insert attribute... let u fill the attributes but why do u suggest me then to use [EMAIL PROTECTED] ... % ? This attribute will then render always the same in the layout like u say !
Re: VALIDATION
The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in formbean
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 prkumar, prkumar_1234 wrote: 1) in jsp iam displaying values from javabean in textboxes.(i can change these values) 2) when i submit with modified values , iam doing validation in formbean. 3) When validatio fails i formbean returning to same jsp but it is displaying old values not modified values I'm guessing that your action mapping looks something like this: action path=/edit type=... forward name=success path=/edit.jsp / /action action path=/save type=... name=... validate=true input=/edit.do forward name=success path=... /action Note that the 'input' attribute is set to edit.do, which will re-run your action and probably re-fetch the original values. You need to make sure that your input points to the edit.jsp page. If that's not the problem, then do you have code in your JSP that fetches the original values from somewhere (like a database)? Or, do you use actions for that kind of thing? Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFbuOg9CaO5/Lv0PARAuBrAKCGsLR/OEPjH098CttCtlUqur/o5gCcDGkI Fc29gGupfpPFKvYAahhUIzc= =Gkpe -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Last Page Regenration
Hi, Can i know how to unregister from this site On 11/9/06, Balwinder [EMAIL PROTECTED] wrote: Hi All !! I have a situation in my application, i want to implement a functionality that does, if a user accidentally close his browser window, on his next request(in new window) to the application he should be displayed with the last page he visited this should happen after login(authentication). I want this to implement without cookies. Any help would be highly appreciated. Thanks and Regards, Balwinder Kumar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Pavan
Re: Does Struts 2 solve the action chaining problem?
Action Chaining First, we usually define action chaining as creating a move action by having a copy action forward to a delete action. Simply going from one action to another isn't a classic example of harmful chaining. The key point is whether only one action resolves the business use case. Classic action chaining is considered harmful because it implies that the Actions have become a business facade. Any Action should be able to call facade.copy and facade.delete from a move Action. Better yet, the facade should provide a move method, and implement it any way it likes. We should not feel like we need to reuse multiple Action classes to solve one business use case. Struts 1 Actions were intended to be what Martin Fowler calls a transaction script, where move is one transaction, not two. The design of Struts 1 made action chaining difficult because s1 repopulates the request on every forward. When people start to use the S1 actions as an API, they want to do things like change properites on an ActionForm, and are surprised when the framework resets their changes! The Struts 2 group does discourgage classic Action chaining, because it implies the business API is underdevelpoed. Albeit, we do provide a action chaining result that copies the properties from one Action to the next. The interceptor stack and result are processed for the chained action, but the request doesn't pass back through the container. * http://struts.apache.org/2.x/docs/action-chaining.html So you can set a flag on the copy action and have it picked up by the delete action. This is *not* considered an ideal practice, since coupling individual Action classes complicates the API, but it's there when people choose to use it. So, yes, Struts 2 has an elegant solution for action chaining, if you choose to use it. Control preparation As mentioned, Struts 2 solves the control population issue via the preparable interface. Another solution is to use the action tag to execute an Action in place. * http://cwiki.apache.org/confluence/display/WW/action One way to use this tag is to put a control on a snippet JSP that is rendered as a result of an Action that does nothing but create the object that populates the control. The action tag sets executeresult=true, then control markup will be included into the page (like a tile), after the action executes. In effect, exectuteResult actions can be used like a tag that can run its own action before emitting the markup. Input.jsp %@ taglib prefix=s uri=/struts-tags % s:form s:action name=languages namespace=/ActionTag executeResult=true/ s:action name=colors namespace=/ActionTag executeResult=true/ ssubmit/ /s::form Languages.jsp %@ taglib prefix=s uri=/struts-tags % s:select tooltip=Choose Your Favorite Language label=Favorite Language list=favoriteLanguages name=favoriteLanguage listKey=key listValue=description emptyOption=true headerKey=None headerValue=None/ Languages.java (execute) public String execute() { favoriteLanguages.add(new Select.Language(EnglishKey, English Language)); favoriteLanguages.add(new Select.Language(FrenchKey, French Language)); favoriteLanguages.add(new Select.Language(SpanishKey, Spanish Language)); return SUCCESS; } struts.xml (Input, Languages) action name=Input result type=plaintextInput.jsp/result /action action name=Languages class=app.Languages resultLanguages.jsp/result /action The advantage being that the Languages action could be dropped in whereever the Languages control is needed, and that the Action for the form doesn't need to know how to populate the Languages control. Now, the Action is going to be hit every time the page is rendered, but so long as you are using a caching data access layer, like IBATIS or Hibernate, it will end up being a memory-to-memory transfer, rather than a database access. -Ted. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: VALIDATION
Sorry, I assumed you were using S1, I don't know how for s2. On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
In struts 2 if i have validation enabled an i call an action Customer!registerCustomer.action, te validation get executed, and if its fails what results uses, and if the validation passwhat it does...execute the action called maybe... -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 11:10 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION Sorry, I assumed you were using S1, I don't know how for s2. On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
From: Juan Espinosa [mailto:[EMAIL PROTECTED] Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? Struts2 is rather different, but you can still do your validation in your actions if you really want to (or do additional business-logic oriented validation). Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Last Page Regenration
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Generally this is at the bottom of all messages. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parameters not being set on Action in Struts 2
I dropped in the JARS from the the 2.0.1 showcase, and it seemd to work just fine. You might want to try deploying it on another workstation there. -Ted. On 11/29/06, Tarek Nabil [EMAIL PROTECTED] wrote: Thanks Ted. I sent the WAR file and zip file containing the source of the action to your email address directly. I have a couple of other questions that I'll post on another thread and I hope you'll help me with them, so that I can conclude my evaluation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VALIDATION
I want to use the validation framework, but i cant it get work well Now i have the actions to register a user, i want that before registering get validated...but i cant... -Mensaje original- De: Dave Newton [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 11:49 a.m. Para: Struts Users Mailing List Asunto: RE: VALIDATION From: Juan Espinosa [mailto:[EMAIL PROTECTED] Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? Struts2 is rather different, but you can still do your validation in your actions if you really want to (or do additional business-logic oriented validation). 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]
ActionErrors and ActionMessages not working.
Hi, I'm using struts 1.2 version and currently held up in a minor issue but I could not figure out what i'm missing. In the code snippet below, From Action class I'm adding an ActionErrors to display an Error message in the JSP. In JSP I've a message Tag with logic:messagesPresent property=error correctly. The Action is correctly associated to a ActionForm. But when I forward to JSP after saveErrors(), it throws a ClassCastException as below. I'm using the same code in some other Action class, it is working fine. Can anyone guide me. Thanks. java.lang.ClassCastException at org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:224) at org.apache.jsp.jsp.internal.reports.LoanActivitySearch_jsp._jspx_meth_ht ml_errors_0(LoanActivitySearch_jsp.java:731) at org.apache.jsp.jsp.internal.reports.LoanActivitySearch_jsp._jspService(L oanActivitySearch_jsp.java:244) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) Code snippet from Action class: ActionErrors errors = new ActionErrors(); if(resultHashMap.get(MyAccConstants.ERRORS_KEY) != null) { String errorCode = null; ErrorDetail[] errorDetails = (ErrorDetail[]) resultHashMap.get(MyAccConstants.ERRORS_KEY); if (errorDetails != null errorDetails.length 0) { int errorSize = errorDetails.length; for (int index = 0; index errorSize; index++) { errorCode = errorDetails[index].getErrorCode(); errors.add(error, new ActionMessage(error.code.+ errorCode)); } } saveErrors(request, errors); } return mapping.findForward(ActionConstants.SUCCESS); _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or [EMAIL PROTECTED] and delete this EMAIL including any attachments _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question about using beans in html:link tags
My search returns multiple rows (as seen in the for loop).. How can I possibly have a session when I dont know what link the user is going to click? On 11/29/06, Asthana, Rahul [EMAIL PROTECTED] wrote: Priya, As a short term solution you can create a new tag,as in myLibrary:link which derives from html:link and knows how to deal with AccountInfo bean. But if I may,I would suggest rethinking the architecture of your application, as in maintaining the AccountInfo object in session instead of passing it through URL encoding. Cheers Rahul
RE: Newbie question about using beans in html:link tags
Pass AccountId(?) to the next Action and then retrieve the AccountInfo object again based on that id.Now, you can pass it to the jsp for display and put it in session if you so desire. -Original Message- From: priya [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 11:05 AM To: Struts Users Mailing List Subject: Re: Newbie question about using beans in html:link tags My search returns multiple rows (as seen in the for loop).. How can I possibly have a session when I dont know what link the user is going to click? On 11/29/06, Asthana, Rahul [EMAIL PROTECTED] wrote: Priya, As a short term solution you can create a new tag,as in myLibrary:link which derives from html:link and knows how to deal with AccountInfo bean. But if I may,I would suggest rethinking the architecture of your application, as in maintaining the AccountInfo object in session instead of passing it through URL encoding. Cheers Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator Framework problem
Nobody can help me ? No-one has *Any* idea ?
Re: Validator Framework problem
On 11/28/06, Thomas Thomas [EMAIL PROTECTED] wrote: Hi, since I added a constraint for the length with minlength, I have the following errror : 28-nov.-2006 21:31:33 org.apache.struts.validator.DynaValidatorForm validate GRAVE: org.apache.struts.util.StrutsValidator org.apache.commons.validator.ValidatorException: org.apache.struts.util.StrutsValidator at org.apache.commons.validator.ValidatorAction.loadValidationClass( ValidatorAction.java:623) at org.apache.commons.validator.ValidatorAction.executeValidationMethod( The method signature in your validation class (i.e. StrutsValidator) doesn't match up with what you have defined in the methodParams element for your minlength validator. I have the following code : [...] validator name=minlength classname=org.apache.struts.util.StrutsValidator method=validateMinLength methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest depends=required msg=errors.minlength/ [...] form name=loginForm field property=login depends=required,minlength arg key=required.login/ arg name=minlength key=${var:minlength} resource=false/ var var-nameminlength/var-name var-value2/var-value /var /field [...] Also can u tell me what ${var:minlength} will display ? It will use the value in the minlength var element (which is 2 in your case) as the second argument for your minlength message - what it will display will depend on the message you've set up in the resource bundle for the minlength message (key errors.minlength in your case). Niall I need to display a message in French. Thank u for any help ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Are There Struts 2 Books?
Are there books available on Struts 2? or any newer versions of Struts? Thanks for the information in advance. Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Are There Struts 2 Books?
From: Caroline Jen [mailto:[EMAIL PROTECTED] Are there books available on Struts 2? WebWork in Action Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Are There Struts 2 Books?
On 11/30/06, Caroline Jen [EMAIL PROTECTED] wrote: Are there books available on Struts 2? or any newer versions of Struts? The WebWork in Action book is the only thing I'm aware of at the moment. For Struts 1, a second edition of James Holmes' Struts, The Complete Reference will be out soon. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] 1130 nightly java 1.4 FilterDispatcher startup error
Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher. java.lang.NoSuchMethodError: java.lang.ThreadLocal.remove()V I used the nightly core/api run through retro. I'm guessing I have some funky versioning going on. Also, should I be using the xwork beta or snapshot? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Retrieving DynaValidatorForm values with JSTL
Hi all, I have a form stored within the session and am trying to dump some of the Form values in the presentation using JSTL. Specifically something like Country : c:out value=${sessionScope.SubscriptionProcessForm.country}/ The form's name is SubscriptionProcessForm and the value to be retrieved from the form is country. Obviously I'm looking to retrieve the value without a scriptlet. Is there a way? Ed
Re: Retrieving DynaValidatorForm values with JSTL
On 11/30/06, Edward Song [EMAIL PROTECTED] wrote: I have a form stored within the session and am trying to dump some of the Form values in the presentation using JSTL. Specifically something like Country : c:out value=${sessionScope.SubscriptionProcessForm.country}/ See 4.3.1 on http://struts.apache.org/1.x/userGuide/building_controller.html -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Retrieving DynaValidatorForm values with JSTL
Thank you Wendy For all, In JSP pages using the Struts Taglib, attributes of DynaActionForm objects can be referenced just like ordinary ActionForm objects. Wherever a Struts tag refers to a property, the tags will automatically use the DynaActionForm properties just like those of a conventional JavaBean. So the code becomes bean:write scope=session name=SubscriptionProcessForm property=country/ Thanks again. Ed -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 2:35 PM To: Struts Users Mailing List Subject: Re: Retrieving DynaValidatorForm values with JSTL On 11/30/06, Edward Song [EMAIL PROTECTED] wrote: I have a form stored within the session and am trying to dump some of the Form values in the presentation using JSTL. Specifically something like Country : c:out value=${sessionScope.SubscriptionProcessForm.country}/ See 4.3.1 on http://struts.apache.org/1.x/userGuide/building_controller.html -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieving DynaValidatorForm values with JSTL
On 11/30/06, Edward Song [EMAIL PROTECTED] wrote: In JSP pages using the Struts Taglib, attributes of DynaActionForm objects can be referenced just like ordinary ActionForm objects. Wherever a Struts tag refers to a property, the tags will automatically use the DynaActionForm properties just like those of a conventional JavaBean. So the code becomes bean:write scope=session name=SubscriptionProcessForm property=country/ No... if you're using JSTL, don't go back to bean:write. I meant this part: The DynaActionForm properties must be accessed through a slightly different syntax. The JSTL EL syntax for referencing a property of an ActionForm goes like this: ${formbean.prop} The syntax for referencing a property of a DynaActionForm would be: ${dynabean.map.prop} -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Retrieving DynaValidatorForm values with JSTL
Wendy you're right! c:out value=${SubscriptionProcessForm.map.country}/ Thanks. -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 2:51 PM To: Struts Users Mailing List Subject: Re: Retrieving DynaValidatorForm values with JSTL On 11/30/06, Edward Song [EMAIL PROTECTED] wrote: In JSP pages using the Struts Taglib, attributes of DynaActionForm objects can be referenced just like ordinary ActionForm objects. Wherever a Struts tag refers to a property, the tags will automatically use the DynaActionForm properties just like those of a conventional JavaBean. So the code becomes bean:write scope=session name=SubscriptionProcessForm property=country/ No... if you're using JSTL, don't go back to bean:write. I meant this part: The DynaActionForm properties must be accessed through a slightly different syntax. The JSTL EL syntax for referencing a property of an ActionForm goes like this: ${formbean.prop} The syntax for referencing a property of a DynaActionForm would be: ${dynabean.map.prop} -- Wendy - 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]
Struts 2 - sample appl
Hi, I'm new to struts 2 and I face few problems. I need a link where I can download a simple example application with a form and few form's valdation actions/jsp etc thank you Walid -- View this message in context: http://www.nabble.com/Struts-2---sample-appl-tf2733969.html#a7626825 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2 and passing data using interceptors
Hi. I'm new to Struts and have a question regarding how data is passed from an Action (in Struts 2) to the JSP which one is redirected to after the action is executed. Reading the documentation on Struts 2, I've found that using the Scope Interceptor one can specify Action properties to be bound to the session or application scope. This is configured in struts.xml with the interceptor-ref name=scope tag and then setting the appropriate parameters. See http://www.twdata.org/backups/WW/scope-interceptor.html Now, say I access an EJB from an Action. The method of the EJB returns some data. Is it good programming practice (in Struts) to store this data in the session object, later to be accessed from a JSP? This should allow me to pass the data, but perhaps there is some other alternative which is preferred. Storing information in the session object would maybe be good practice for data such as user id, contents of a shopping cart, etc. The scope I believe I am interested in is request scope, since the data returned from the invoked EJB method is data from an Amazon.com search, only to be used in the JSP displayed immediately after the execution of the Action. Would the preferred method in my case then be to implement the ServletRequestAware interface in the Action and store data of interest in the request object? I can't find any interceptor that does this. I'm sure one can create user defined interceptors, but if there's a standard method for this functionality provided by the framework, then I guess that would be the preferred way to go. I'm grateful for any input on the matter. Cheers. -- View this message in context: http://www.nabble.com/Struts-2-and-passing-data-using-interceptors-tf2734105.html#a7627298 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get a dynaform in the Action class ?
Hi, I have the following DynaValidatorForm : form-bean name=loginForm type= org.apache.struts.validator.DynaValidatorForm form-property name=login type=java.lang.String / form-property name=password type=java.lang.String / /form-bean action path=/Login type=controllers.submits.LoginAction name=loginForm input=/Error.do validate=true scope=request forward name=setup_page path=/Setup.do?method=setupPage/ /action How am I supposed to get the parameters of this Form bean in the Action class ? public class LoginAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ??? myForm = ( ??? ) form; String username = myForm.getLogin(); [...] Thank u for any help.
Re: How to get a dynaform in the Action class ?
On 11/30/06, Thomas Thomas [EMAIL PROTECTED] wrote: I have the following DynaValidatorForm : .. How am I supposed to get the parameters of this Form bean in the Action class ? Section 4.3.1 is popular today. :) http://struts.apache.org/1.x/userGuide/building_controller.html DynaActionForms are not a drop-in replacement for ActionForms. If you need to access DynaActionForm properties in your Action, you will need to use the map-style accessor, like myForm.get(name). -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get a dynaform in the Action class ?
Wendy, thank u for your support. I don't know if I need to choose an ActionForm or DynaActionForm for the login page. When do u choose to make it a DynaActionForm ? What's the advantage of it.
struts 2 newbie question
Hello, I'm working through the official struts 2 tutorial (http://struts.apache.org/2.x/docs/validating-input.html ...) and I don't understand this stuff : in struts.xml action name=Login_* method={1} class=tutorial.Login the tutorial says : The method={1} attribute is replaced with method=input. Why ? Can someone explain me why it is replaced by this particular method, and give me another simple example if possible. thanks Walid -- View this message in context: http://www.nabble.com/struts-2-newbie-question-tf2734508.html#a7628558 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Are There Struts 2 Books?
On 11/30/06, Wendy Smoak [EMAIL PROTECTED] wrote: On 11/30/06, Caroline Jen [EMAIL PROTECTED] wrote: Are there books available on Struts 2? or any newer versions of Struts? The WebWork in Action book is the only thing I'm aware of at the moment. For Struts 1, a second edition of James Holmes' Struts, The Complete Reference will be out soon. Do you know which version of classic will that cover? I was wondering if there are any good resources for Struts 1.3.x? I'm still mentally back at 1.1 and was looking at ways to easily move up to the latest version. (In some ways this is a complement to the Struts team, as version 1.1 has always been very solid and reliable for me in production usage. :-) Simon -- simonpeter.org | simonpeter.com | techbook.info - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Are There Struts 2 Books?
On 11/30/06, Simon Chappell [EMAIL PROTECTED] wrote: For Struts 1, a second edition of James Holmes' Struts, The Complete Reference will be out soon. Do you know which version of classic will that cover? It's up to date for Struts 1.3.5. http://www.amazon.com/Struts-Complete-Reference-2nd/dp/0072263865 -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts, AJAX, JSP, and JavaScript question
Hi Adam- Could you post your JSP? in particular could we see XMLHttpRequest.OnReadyStateChange AND the javascript function which is the receptor for the Asynchronous call Thanks, M This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Adam Gordon [EMAIL PROTECTED] To: user@struts.apache.org Sent: Tuesday, November 28, 2006 3:43 PM Subject: Struts, AJAX, JSP, and JavaScript question I have a JSP and there's a link in the rendered page that makes an AJAX call (to a Struts action) when clicked. The results of that action, and the contents of the response are set as the innerHTML on a hidden div defined inside the afore mentioned rendered page. The div is then un-hid. Everything is working correctly except for one part: When the div is displayed, the JavaScript code in the contents returned by the AJAX call isn't being executed and thus, the contents of the div aren't set up correctly. Does anyone know a way to have the JavaScript be executed? Or force the browser to execute it? I used to have an iframe and everything worked great, but there was a bad side effect with session timeouts and so we've decided to not use them. Any help would be appreciated. Thanks. -Adam
Re: Struts 2 and passing data using interceptors
If you only need request-scoped data, you don't need to bother with the ScopeInterceptor or even the ServletRequestAware interface. Simply define a getter on your action that returns the object in question, then access it via your JSP via JSP EL (JSP 2.0), a JSTL expression, or a Struts 2 property tag. Don On 11/30/06, fahlen [EMAIL PROTECTED] wrote: Hi. I'm new to Struts and have a question regarding how data is passed from an Action (in Struts 2) to the JSP which one is redirected to after the action is executed. Reading the documentation on Struts 2, I've found that using the Scope Interceptor one can specify Action properties to be bound to the session or application scope. This is configured in struts.xml with the interceptor-ref name=scope tag and then setting the appropriate parameters. See http://www.twdata.org/backups/WW/scope-interceptor.html Now, say I access an EJB from an Action. The method of the EJB returns some data. Is it good programming practice (in Struts) to store this data in the session object, later to be accessed from a JSP? This should allow me to pass the data, but perhaps there is some other alternative which is preferred. Storing information in the session object would maybe be good practice for data such as user id, contents of a shopping cart, etc. The scope I believe I am interested in is request scope, since the data returned from the invoked EJB method is data from an Amazon.com search, only to be used in the JSP displayed immediately after the execution of the Action. Would the preferred method in my case then be to implement the ServletRequestAware interface in the Action and store data of interest in the request object? I can't find any interceptor that does this. I'm sure one can create user defined interceptors, but if there's a standard method for this functionality provided by the framework, then I guess that would be the preferred way to go. I'm grateful for any input on the matter. Cheers. -- View this message in context: http://www.nabble.com/Struts-2-and-passing-data-using-interceptors-tf2734105.html#a7627298 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 - sample appl
Download the example apps from the Struts download site: http://struts.apache.org/download.cgi#struts201 Don On 11/30/06, walidito [EMAIL PROTECTED] wrote: Hi, I'm new to struts 2 and I face few problems. I need a link where I can download a simple example application with a form and few form's valdation actions/jsp etc thank you Walid -- View this message in context: http://www.nabble.com/Struts-2---sample-appl-tf2733969.html#a7626825 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Does Struts 2 solve the action chaining problem?
On 11/28/06, Tarek Nabil [EMAIL PROTECTED] wrote: Hi, One of the problems with Struts was that if you had a page that requires some setup and this page submits to an Action, then you would not be able to set validate to true on that action because if validation problems occur then Struts will take you directly to the input JSP without performing the setup and your JSP wouldn't work. A solution to that would be to specify the input of the action as the setup action, which means you're doing action chaining and Struts is not good at that (it will reset your form among other things). The solution of choice for us so far was to call validate() ourselves in the action and if a validation problem occurs then we call the setup method (eventually you start using your action methods as an API which still was not good). Another problematic scenario is the case when you're editing some database record for example. When you go to your setup action for the first time, you will populate drop down lists for example, and then load the existing values from the database to your JSP fields. If the user attempts to save and some problem occurs then in the setup action, you will need to again populate the drop down lists, but you will NOT want to overwrite the user's inputs with the existing data. This is very similar to the first problem, but you would also need to pass some flag to the setup method to tell it whether to copy the data from the database to your ActionForm. Struts 1.x works perfectly well in the above scenarios. You may want to check out the overview of Struts action usage in Struts wiki [1]. You can have one action handling both setup and input or you can have two separate classes. Also, you can have two different action forms or one action form. Struts populates an action form automatically, which seems like too much automation to me, but this cannot be changed now to ensure backwards compatibility. The specifics of handling form bean repopulation depend on chaining approach. If you use in-server forwarding, then you will have to place a token into the request object in the first action, and check this token in the target action (actually, you will probably be checking this flag in the form bean). If flag is there, this means that the action was chained by forwarding, and you have to prohibit updating a form bean. You can do this by putting an if into each and every setter of the form bean. Quite clunky. If you use a different action form for a chained action, you may want to define getters only, or to have setter methods that do not correlate with URL parameters. If you use redirection through browser, then just do not append any parameters to the target URL, this way a redirected request will be clean of parameters and Struts will not populate a form bean, because it has nothing to populate with. What is more, you can use one session-scoped form bean for both actions, it already has been set up, so you don't it to reinitialize it. [1] http://wiki.apache.org/struts/StrutsManualActionClasses - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Does Struts 2 solve the action chaining problem?
On 11/29/06, Yujun Liang [EMAIL PROTECTED] wrote: To solve the action chaining problem, I wrote a subclass of RequestProcessor. In the subclass, override some templates method. In the last method of process(), I set a flag in request, and I check for this flag in some methods and if the flag is there, it means it is the chained action and the processor will skip those template methods. This is an approach that I've been using for quite a while, before I switched to redirection. I think this feature can be included into future releases of Struts 1.x. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Does Struts 2 solve the action chaining problem?
If not this specific implementation, an otherwise clean way to handle view preprocessing after a validation failure. It can build on the action-forward-specific command chain, but a solution that's more tightly integrated with action objects should be considered as well. Hubert On 11/30/06, Michael Jouravlev [EMAIL PROTECTED] wrote: On 11/29/06, Yujun Liang [EMAIL PROTECTED] wrote: To solve the action chaining problem, I wrote a subclass of RequestProcessor. In the subclass, override some templates method. In the last method of process(), I set a flag in request, and I check for this flag in some methods and if the flag is there, it means it is the chained action and the processor will skip those template methods. This is an approach that I've been using for quite a while, before I switched to redirection. I think this feature can be included into future releases of Struts 1.x. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Does Struts 2 solve the action chaining problem?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tarek, Tarek Nabil wrote: Christopher, I really wonder if the Struts you're talking about is the one I've using for years now!! The Struts I know sucks big time when it comes to action chaining. I'm afraid I don't understand how defining two mappings, one with validation turned on and the other turned off, solves the first problem! As for the second problem, your solution still involves action chaining which should be avoided unless you've done something equivalent to what Yujun did. I suppose I've never tried to modify the state of the request (or form bean) such that re-interpreting it across action invocations is relevant. I typically get information out of a form bean ASAP and then use that for some other operation (most often database interaction). Then I discard the form bean. If I have to re-read the form bean, it's in the same state in which I left it. I guess if you store a lot of state information in your form beans, and you mutate that information in your actions, you might end up fighting against Struts. As it is for me, forwarding from one action to another (that both use the same form bean) results in no problems except a slight performance hit for re-populating the bean and validating it when entering the second action. I never use beans that contain anything but Strings, so no conversion ever needs to take place. It looks like my mode of use has resulted in me never realizing what a PITA it might be when attempting to chain actions in this way. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFb2by9CaO5/Lv0PARAtveAJ9AyWu4w0x7CUOuRvxXDjoKcVKbxwCfXCvc licIhQWz58NCiqrqaR8XwO8= =cSgU -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 2 newbie question
On 11/30/06 4:40 PM, walidito [EMAIL PROTECTED] wrote: Quick caveat, I haven't used the methodology, but I might start now. and I don't understand this stuff : in struts.xml action name=Login_* method={1} class=tutorial.Login the tutorial says : The method={1} attribute is replaced with method=input. Why ? Can someone explain me why it is replaced by this particular method, and give me another simple example if possible. Right above that notice that the s:url tag changed from: s:url action=Login/ To: s:url action=Login_input/ I think that this taken together with the action mapping: action name=Login_* method={1} class=tutorial.Login Will result in the input being stripped off the end of Login_input and being put into {1}. I think that's what the Login_* basically says in the action mapping, Login_ is the base, and everything that matches * becomes {1}. That's pretty slick. I didn't know about this. I think I might start using it. Take care, Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and passing data using interceptors
On 11/30/06 5:29 PM, Don Brown [EMAIL PROTECTED] wrote: If you only need request-scoped data, you don't need to bother with the ScopeInterceptor or even the ServletRequestAware interface. Simply define a getter on your action that returns the object in question, then access it via your JSP via JSP EL (JSP 2.0), a JSTL expression, or a Struts 2 property tag. To expand on Don's answer. (I know he's busy. Thanks Don.) Let's say you have the following Action (this is not a complete listing): public class MyAction extends ActionSupport { private String dataRetrievedFromSessionBean; public String execute () throws Exception { MySessionBean sb = getSessionBean (); this.dataRetrievedFromSessionBean = sb.getMyData (); return SUCCESS; } public String getDataRetrievedFromSessionBean () { return this.dataRetrievedFromSessionBean; } private MySessionBean getSessionBean () { // Some code to get your EJB. } } In your JSP you can display this data with the s:property tag: s:property value=%{dataRetrievedFromSessionBean} / That's it. You don't need to mess with Session scope, other interceptors, or any of that stuff. It's very simple and elegant. Almost too much so. It eluded me for a while, but now I'm really starting to get it, and it's good. Mark -- Mark Menard personal: http://www.vitarara.org/ business: http://www.vitarara.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and passing data using interceptors
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, Mark Menard wrote: public String getDataRetrievedFromSessionBean () { return this.dataRetrievedFromSessionBean; } Sorry for poking my nose in, but wouldn't this be horrendously non-threadsafe? Since I know virtually nothing about S2, I may be completely missing something like action instances now live in the session or something crazy like that. Instead of using a method on the action, why not stuff the object into the request? request.setAttribute(dataRetrievedFromSessionBean, this.getSessionBean()); Sorry if I don't know what I'm talking about. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFb3sN9CaO5/Lv0PARAqmjAJ43fvmsWmR0VNEauKXZOjH8f+GORgCcCl/B 2HGBwx4xh0OCNwY8QRFmjaU= =u3oN -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and passing data using interceptors
What makes it not thread safe? If you are thinking in terms of s1, then yes, but s2 actions are not reused and can therefore keep state as you normally would have had to put in a s1 formbean. On 11/30/06, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, Mark Menard wrote: public String getDataRetrievedFromSessionBean () { return this.dataRetrievedFromSessionBean; } Sorry for poking my nose in, but wouldn't this be horrendously non-threadsafe? Since I know virtually nothing about S2, I may be completely missing something like action instances now live in the session or something crazy like that. Instead of using a method on the action, why not stuff the object into the request? request.setAttribute(dataRetrievedFromSessionBean, this.getSessionBean()); Sorry if I don't know what I'm talking about. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFb3sN9CaO5/Lv0PARAqmjAJ43fvmsWmR0VNEauKXZOjH8f+GORgCcCl/B 2HGBwx4xh0OCNwY8QRFmjaU= =u3oN -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Mitchell 678.910.8017
Re: Struts 2 and passing data using interceptors
On 11/30/06 7:45 PM, Christopher Schultz [EMAIL PROTECTED] wrote: Mark Menard wrote: public String getDataRetrievedFromSessionBean () { return this.dataRetrievedFromSessionBean; } Sorry for poking my nose in, but wouldn't this be horrendously non-threadsafe? No problem. If your thinking of Actions from the perspective of S1, yes, this would be horribly non-thread safe. In S2 an action instance is created for each request. They are not singletons. So, this is fine. Since I know virtually nothing about S2, I may be completely missing something like action instances now live in the session or something crazy like that. They don't live in the session. In a sense they live in the request scope. I say that because the Action itself also takes on the role formerly done by the ActionForm in S1. It's just a JavaBean with setters and getters that is used to store the information you're interested in, the stuff submitted to you and what you want to present in your view. In S2 if you have an accessor for let's say firstName (i.e. getFirstName() and setFirstName() ) on your Action class, and you have a firstName input in your HTML form, S2 will call setFirstName() on your action with the submitted value. This gives you access to the parameters submitted by your user. It's really quite simple and elegant. You can also use any JavaBean you'd like as your form in S2 if you want. (cf: http://cwiki.apache.org/WW/model-driven-interceptor.html) Likewise anything that you want to display in your view would also be a property of your Action. Just get the data in your execute() method and make it available via a getter and you can display it via your view. Mark -- Mark Menard personal: http://www.vitarara.org/ business: http://www.vitarara.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in formbean
Hi Prem, At the time of landing the page, you are showing some values. That values are taken from DB. Once error coming you are redirecting to the same page. but with the error value. This is your problem right? this can be easily solved. you are showing the values taken from formbean. At the time of error, the new value (error value) would be stored in the formbean. so that error value has been shown to you. show the value from DB. your problem will be solved. sorry for my english prkumar_1234 [EMAIL PROTECTED] wrote: I got some problem in struts can you please help me. 1) in jsp iam displaying values from javabean in textboxes.(i can change these values) 2) when i submit with modified values , iam doing validation in formbean. 3) When validatio fails i formbean returning to same jsp but it is displaying old values not modified values can you give me some hint how to do this. thank you verymuch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] BY Thamizharasu S - Everyone is raving about the all-new Yahoo! Mail beta.
Re: How to set %@ page session=false %, globally?
Thanks for the tip. I do that but I still get jsessionid's in the URL: WEB-INF/tiles-defs.xml tiles-definitions definition name=.site path=/jsp/common/layouts/mainLayout.jsp ... jsp/common/layouts/mainLayout.jsp: !-- DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; -- %@ page session=false % %@ taglib uri=struts-bean prefix=bean % I can't seem to reproduce the sessionid's in a browser, but the search robots have a way of triggering it. They load the same pages hundreds of times, presumably thinking each is a unique URL: 193.47.80.51 - - [28/Nov/2006:16:05:36 -0800] GET /awards.do;jsessionid=68B86DFF8E4A8597B210531C3431965D HTTP/1.1 200 17195 - Exabot/3.0 193.47.80.51 - - [28/Nov/2006:16:17:30 -0800] GET /awards.do;jsessionid=0621414681C92E1A00A9428A7800AC30 HTTP/1.1 200 17195 - Exabot/3.0 193.47.80.51 - - [28/Nov/2006:17:00:36 -0800] GET /awards.do;jsessionid=0079FCD91ED8E5B86902228D285CCEEF HTTP/1.1 200 17195 - Exabot/3.0 193.47.80.51 - - [28/Nov/2006:20:41:50 -0800] GET /awards.do;jsessionid=DE9B61384D3D75DE9EB38A21F066E433 HTTP/1.1 200 17195 - Exabot/3.0 193.47.80.51 - - [28/Nov/2006:21:25:06 -0800] GET /awards.do;jsessionid=452B2A8E9798E58B89A61FA11E4F2EF6 HTTP/1.1 200 17195 - Exabot/3.0 193.47.80.51 - - [28/Nov/2006:23:55:55 -0800] GET /awards.do;jsessionid=051ED83F9A0970854DB4DDF315EB45F0 HTTP/1.1 200 17195 - Exabot/3.0 Use tiles and place it in your default layout. (*Chris*) On 10/31/06, Bryce Nesbitt [EMAIL PROTECTED] wrote: I'm having trouble with Google and Alexa indexing pages on my site hundreds of times, each with a different colon separated session ID. I was able to reduce this by adding: %@ page session=false % To the top of all my template pages. But the subpages still generate session ID's. How can I make %@ page session=false % global, or get it to cascade to the content part of my pages? Bryce Nesbitt http://www.citycarshare.org/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: s2 image submit button and methods
Thanks for bringing this up. I created a ticket and have fixed the issue: http://issues.apache.org/struts/browse/WW-1532 The problem is complicated by the fact that IE doesn't submit the button name in addition to the .x and .y. All cases should be properly handled now. Don On 11/28/06, Ing. Andrea Vettori [EMAIL PROTECTED] wrote: Hi, yesterday it took me a day to understand and resolve a problem so I think it can be useful to share it; maybe someone can explain a better solution. I have a form with more than one submit button. The submit buttons are images so I used the s:submit type=image method= ... tag on all but the default button. The problem is that since the image button is considered by the browser similar to an imagemap, if the button is called btnA, the browser submits btnA, btnA.x and btnA.y request parameters, where the .x and .y are the coordinates of the click inside the image. I think this cannot be disabled on the browser since it is required by the HTML specifications. Now this cause problems when the parameters are used by the action to call the appropriate method. If I have a button like s:form action=anAction ... s:submit type=image method=aMethod ... in the HTML you get something like input type=image name=method:aMethod ... and when the request is submitted the browser sends method:aMethod, method:aMethod.x and method:aMethod.y parameters. This cause the framework to try to execute the aMethod.x() method on the action class which generate an Exception !!! I've tried to filter the parameters with ParameterNameAware but the parameter that starts with method: are not passed to the acceptableParameter method. So I extended the parameters interceptor and overrided the acceptableParameter function and even if now I see the parameters on the method, even if I reject them, the framework use them to try to execute the method in the action. The solution I used is to have the image submit to set a value (like s:submit type=image name=aName value=aValue and use that value inside the execute method of the action to call the appropriate method. But I'm looking for a better solution. I also think that since this will be a common problem, it should be addressed by the framework automatically rejecting method:xxx and action:xxx parameters that ends with a .x and .y. Thanks -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: STRUTS2 and AJAX
On 11/20/06, Juan Espinosa [EMAIL PROTECTED] wrote: I dont understand when you say in the latest trunk, (i have to improve my english) did it mean in the next version. Yes, the next version will be 2.0.2 Plugins - i have a question ! sitemesh has a plugin like spring ?? Yes. Don Thanks for your answers... Regards, Juan Espinosa -Mensaje original- De: Don Brown [mailto:[EMAIL PROTECTED] Enviado el: Lunes, 20 de Noviembre de 2006 02:05 p.m. Para: Struts Users Mailing List Asunto: Re: STRUTS2 and AJAX On 11/20/06, Juan Espinosa [EMAIL PROTECTED] wrote: Hi to all i have two questions... First question... is possible to remove spring dependecies in struts2 or spring stuff (jars, applicationContext.xml and ContextLoadListener) are neccesary to run struts2 Spring is 100% optional. In fact, in the latest code in trunk, the Spring stuff has its own plugin jar, which can be easily excluded. Second question or advise... i want to give a try to ajax, i want some parts of me site to be updated without reloading the whole page, for example. I need some advise where to start, struts2 ajax support, etc... The easiest way is to download the showcase example application and play with the ajax examples. Note, however, not all are guaranteed to work right now as they are receiving a lot of attention (Dojo 0.4 upgrade) Don well thats all, thanks for helping me. Regards, Juan Espinosa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.14.10/541 - Release Date: 20/11/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] Ajax template tutorial?
Not at the moment. Take a look at the showcase example application, which demonstrates all the ajax tags. Don On 11/16/06, wolverine my [EMAIL PROTECTED] wrote: Hi! Any idea if there is any good Struts 2's Ajax tutorial that is similar to the Bootstrap step-by-step tutorial? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Libraries problems
If you are using 2.0.1 or later, you need to include the struts2-sitemesh plugin. Don On 10/31/06, Mariano Stampella [EMAIL PROTECTED] wrote: Hi, I am using actually this libraries: !-- Struts 2 -- dependency groupIdorg.apache.struts/groupId artifactIdstruts2-core/artifactId version2.0.2-SNAPSHOT/version /dependency dependency groupIdorg.apache.struts/groupId artifactIdstruts2-extras/artifactId version2.0-SNAPSHOT/version /dependency !-- XWork -- dependency groupIdopensymphony/groupId artifactIdxwork/artifactId version2.0-SNAPSHOT/version /dependency !-- Freemarker -- dependency groupIdfreemarker/groupId artifactIdfreemarker/artifactId version2.3.4/version /dependency !-- SiteMesh -- dependency groupIdopensymphony/groupId artifactIdsitemesh/artifactId version2.2.1/version /dependency And when tomcat startup, found this problem: GRAVE: Excepción arrancando filtro sitemesh *java.lang.ClassNotFoundException*: org.apache.struts2 .sitemesh.FreeMarkerPageFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(* WebappClassLoader.java:1355*) at org.apache.catalina.loader.WebappClassLoader.loadClass(* WebappClassLoader.java:1201*) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(* ApplicationFilterConfig.java:209*) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(* ApplicationFilterConfig.java:304*) at org.apache.catalina.core.ApplicationFilterConfig.init(* ApplicationFilterConfig.java:77*) at org.apache.catalina.core.StandardContext.filterStart(* StandardContext.java:3634*) at org.apache.catalina.core.StandardContext.start(* StandardContext.java:4217*) at org.apache.catalina.core.ContainerBase.start(*ContainerBase.java :1013*) at org.apache.catalina.core.StandardHost.start(*StandardHost.java :718*) at org.apache.catalina.core.ContainerBase.start(*ContainerBase.java :1013*) at org.apache.catalina.core.StandardEngine.start(* StandardEngine.java:442*) at org.apache.catalina.core.StandardService.start(* StandardService.java:450*) at org.apache.catalina.core.StandardServer.start(* StandardServer.java:709*) at org.apache.catalina.startup.Catalina.start(*Catalina.java:551*) at sun.reflect.NativeMethodAccessorImpl.invoke0(*Native Method*) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(*Bootstrap.java:294*) at org.apache.catalina.startup.Bootstrap.main(*Bootstrap.java:432*) 31/10/2006 17:17:56 org.apache.struts2.spring.StrutsSpringObjectFactory init INFO: Initializing Struts-Spring integration... 31/10/2006 17:17:56 com.opensymphony.xwork2.spring.SpringObjectFactorysetAutowireStrategy INFO: Setting autowire strategy to name 31/10/2006 17:17:56 org.apache.struts2.spring.StrutsSpringObjectFactory init INFO: ... initialized Struts-Spring integration successfully 31/10/2006 17:17:56 org.apache.catalina.core.StandardContext start GRAVE: Error filterStart 31/10/2006 17:17:56 org.apache.catalina.core.StandardContext start GRAVE: Falló en arranque del Contexto [/example] debido a errores previos *Mariano Stampella [EMAIL PROTECTED] *www.fdvsolutions.com* Billinghurst 1712, 8vo D (CP1425) :: Buenos Aires, Argentina :: (54-11) 4826-9464
Re: [s2] Error setting 'dojo.transport'
Well, you should only see that error when your logs have debug enabled. You could clean it out via an interceptor, if you really wanted to. Don On 11/7/06, Oleg Galkin [EMAIL PROTECTED] wrote: When I use the div ajax tag the exception Error setting expr 'dojo.transport' with value '...' ognl.OgnlException: target is null for setProperty(null, transport, ...) is thrown. The showcase example application throws the same exception. Anyway, the tag works. The resulting query string for the div href action indeed includes 'dojo.transport=xmlhttp' parameter. Does dojo toolkit add it? If so is it possible to ignore it in Parameters interceptor? Thanks, Oleg _ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ - 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]