Re: In a merged iterator, know which iterator current item belongs
>> but now I need to know to which iterator the >> currently processed entry belongs to, since they >> have to be treated differently. > > Are the items of the same type? > > If so, I'm not sure what you can do. > In this case numbers is of type double[] and operators is of type String[]. Would be great if you could tell me how to check for the type. Actually I thought of another solution. If not using tags but JSP I would write: for(int i=0; i signature.asc Description: OpenPGP digital signature
How can i get servlet in my sessionDestroy() method?
DISCLAIMER: --- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect. ---
RE: servlet.getServletContext().getAttribute("userList") is throwing NullPointerException in my sessionDestroyed() method
The listener class is extending Action as well as implementing HttpSessionListener interface. Cant I have servlet in my sessionDestroy() method? -Original Message- From: Jeromy Evans [mailto:[EMAIL PROTECTED] Sent: Monday, June 11, 2007 10:42 AM To: Struts Users Mailing List Subject: Re: servlet.getServletContext().getAttribute("userList") is throwing NullPointerException in my sessionDestroyed() method > I am getting NullPointerException in this line Hashtable userList = (Hashtable) servlet.getServletContext().getAttribute("userList"); As suggested by others the last time you asked this question, first try to determine whether it's the the servlet, servletContext or HashTable that's null. HINT: Where did you get 'servlet' from in the sessionDestroyed() method? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: --- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet.getServletContext().getAttribute("userList") is throwing NullPointerException in my sessionDestroyed() method
> I am getting NullPointerException in this line Hashtable userList = (Hashtable) servlet.getServletContext().getAttribute("userList"); As suggested by others the last time you asked this question, first try to determine whether it's the the servlet, servletContext or HashTable that's null. HINT: Where did you get 'servlet' from in the sessionDestroyed() method? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Extending DynaValidatorForm
My code is as following... struts-config.xml -Original Message- From: David Durham, Jr. [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:46 AM To: Struts Users Mailing List Subject: Re: Extending DynaValidatorForm On 6/8/07, David Durham, Jr. <[EMAIL PROTECTED]> wrote: > On 6/8/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote: > > Please someone send me the sample code for extending DynaValidatorForm and > > implementing the reset method. I have no idea on how to do it. Please help. > > I'm using struts 1.2.9. > > Thank you, > > > HTML has the concept of a reset button: > >http://www.w3.org/TR/html401/interact/forms.html#reset-button > > ... Hmm, guess you were asking about extending DynaValidatorForm. I must have been thinking of some other question that was similar to this one. Anyway, a DynaValidatorForm is a DynaBean, so you can call set("propertyName", "reset Value") from your reset override method. These API versions aren't exact, but I don't think these classes have changed much: http://struts.apache.org/1.3.8/apidocs/org/apache/struts/validator/DynaValid atorForm.html http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api /org/apache/commons/beanutils/DynaBean.html - 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: Extending DynaValidatorForm
Thanks David, But I need sample code. Can u provide it? I got your logic but finding it difficult to implement. The main problem is how to get the property name at runtime. I have many forms that extend the DynaValidatorForm. Thank you, AM -Original Message- From: David Durham, Jr. [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:46 AM To: Struts Users Mailing List Subject: Re: Extending DynaValidatorForm On 6/8/07, David Durham, Jr. <[EMAIL PROTECTED]> wrote: > On 6/8/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote: > > Please someone send me the sample code for extending DynaValidatorForm and > > implementing the reset method. I have no idea on how to do it. Please help. > > I'm using struts 1.2.9. > > Thank you, > > > HTML has the concept of a reset button: > >http://www.w3.org/TR/html401/interact/forms.html#reset-button > > ... Hmm, guess you were asking about extending DynaValidatorForm. I must have been thinking of some other question that was similar to this one. Anyway, a DynaValidatorForm is a DynaBean, so you can call set("propertyName", "reset Value") from your reset override method. These API versions aren't exact, but I don't think these classes have changed much: http://struts.apache.org/1.3.8/apidocs/org/apache/struts/validator/DynaValid atorForm.html http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api /org/apache/commons/beanutils/DynaBean.html - 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]
servlet.getServletContext().getAttribute("userList") is throwing NullPointerException in my sessionDestroyed() method
Hi team, In my login action I am adding the user who logged in into hash table and I am putting that hash table in servlet.getServletContext().setAttribute("") as fallows Hashtable userList = new Hashtable(); userList.put("username",username); servlet.getServletContext().setAttribute("userList",userList); and in my sessionDestroy() method I am removing that user from the context when his session expires as fallows HttpSession session = sessionEvent.getSession(); String user = (String) session.getAttribute("username"); System.out.print(" USER "+user); session.removeAttribute("ServiceNo"); Hashtable userList = (Hashtable) servlet.getServletContext().getAttribute("userList"); userList.remove(user); I am getting NullPointerException in this line Hashtable userList = (Hashtable) servlet.getServletContext().getAttribute("userList"); But I am sure the list in not null; Regards, Sreenivasula Reddy A DISCLAIMER: --- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect. ---
linking struts2 action to pre-existing pure Java servlet
Hi, I have a servlet which implements some logic based on some URL parameters passed to it. I can invoke this servlet directly from my browser, by simply supplying the parameters thru the URL. http://localhost:8080/myproject/myapplication?param1=value1¶m2=value2 However, I would like to set these parameters thru' the struts.xml ( using ) and thereafter link this servlet ( the servlet simply extends HttpServlet) to the struts action so that it is invoked the same manner as above. any clue on how I can do this. I can get the request parameter values in the action class but cannot fiure out how to pass this to the servlet. Should I simply call ServletActionContext.setRequest(name of the servlet object). Thanks for your help, I really appreciate any pointers!! -- View this message in context: http://www.nabble.com/linking-struts2-action-to-pre-existing-pure-Java-servlet-tf3899596.html#a11055023 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
I am unable to access servlet in my sessionDestroy() method?
DISCLAIMER: --- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect. ---
[S2] datetimepicker reset value to 00:00 when type="time" after submitting page
I have a datetimepicker in my JSP to let user select time: When user select 10:15 and submit to webserver, after the web page refreshes the value becomes 00:00. Is this another datetimepicker bug? I have a type converter for converting time the format string is "HH:mm": public class TimeConverter extends StrutsTypeConverter { private static Logger log = Logger.getLogger(TimeConverter.class); public Object convertFromString(Map context, String[] values, Class toClass) { log.debug("entering convertFromString() values[0]='" + values[0] + "'"); if (StringUtil.isEmpty(values[0])) { return null; } try { Date dt = TimeUtil.getGuiTimeFormat().parse(values[0]); Object rtn = new java.sql.Time(dt.getTime()); log.debug("rtn=" + rtn); return rtn; } catch (Exception e) { log.error(e, e); } return null; } public String convertToString(Map context, Object o) { log.debug("entering convertToString() o=" + o); String str = null; if ( o != null ) { str = TimeUtil.getGuiTimeFormat().format(o); log.debug("entering convertToString() str=" + str); } return str; } } But the debug log shows the time str is 10:15. Thanks!
Re: Parameter Mapping with Set elements
--- Nicolás Pace <[EMAIL PROTECTED]> wrote: > The point here is that Sets are not indexable, so i > can't name elements by their unique id... Let me rephrase: I don't know how you'd be able to use a Set directly on a web page simply because it's *not* indexable. My guess is that you'd have to massage between a collection of some sort and the set you want, but perhaps someone else has another suggestion. d. Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parameter Mapping with Set elements
--- Nicolás Pace <[EMAIL PROTECTED]> wrote: > The point here is that Sets are not indexable, so i > can't name elements by their unique id... Well, if there's nothing to uniquely identify them at all then you'd be doomed no matter what, wouldn't you? d. Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. http://new.toolbar.yahoo.com/toolbar/features/mail/index.php - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: In a merged iterator, know which iterator current item belongs
--- Anton Pussep <[EMAIL PROTECTED]> wrote: > but now I need to know to which iterator the > currently processed entry belongs to, since they > have to be treated differently. Are the items of the same type? If so, I'm not sure what you can do. d. 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parameter Mapping with Set elements
The point here is that Sets are not indexable, so i can't name elements by their unique id... On 6/10/07, Dave Newton <[EMAIL PROTECTED]> wrote: --- Nicolás Pace <[EMAIL PROTECTED]> wrote: > The main problem is that the only way to access > collection elements with ognl is like accessing an > array, and when i generate those dinamic components > with javascript, i don't know how to name those > elements to have them mapped to the Set. Name them whatever the name of them is in the action. For example, I have a JSP page that uses the following S2 tag for a text input field where exMap is (obviously, I guess) a map with its backing object's id as the map key: I dynamically create additional components with the following JavaScript, called from a method taking id, which, and idx parameters: var name = 'exMap[' + id + '].' + which + '[' + idx + '].foo'; var sTag = ''; This example is a little bit different because each of the map entries is an ordered list (and I formatted and edited heavily so it might be minorly broken), but you get the idea. d. Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 - 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]
In a merged iterator, know which iterator current item belongs
Hello, I want to successively call several iterators. This works perfectly fine with a merged iterator, but now I need to know to which iterator the currently processed entry belongs to, since they have to be treated differently. See the small example below that illustrates my intention. Currently I just check if the current entry is an odd number or not, but this does not work if numbers.length>operators.length+1 or even operators.length NUMBER OPERATOR Thanks, Anton signature.asc Description: OpenPGP digital signature
Re: Parameter Mapping with Set elements
--- Nicolás Pace <[EMAIL PROTECTED]> wrote: > The main problem is that the only way to access > collection elements with ognl is like accessing an > array, and when i generate those dinamic components > with javascript, i don't know how to name those > elements to have them mapped to the Set. Name them whatever the name of them is in the action. For example, I have a JSP page that uses the following S2 tag for a text input field where exMap is (obviously, I guess) a map with its backing object's id as the map key: I dynamically create additional components with the following JavaScript, called from a method taking id, which, and idx parameters: var name = 'exMap[' + id + '].' + which + '[' + idx + '].foo'; var sTag = ''; This example is a little bit different because each of the map entries is an ordered list (and I formatted and edited heavily so it might be minorly broken), but you get the idea. d. Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Parameter Mapping with Set elements
Hi!, I'm having a problem trying to map elements from a Set Collection in my Action to form components, and to generate form components dinamically and have them inserted in this set. Any suggestions? The main problem is that the only way to access collection elements with ognl is like accessing an array, and when i generate those dinamic components with javascript, i don't know how to name those elements to have them mapped to the Set. Thanks nicolas pace - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
sort entries by the selected tag
Hello, I would like to sort the menu created by the selected tag. So far I just pass a TreeMap where the entries are sorted already. However, I think that the View should decide whether to sort or not to sort, but I could not find a way to force the selected tag to sort. Is there anything you can recommend? Thanks and best regards, Anton signature.asc Description: OpenPGP digital signature
Re: html:hidden
Hi, Use plain told HTML and use your script tag. Thanks, Nuwan - Original Message - From: "john lee" <[EMAIL PROTECTED]> To: Sent: Sunday, June 10, 2007 3:49 PM Subject: html:hidden How to assaign value to html:hidden field? request.getAttribute("loginid")%>> but give me the error message, saying need double quote, after i put double quote before "<%..", cause jsp compile error, any clue? tks in advance john - Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:hidden
it's because setValue() for the taglib need a String. try " > Mike john lee a écrit : How to assaign value to html:hidden field? > but give me the error message, saying need double quote, after i put double quote before "<%..", cause jsp compile error, any clue? tks in advance john - Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:hidden
On 6/10/07, john lee <[EMAIL PROTECTED]> wrote: How to assaign value to html:hidden field? > but give me the error message, saying need double quote, after i put double quote before "<%..", cause jsp compile error, Which error did it cause? any clue? tks in advance john - Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:hidden
How to assaign value to html:hidden field? > but give me the error message, saying need double quote, after i put double quote before "<%..", cause jsp compile error, any clue? tks in advance john - Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta.
RE: How to format the decimal
Hi visit http://www.roseindia.net/struts/struts2/struts-2-format.shtml this is good example. thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Josh Vickery Sent: Saturday, June 09, 2007 6:36 PM To: Struts Users Mailing List Subject: Re: How to format the decimal Or, you can use the s:text tag (assuming you are using struts 2) and: where format.decimal is defined in a resource bundle somewhere (see http://cwiki.apache.org/confluence/display/WW/Localization for details) as: format.decimal={0,number,###.##} The text tag reference (http://cwiki.apache.org/confluence/display/WW/text) has some links to more information about using MessageFormat. Josh On 6/9/07, Antonio Petrelli <[EMAIL PROTECTED]> wrote: > 2007/6/9, Shuai Zheng <[EMAIL PROTECTED]>: > > Dear All, > > > > I want to keep all the numeric in my system with 2 decimal places only. What > > is the best way to do it? > > Use fmt:formatNumber contained in JSTL: > http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/formatNumber.html > > HTH > Antonio > > - > 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]