Re: Using html:select tag
Hey Anjib, 1 - Check out the tablib docco ( http://struts.apache.org/2.x/docs/select.html). For example with html:select you could use listKey and listValue. Should be something similar for html:options. I always use html:select though as much less code for what I need. 2 - Have your action implement Preparable. Then in the prepare method you load the agency names. Hope that helps. Carl. On Thu, Sep 22, 2011 at 6:49 PM, Anjib Mulepati anji...@hotmail.com wrote: Hi All, I have two question 1. regarding understanding html:option, html:options and html:optionsCollection and 2. reloding option items after form validation fail. I have agency bean with (ID, Name). I create list of agency as agencyList. I have login page which have select/option box and it get value from the DB. So my action class set that list in session variable session.setAttribute(**agencyList, agencyList); Login form itself have three attributes and getter/setter with validation method private String agencyName; private String userName; private String password; In JSP I am trying to use that list as follow html:select title=Agency styleId=agencyName property=agencyName tabindex=1 logic:iterate id=agency name=agencyList html:option value=agencyId bean:write name=agency property=agencyName//html:**option /logic:iterate /html:select This shows me the list but value is always agencyId. Is there any easy way so that I can read both 'id' and 'name' from bean and put in option tag 'ID' as 'value' and 'name' as 'label'. Couldn't fig out which one to use html:option, html:options and html:optionsCollection. Second problem is if my validation fail in this login page. I get blank page due to null agencyList. So I am trying to fig out how to populate the agencyList again after form validation fail. Thanks --**--**- To unsubscribe, e-mail: user-unsubscribe@struts.**apache.orguser-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Bug? Further problems with @ConversionErrorFieldValidator in nested @VisitorFieldVisitor
In addition to the problem noted in http://struts.1045723.n5.nabble.com/Problem-with-ConversionErrorFieldValidator-td4829326.html (which incidentally has also turned up at http://stackoverflow.com/questions/7514301/how-to-control-conversion-error-with-struts2 ) I've come across a further issue with the @ConversionErrorFieldValidator. In my main action I have; @VisitorFieldValidator public Customer getCustomer() { return customer; } and with in Customer I have validation annotations including @ConversionErrorFieldValidator. Customer also contains a reference to another Entity so within Customer I have @Entity public class Customer { @ConversionErrorFieldValidator(message=Member Id must be numeric) public void setMemberId(int memberId) { this.memberId = memberId; } @RequiredStringValidator(message=customer name is required) public void setCustomerName(String customerName) { this.customerName = customerName; } @VisitorFieldValidator public Address getAddress() { return address; } } and withing Address I have further validation annotations. @Entity public class Address() { @ConversionErrorFieldValidator(message=Area Code must be numeric) public void setAreaCode(int areaCode) { this.areaCode = areaCode; } @RequiredStringValidator(message=Customer Address Line 1 is required) public void setAddressLine1(String addressLine1) { this.addressLine1 = addressLine1; } Within Customer all of the validations work as expected although @ConversionErrorFieldValidator still gives me two messages as noted in my other post, which at least shows that it is being invoked. Within Address the @RequiredStringValidator works as expected but @ConversionErrorFieldValidator only gives me the Struts generated message which indicates that it is not being invoked when nesting @VisitorFieldVisitor annotations. Has anyone else come across this? Regards -- View this message in context: http://struts.1045723.n5.nabble.com/Bug-Further-problems-with-ConversionErrorFieldValidator-in-nested-VisitorFieldVisitor-tp4833364p4833364.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with @ConversionErrorFieldValidator
I've been taking a look at this and I think that the reason for the double message is that conversion errors are being handled twice, firstly by the StrutsConversionErrorInterceptor and again by the AnnotationValidationInterceptor. Both these interceptors are in the struts-default stack. Removing the StrutsConversionErrorInterceptor from the stack removes the Struts generated message and leaves the user defined message as the only error message displayed. Are there any other implications to removing the StrutsConversionErrorInterceptor from my interceptor stack? Regards -- View this message in context: http://struts.1045723.n5.nabble.com/Problem-with-ConversionErrorFieldValidator-tp4829326p4833549.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Share my Struts2 + displaytag note
Hello, To share struts2 + displaytag example: (1) Action1 to browse display all records - a.jsp (2) Button send-all in a.jsp (3) Click send-all If send-all action in Action1.java, displagtag next page will call send-all again So, send-all action should be put another Action Class. I paid for this pain :( My users get 7 mails because of this. Emi - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Adding session time out to ForwardAction [S1.3.8]
Hi, I am wondering is there any way we can add the session time out code for org.apache.struts.actions.ForwardAction. I am adding session time out code for every actions in Action Class. But some of my action are just Forward action so I am using ForwardAction for such action. Disadvantage for this is that i can't check session time for these action but I need to check that too. Is there any way to do this? Thanks, Anjib - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Adding session time out to ForwardAction [S1.3.8]
Override the request processor. The RequestProcessor has a handleForward() method, I believe, which you could customize to include additional checking. On Fri, Sep 23, 2011 at 10:29 AM, Anjib Mulepati anji...@hotmail.com wrote: Hi, I am wondering is there any way we can add the session time out code for org.apache.struts.actions.ForwardAction. I am adding session time out code for every actions in Action Class. But some of my action are just Forward action so I am using ForwardAction for such action. Disadvantage for this is that i can't check session time for these action but I need to check that too. Is there any way to do this? Thanks, Anjib - 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