How can I get MessageResources in jsp
Hi folks, if I don't use the bean:message tag, is there any ways to get MessageResources objewct from session or request in jsp? I have tried the following, but it doesn't work. MessageResources message = (MessageResources)session.getAttribute(org.apache.struts.action.Action.MESSAGES_KEY); Thanks! Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
Use MessageResource in taglib
Hi folks, I need to get a value from the properties file. I can easily do it in action subclass with the getResource().getMessage() and in jsp with the bean:message tag. However, how I can it in a taglib? Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
Re: Using ApplicationResources.properties problem
Vincent, I found out what's going on. I have set up the Chinese(Taiwan) (zh_TW) for my input method in Windows. The Java was too smart to pick it up as my default locale. Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Original Message - From: Vincent Lin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Billy Ng [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 10:06 PM Subject: Re: Using ApplicationResources.properties problem Try this in your action class: HttpSession session = request.getSession(); session.setAttribute(org.apache.struts.Globals.LOCALE_KEY, java.util.Locale.ENGLISH); It will set the default locale of struts to ENGLISH. But I am not sure if struts will take the missing message from ApplicationResources.properties or ApplicationResources_en_US.properties. I am a little confused too. Please let me know if it works. Regards, Vincent --- Billy Ng [EMAIL PROTECTED] Sorry, I misunderstood your email. Let me try to set the default locale with LOCALE_KEY in the session. It will be great if you have any example that oyu can show me, thanks! Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Original Message - From: Vincent Lin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Billy Ng [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 7:34 PM Subject: Re: Using ApplicationResources.properties problem I think the default locale is set in session scope with the key org.apache.struts.Globals.LOCALE_KEY. In my experience, if you don't set default locale, struts will take the locale setting of the client browser. Are you using zh_TW as the default locale in your browser? Regards, Vincent --- Billy Ng [EMAIL PROTECTED] I am going to localize the product. The getResources().getMessage() method just works fine with the following properties files. ApplicationResources.properties ApplicationResources_en_US.properties ApplicationResources_fr_FR.properties However, if I add the ApplicationResources_zh_TW.properties, the getResources().getMessage() will pick up the missing key-value pairs from ApplicationResources_zh_TW.properties instead of ApplicationResources.properties. Why? I thought ApplicationResources.properties was the defualt. ApplicationResources.properties ApplicationResources_en_US.properties ApplicationResources_fr_FR.properties ApplicationResources_zh_TW.properties This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Yahoo! http://tw.promo.yahoo.com/mail_premium/stationery.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] - Yahoo! http://tw.promo.yahoo.com/mail_premium/stationery.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]
Using ApplicationResources.properties problem
I am going to localize the product. The getResources().getMessage() method just works fine with the following properties files. ApplicationResources.properties ApplicationResources_en_US.properties ApplicationResources_fr_FR.properties However, if I add the ApplicationResources_zh_TW.properties, the getResources().getMessage() will pick up the missing key-value pairs from ApplicationResources_zh_TW.properties instead of ApplicationResources.properties. Why? I thought ApplicationResources.properties was the defualt. ApplicationResources.properties ApplicationResources_en_US.properties ApplicationResources_fr_FR.properties ApplicationResources_zh_TW.properties This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
Re: Using ApplicationResources.properties problem
Sorry, I misunderstood your email. Let me try to set the default locale with LOCALE_KEY in the session. It will be great if you have any example that oyu can show me, thanks! Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Original Message - From: Vincent Lin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Billy Ng [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 7:34 PM Subject: Re: Using ApplicationResources.properties problem I think the default locale is set in session scope with the key org.apache.struts.Globals.LOCALE_KEY. In my experience, if you don't set default locale, struts will take the locale setting of the client browser. Are you using zh_TW as the default locale in your browser? Regards, Vincent --- Billy Ng [EMAIL PROTECTED] I am going to localize the product. The getResources().getMessage() method just works fine with the following properties files. ApplicationResources.properties ApplicationResources_en_US.properties ApplicationResources_fr_FR.properties However, if I add the ApplicationResources_zh_TW.properties, the getResources().getMessage() will pick up the missing key-value pairs from ApplicationResources_zh_TW.properties instead of ApplicationResources.properties. Why? I thought ApplicationResources.properties was the defualt. ApplicationResources.properties ApplicationResources_en_US.properties ApplicationResources_fr_FR.properties ApplicationResources_zh_TW.properties This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Yahoo! http://tw.promo.yahoo.com/mail_premium/stationery.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: How to set charset UTF-8
You know what, I was using the template. As long as I added % request.setCharacterEncoding(UTF-8); % in the template. It works now. Thanks everybody Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Original Message - From: Jing Zhou [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 11:15 PM Subject: Re: How to set charset UTF-8 We got a similar problem. At the very beginning, it looks like the processContent() method in the request processor would do the job for you if the ControllerConfig is set correctly. But the story is more complicated than I thought. It looks to me the container has the right to override the content type and/or the character encoding. From the JSP Specification, we have some statements like A JSP container may use some implementation-dependent heuristics and/or structure to determine what the expected character encoding of a JSP page is... The default implementations from Tomcat, OC4J, and SunOne are different. jsp:directive.page pageEncoding=ISO-8859-1 contentType=text/html/ is used in every JSP page. The Tomcat 4.1.24 generates a statement setContentType(text/html;charset=ISO-8859-1); // good The OC4J 9.0.3 generates the statement setContentType(text/html;charset=UTF-8); // something not expected The SunOne App7 generates the statement setContentType(text/html); // something shorter with warning message. The Resin 2.1.10 does the same as SunOne but without warning message. I am not sure what we are missing here. Anyway, we could not *force* them to produce the expected content type and the character encoding except on Tomcat. Jing Netspread Carrier http://www.netspread.com - Original Message - From: Van Riper, Mike [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: 'Billy Ng' [EMAIL PROTECTED] Sent: Thursday, August 21, 2003 4:30 PM Subject: RE: How to set charset UTF-8 I added the following to test what encoding my Struts app is using % response.setContentType(text/html; charset=UTF-8); System.out.println(response.getCharacterEncoding()); % But it still print out the ISO-8859-1, why? How can I set the contentType to text/html; charset=UTF-8 This is just a hunch, but, I suspect you can't change the character encoding after you have started writing content to the stream. In that case, your best bet is to do this at the very top of the JSP page: %@ page contentType=text/html;charset=UTF-8 language=java % Also, there is another consideration if you are using Tiles. Again this is just a hunch, but, I suspect that you would have to have that directive as the first line of your Tiles master layout template JSP. The concept mentioned above for a single page applies to a Tiles page generated dynamically from multiple JSPs all writing to the same response stream. We ran into something like this using the Struts template custom tags with Struts 1.0 back in 2001. We were correctly setting the character encoding using the page directive on individual content JSPs, but, had left it off our master page layout template JSP. So, it never took until we tracked that down. Duh! Hope this helps, Van Mike Van Riper mailto:[EMAIL PROTECTED] http://www.baychi.org/bof/struts - 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]
How to set charset UTF-8
Hi folks, I added the following to test what encoding my Struts app is using % response.setContentType(text/html; charset=UTF-8); System.out.println(response.getCharacterEncoding()); % But it still print out the ISO-8859-1, why? How can I set the contentType to text/html; charset=UTF-8 Thanks! Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
MIME decoding
Hi folks, I need to display a String that is MIME encoded. When I call java's MimeUtility.decodeText(str), it returns me ?. Do I need to set any charset in Struts to make work correctly? Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
persisting session id
Hi folks, This is really a tomcat related question, but I have no luck in tomcat ailing list. My question is I will lose the session everytime I close the browser. Is there a way to persist the session even I close the browser? Thanks! Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
where is JSESSIONID?
Hi folks; Anybody knows where is the JSESSIONID cookie is? I search the whole Cookies folder, I can't find it. Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com
Re: persisting session id
Can I put the JSESSIONID in the persistent cookie? When user hit the page, will the serlvet pick up the JSESSIONID from the cookie instead of memory? Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.com - Original Message - From: Max Cooper [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Billy Ng [EMAIL PROTECTED] Sent: Friday, August 15, 2003 10:06 PM Subject: Re: persisting session id You will lose the session when you close the browser. The session cookie is not persistent, which means your browser will forget the session id when it shuts down. In addition to that, the app server will destroy old sessions after a timeout period that can be set in web.xml (usually 90 minutes or less). Do you want persistent logins, or are there other things in the session you wish to preserve? If you just want persistent logins, a remember me feature is coming together for SecurityFilter (http://securityfilter.org/) that should be available in the next few months. Note that things added to the session in the last session will not be present when you return -- you are just automatically logged in again. -Max - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, August 15, 2003 11:12 AM Subject: persisting session id Hi folks, This is really a tomcat related question, but I have no luck in tomcat ailing list. My question is I will lose the session everytime I close the browser. Is there a way to persist the session even I close the browser? Thanks! Billy Ng This mailbox protected from junk email by Matador from MailFrontier, Inc. http://info.mailfrontier.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: extending Action problems
Hey Andrew, in fact, your hacky way works out pretty well. I use the hastable to hold the ActionContexts. I am going to do the hammer test to see if it hurts anything on the performace. Thanks, Andrew! Billy Ng private final static HashTable threadTable = new HashTable(100); public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { Integer tKey = new Integer(Thread.getCurrentThread().hashCode()); try { ActionContext ac = new ActionContext(mapping, form, req, resp); threadTable.put (tKey, sc); process(); } catch (Exception e) { . getActionContext().setActionForward(error); } fianlly { ActionForweard af = getActionContext().getActionForward(); threadTable.remove(tKey); return af; } } public ActionContext getActionContext() { Integer tKey = new Integer(Thread.getCurrentThread().hashCode()); return (ActionContext) threadTable.get(tKey); } public HttpServletRequest getRequest() { return getActionContext().getRequest(); } - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, July 06, 2003 8:35 PM Subject: RE: extending Action problems 1.) Probably not ;-) 2.) Yes. Ive never tried my hacky way - I only thought it up while I was thinking about your problem, so there is a good chance that it wont work as expected. (And worse = if it fails its likely to fail in a subtle way that is hard to reproduce consistently as it will probably be some kind of threading issue...) Id strongly discourage you from using this technique, but if you do let me know how it goes. -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Saturday, 5 July 2003 02:58 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: extending Action problems Hey, I like your last hacky way. but I am just so worried if: 1) I can trust the thread.hashCode() as key? 2) If I guess it right, I think I need to remove the ac from the Map when the thread exits perform(). Memory leak may cause if it fails to remove. But I still love it. Do you have any running application that is using this method? Thanks Andrew! Billy Ng - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Sent: Friday, July 04, 2003 3:49 AM Subject: RE: extending Action problems Almost - but the getRequest(ac) is redundant - you would just call ac.getRequest() when you needed the request as youve passed in ac as a method parameter. You will note though that you still have to pass the ac parameter to any method that needs access to the stuff it wraps. ie: public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { ActionContext ac = new ActionContext(mapping, form, req, resp); process(ac); etc.. } private void process(ActionContext ac) { String bob = ac.getRequest().getParameter(bob); etc } What you really really want to be able to do is: private void process() { String bob = getRequest().getParameter(bob); } isnt it? ;-) but as you saw already that simply wont work with a singleton Action - only way you can deal with this is either passing one or more parameters to methods in Action that need them OR modifying the RequestProcessor to return new instances of your Action for each request - that wouldnt need much code to achieve, but if your cautious Id suggest you stick with a parameter passing methodology. Well, I suppose there is one way I can think of to do it without having to pass around the ac as a param - but its an evil hack and Im including it more for your amusement than for your education! evil disclaimer=dont try this at home kids tested=no Put your ActionContext instance into the servlet context in perform() keyed by the threads hashcode. Provide a method getActionContext() in your base action to retrieve it. Now you can get it from any method in your action just by calling getActionContext() without having to pass it around in a param. /evil -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Friday, 4 July 2003 18:19 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: extending Action problems Sorry, Andrew! I am a little bit slow. Please review it if I understand what you told me with the following code. public abstract class ActionBase extends Action { protected
Re: IE 6 SP-1 won't session
But my app works for all customers except one. Billy Ng - Original Message - From: sander-martijn [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 04, 2003 12:26 PM Subject: Re: IE 6 SP-1 won't session I was having a similar issue - check your redirects - make sure you don't have situations where submissions are going to a different url than the redirects - for instance: user types in mysite.com, is redirected to mysite.com/login.jsp user submits, form submission goes to mysite.com/access/login login servlet, upon successs, redirects to www.mysite.com/index.jsp if you have this situation (others might be typing www.mysite.com so they wouldn't have the problem) what happens is that seeing that it's a new url the user gets a new session, a new session id, and therefore is not registered as being logged in. there are actually many ways to solve this - here are a few: make sure all users end up with the same url (using redirects from the start) set cookies to work for *.mysite.com (can u do that with session ids? not sure) prepend all links with whatever the requested domain name is use all relative links use all full links consistently hope that helps. .sander { Billy Ng was saying }: This may be a tomcat question, but I don't find any help there. One of the customers complains they get bounced back to login page after they logged in and click on any button. This only happens on IE 6 SP-1, but not Netscape. My best guess is the sessioned cookie never been set so that the app returns user back to login page. Anyone have seen this before? Thanks! Billy Ng -- I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. - Einstein sander-martijn mailto:[EMAIL PROTECTED] interface developer | architect [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.sander-martijn.com http://www.sander-martijn.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: Is Action Instantiated Once?
I think I know what is happening. I have some getter methods that hold the memeber variables in the ActionBase class. Thank you guys! Billy Ng - Original Message - From: Kwok Peng Tuck [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, July 03, 2003 8:15 PM Subject: Re: Is Action Instantiated Once? How did you code the Action ? Billy Ng wrote: I don't think I used instance variables for referencing the address book entries, but the last guy always wins. The screen of the guy who first clicks on the next button will not display anything until the screen of the guy who clicks later finishes. Billy Ng - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Billy Ng [EMAIL PROTECTED] Sent: Thursday, July 03, 2003 6:42 PM Subject: Re: Is Action Instantiated Once? On Thu, 3 Jul 2003, Billy Ng wrote: Date: Thu, 3 Jul 2003 18:21:53 -0700 From: Billy Ng [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED], Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Is Action Instantiated Once? Hi folks, I have a address book page that has the previous and next buttons. I notice if 2 different users try to access the address books, last one who clicks on the button always get what it should display. This sounds very like they are both are using the same Action. The address book action extends a ActionBase that extends Strut's Action. Would anybody tell me if Strut will instantiates a new acton everytime it is called? No ... one instance only (just like servlets). Did I miss something on the configuration to make it thread dependent? You're probably using instance variables in the Action class to store things relevant only to a particular request. If so, use local variables or request/session scope attributes instead. Thanks! Billy Ng Craig - 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]
extending Action problems
I make a mistake on extending the Action. I have the following code to set the parameters in the perform() to the setters. At first, I wanted whichever the classes that extends ActionBase can get the parameters by simply calling the getters. However, the Action is a singleton, the instance variables will be used by all actions. Anybody can give me suggestion to make the getters to return the mapping, form, req, and resp as local variables? Thanks! public class ActionBase extends Action { private ActionMapping mapping; private ActionForward actionForward; private ActionForm form; private HttpServletRequest req; private HttpServletResponse resp; private String view; protected void process() throws Exception {} public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { setActionMapping(); setActionForm(data); setRequest(req); setResponse(resp); process(); } protected void setActionMapping(ActionMapping mapping) { this.mapping = mapping; } protected ActionMapping getActionMapping() { return this.mapping; } protected void setRequest(HttpServletRequest req) { this.req = req; } protected HttpServletRequest getRequest() { return this.req; } protected void setResponse(HttpServletResponse resp) { this.resp = resp; } protected HttpServletResponse getResponse() { return this.resp; } }
Re: Struts-bean.tld
I normally use it to get the value from the properties file. a href=bean:message key=home.link/ In the Applications.properties file, you can define home.link=http://www.home.com How handy, right? You should look at the Struts' doc Billy Ng - Original Message - From: Jagannayakam [EMAIL PROTECTED] To: Struts Users Mailing List (E-mail) [EMAIL PROTECTED] Sent: Friday, July 04, 2003 2:11 AM Subject: Struts-bean.tld What does the struts-bean.tld do . Regards, Jagan. - 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 Action problems
Sorry, Andrew! I am a little bit slow. Please review it if I understand what you told me with the following code. public abstract class ActionBase extends Action { protected abstract void process() throws Exception; public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { ActionContext ac = new ActionContext(mapping, form, req, resp); process(ac); } public HttpServletRequest getRequest(ActionContext ac) { return ac.getRequest(); } } - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 04, 2003 2:42 AM Subject: RE: extending Action problems Yes, this is a quite annoying feature of the singleton nature of Actions (and given the efficiency of modern JVMs at instantiating and garbage collecting there is jolly good argument for changing the RequestProcessor to instantiate new instances of Action for each request (and do feel free to try this at home kids!) - though Im getting off topic here). One way of dealing with this is to create a bean (or bean like object) that has the getters and setters you need, and to pass this to any method in your action that needs it. You instantiate the object at the start of perform() (or execute() method in struts1.1) and then pass the reference to methods. In my app I have an object for this task which I named ActionContext - this basically just wrapped a Hashmap into which I could insert/retrieve stuff with ActionContext.setAttribute, getAttribute, and I also has specific getters for the perform signature objects you mentioned - ActionForm, ActionMapping, HttpServletRequest and HttpServletResponse references - (which are passed to its constructor) - so you still have to pass one reference around as a parameter - but its a lot less typing than 4 - and its a great place for putting other stuff as well that is internal to the action (and for which you would rather not use the request attributes for reasons of scoping purity). And of course since the object is instantiated in the action and is only used in that thread and is garbage collected at the end, it does not suffer the thread safety constraints you encountered. btw If you want to store other stuff in it you may decide Hashmaps are a bit on the heavy side - in which case you could have a superclass for your 'ActionContext' that has getters for request,mapping,response,actionform and instantiate classes (inner classes perhaps) in your Actions that add extra properties specific to the needs of the action. /btw drop-name celebrity=Ted Husted Actually I vaguely recall Ted mentioning in a reply to some post of mine that he used a similar technique quite often - but it may have been someone else so don't quote me on that! /drop-name -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Friday, 4 July 2003 17:06 To: Struts Users Mailing List Subject: extending Action problems I make a mistake on extending the Action. I have the following code to set the parameters in the perform() to the setters. At first, I wanted whichever the classes that extends ActionBase can get the parameters by simply calling the getters. However, the Action is a singleton, the instance variables will be used by all actions. Anybody can give me suggestion to make the getters to return the mapping, form, req, and resp as local variables? Thanks! public class ActionBase extends Action { private ActionMapping mapping; private ActionForward actionForward; private ActionForm form; private HttpServletRequest req; private HttpServletResponse resp; private String view; protected void process() throws Exception {} public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { setActionMapping(); setActionForm(data); setRequest(req); setResponse(resp); process(); } protected void setActionMapping(ActionMapping mapping) { this.mapping = mapping; } protected ActionMapping getActionMapping() { return this.mapping; } protected void setRequest(HttpServletRequest req) { this.req = req; } protected HttpServletRequest getRequest() { return this.req; } protected void setResponse(HttpServletResponse resp) { this.resp = resp; } protected HttpServletResponse getResponse() { return this.resp; } } - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: extending Action problems
Hey, I like your last hacky way. but I am just so worried if: 1) I can trust the thread.hashCode() as key? 2) If I guess it right, I think I need to remove the ac from the Map when the thread exits perform(). Memory leak may cause if it fails to remove. But I still love it. Do you have any running application that is using this method? Thanks Andrew! Billy Ng - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Sent: Friday, July 04, 2003 3:49 AM Subject: RE: extending Action problems Almost - but the getRequest(ac) is redundant - you would just call ac.getRequest() when you needed the request as youve passed in ac as a method parameter. You will note though that you still have to pass the ac parameter to any method that needs access to the stuff it wraps. ie: public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { ActionContext ac = new ActionContext(mapping, form, req, resp); process(ac); etc.. } private void process(ActionContext ac) { String bob = ac.getRequest().getParameter(bob); etc } What you really really want to be able to do is: private void process() { String bob = getRequest().getParameter(bob); } isnt it? ;-) but as you saw already that simply wont work with a singleton Action - only way you can deal with this is either passing one or more parameters to methods in Action that need them OR modifying the RequestProcessor to return new instances of your Action for each request - that wouldnt need much code to achieve, but if your cautious Id suggest you stick with a parameter passing methodology. Well, I suppose there is one way I can think of to do it without having to pass around the ac as a param - but its an evil hack and Im including it more for your amusement than for your education! evil disclaimer=dont try this at home kids tested=no Put your ActionContext instance into the servlet context in perform() keyed by the threads hashcode. Provide a method getActionContext() in your base action to retrieve it. Now you can get it from any method in your action just by calling getActionContext() without having to pass it around in a param. /evil -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Friday, 4 July 2003 18:19 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: extending Action problems Sorry, Andrew! I am a little bit slow. Please review it if I understand what you told me with the following code. public abstract class ActionBase extends Action { protected abstract void process() throws Exception; public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) { ActionContext ac = new ActionContext(mapping, form, req, resp); process(ac); } public HttpServletRequest getRequest(ActionContext ac) { return ac.getRequest(); } } - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 04, 2003 2:42 AM Subject: RE: extending Action problems Yes, this is a quite annoying feature of the singleton nature of Actions (and given the efficiency of modern JVMs at instantiating and garbage collecting there is jolly good argument for changing the RequestProcessor to instantiate new instances of Action for each request (and do feel free to try this at home kids!) - though Im getting off topic here). One way of dealing with this is to create a bean (or bean like object) that has the getters and setters you need, and to pass this to any method in your action that needs it. You instantiate the object at the start of perform() (or execute() method in struts1.1) and then pass the reference to methods. In my app I have an object for this task which I named ActionContext - this basically just wrapped a Hashmap into which I could insert/retrieve stuff with ActionContext.setAttribute, getAttribute, and I also has specific getters for the perform signature objects you mentioned - ActionForm, ActionMapping, HttpServletRequest and HttpServletResponse references - (which are passed to its constructor) - so you still have to pass one reference around as a parameter - but its a lot less typing than 4 - and its a great place for putting other stuff as well that is internal to the action (and for which you would rather not use the request attributes for reasons of scoping purity). And of course since the object is instantiated in the action and is only used in that thread and is garbage collected at the end
IE 6 SP-1 won't session
This may be a tomcat question, but I don't find any help there. One of the customers complains they get bounced back to login page after they logged in and click on any button. This only happens on IE 6 SP-1, but not Netscape. My best guess is the sessioned cookie never been set so that the app returns user back to login page. Anyone have seen this before? Thanks! Billy Ng
Is Action Instantiated Once?
Hi folks, I have a address book page that has the previous and next buttons. I notice if 2 different users try to access the address books, last one who clicks on the button always get what it should display. This sounds very like they are both are using the same Action. The address book action extends a ActionBase that extends Strut's Action. Would anybody tell me if Strut will instantiates a new acton everytime it is called? Did I miss something on the configuration to make it thread dependent? Thanks! Billy Ng
Re: Is Action Instantiated Once?
I don't think I used instance variables for referencing the address book entries, but the last guy always wins. The screen of the guy who first clicks on the next button will not display anything until the screen of the guy who clicks later finishes. Billy Ng - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Billy Ng [EMAIL PROTECTED] Sent: Thursday, July 03, 2003 6:42 PM Subject: Re: Is Action Instantiated Once? On Thu, 3 Jul 2003, Billy Ng wrote: Date: Thu, 3 Jul 2003 18:21:53 -0700 From: Billy Ng [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED], Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Is Action Instantiated Once? Hi folks, I have a address book page that has the previous and next buttons. I notice if 2 different users try to access the address books, last one who clicks on the button always get what it should display. This sounds very like they are both are using the same Action. The address book action extends a ActionBase that extends Strut's Action. Would anybody tell me if Strut will instantiates a new acton everytime it is called? No ... one instance only (just like servlets). Did I miss something on the configuration to make it thread dependent? You're probably using instance variables in the Action class to store things relevant only to a particular request. If so, use local variables or request/session scope attributes instead. Thanks! Billy Ng Craig - 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]
IE 6 timeout session
Hi folks; I have a customer complains the IE 6 sp1 times out the session after he is logged in the app. I tried to reproduce it but I can't. Have anybody experienced this? Billy Ng
Re: IE 6 timeout session
It does not care the timeout in the server.xml. After the guy logged in to the app, he would be returned to the login page if he clicked on anything. This means his session expired or the session is null. It only happens on the IE 6 SP-1. Billy Ng - Original Message - From: Chen, Gin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 10:07 AM Subject: RE: IE 6 timeout session default timeout is 30 mins. are you sure its ie 6 or just him running into the default? -Tim -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:06 PM To: Struts Users Mailing List Subject: IE 6 timeout session Hi folks; I have a customer complains the IE 6 sp1 times out the session after he is logged in the app. I tried to reproduce it but I can't. Have anybody experienced this? Billy Ng - 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: IE 6 timeout session
Are you sure? I changed my IE to Block cookies, but it still let me in without sessing the read eye in the status bar. If I go to yahoo to log in to my account, the red eye shows up. I think java session is different from simply writing cookie to the client. Billy Ng - Original Message - From: Chen, Gin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 10:19 AM Subject: RE: IE 6 timeout session Probably Cookies were blocked. IE 6 has this popup when a page requires cookies it asks if you want to accept it. Even though you are using Session it is detected as a cookie (because thats what it is :). He probably selected to block it. Tell him to look on the status bar at the bottom (view-statusbar if not already up). If it has an eye with a red mark on it then he blocked cookies from you. Double click the eye and select always allow. -Tim -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:15 PM To: Struts Users Mailing List Subject: Re: IE 6 timeout session It does not care the timeout in the server.xml. After the guy logged in to the app, he would be returned to the login page if he clicked on anything. This means his session expired or the session is null. It only happens on the IE 6 SP-1. Billy Ng - Original Message - From: Chen, Gin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 10:07 AM Subject: RE: IE 6 timeout session default timeout is 30 mins. are you sure its ie 6 or just him running into the default? -Tim -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:06 PM To: Struts Users Mailing List Subject: IE 6 timeout session Hi folks; I have a customer complains the IE 6 sp1 times out the session after he is logged in the app. I tried to reproduce it but I can't. Have anybody experienced this? Billy Ng - 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]
How to detect Input Image
Is there a way to find a html:image properties=delete/ is hit? I am using the following code which is working very good. (!0.equals(getRequest().getParameter(delete.y)) !0.equals(getRequest().getParameter(delete.x))) However, this looks really urgly. Is there any get() and set() methods that I can use in ActionForm to get x and y int? Thanks! Billy Ng
Re: How to detect Input Image
Wow, looks cool! However, if I can get the request object in the ActionForm, the code can be much shorter. Billy Ng - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 13, 2003 11:21 AM Subject: RE: How to detect Input Image See http://husted.com/struts/tips/001.html robert -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 1:58 PM To: [EMAIL PROTECTED] Subject: How to detect Input Image Is there a way to find a html:image properties=delete/ is hit? I am using the following code which is working very good. (!0.equals(getRequest().getParameter(delete.y)) !0.equals(getRequest().getParameter(delete.x))) However, this looks really urgly. Is there any get() and set() methods that I can use in ActionForm to get x and y int? Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Precompiling JSPs
I used Ant to precompile the JSPs before. It was very good but took much longer to compile a build. If you have 2,000 JSPs, mm... And I can tell how hard to maintain 2000 entries in the web.xml. Billy Ng - Original Message - From: William W [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 13, 2003 12:01 PM Subject: Precompiling JSPs Hi All, My app has more than 2,000 JSPs. I can precompile my JSP and map it into the web.xml file. But I think that it would become a little big. Sugestions ??? Thanks, William. _ The new MSN 8 is here: Try it free* for 2 months http://join.msn.com/?page=dept/dialup -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Forward to a servlet
Hi folks, In my Struts app, I am using the Action to call the jsp file. In the struts-config.xml, the action tag looks like this, action path=/accounts type=com.mydomain.AccountsAction name=accountsForm validate=false input=/WEB-INF/jsp/AccountsHTML.jsp forward name=accounts path=/WEB-INF/jsp/AccountsHTML.jsp/ /action Because of some deployment issue, I need to pre-compile the jsp files. I successfully use the ANT's jspc tag to compile the all the jsp files to java files, then compile them to java files. However, I cannot make it use the servlet in the forward tag. I tried to do this (AccountsHTML_jsp is class file of the compiled version of AccountsHTML.jsp), but I get 404 page. action path=/accounts type=com.mydomain.AccountsAction name=accountsForm validate=false input=/WEB-INF/jsp/AccountsHTML.jsp forward name=accounts path=/WEB-INF/ui/AccountsHTML_jsp/ /action Would anybody knows how can I make this work? Thanks in advance! Billy Ng
Re: Forward to a servlet
Interesting! Tell me if I am wrongly interpret your message. Do you mean I should deploy the precompiled jsp files to tomcat/work/standalone/localhost/myApp ? If not, how does the servlet container, tomcat, know I have already precompiled the jsp files when the forward tag points to the jsp files? Billy Ng - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, December 15, 2002 11:05 PM Subject: RE: Forward to a servlet I thought that even with precompiling you would just point the forward at the .jsp file as normal? (Ie: shouldnt need to modify the action stuff in struts-config.xml) -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 14:45 To: Struts Users Mailing List Subject: Forward to a servlet Hi folks, In my Struts app, I am using the Action to call the jsp file. In the struts-config.xml, the action tag looks like this, action path=/accounts type=com.mydomain.AccountsAction name=accountsForm validate=false input=/WEB-INF/jsp/AccountsHTML.jsp forward name=accounts path=/WEB-INF/jsp/AccountsHTML.jsp/ /action Because of some deployment issue, I need to pre-compile the jsp files. I successfully use the ANT's jspc tag to compile the all the jsp files to java files, then compile them to java files. However, I cannot make it use the servlet in the forward tag. I tried to do this (AccountsHTML_jsp is class file of the compiled version of AccountsHTML.jsp), but I get 404 page. action path=/accounts type=com.mydomain.AccountsAction name=accountsForm validate=false input=/WEB-INF/jsp/AccountsHTML.jsp forward name=accounts path=/WEB-INF/ui/AccountsHTML_jsp/ /action Would anybody knows how can I make this work? Thanks in advance! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Forward to a servlet
So, should I do this? web.xml = servlet servlet-name AccountHTML_jsp /servlet-name servlet-class com.mydomain.AccountHTML_jsp /servlet-class /servlet servlet-mapping servlet-name AccountHTML_jsp /servlet-name url-pattern /AccountHTML.jsp /url-pattern /servlet-mapping struts-config.xml === action path=/accounts type=com.mydomain.AccountsAction name=accountsForm validate=false input=/WEB-INF/jsp/AccountsHTML.jsp forward name=accounts path=/WEB-INF/jsp/AccountsHTML.jsp/ /action Billy Ng - Original Message - From: David M. Karr [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 15, 2002 11:25 PM Subject: Re: Forward to a servlet Billy == Billy Ng [EMAIL PROTECTED] writes: Billy Hi folks, Billy In my Struts app, I am using the Action to call the jsp file. In the struts-config.xml, the action tag looks like this, Billy action path=/accounts Billytype=com.mydomain.AccountsAction Billyname=accountsForm Billyvalidate=false Billyinput=/WEB-INF/jsp/AccountsHTML.jsp Billyforward name=accounts path=/WEB-INF/jsp/AccountsHTML.jsp/ Billy /action Billy Because of some deployment issue, I need to pre-compile the jsp files. I successfully use the ANT's jspc tag to compile the all the jsp files to java files, then compile them to java files. However, I cannot make it use the servlet in the forward tag. I tried to do this (AccountsHTML_jsp is class file of the compiled version of AccountsHTML.jsp), but I get 404 page. Billy action path=/accounts Billytype=com.mydomain.AccountsAction Billyname=accountsForm Billyvalidate=false Billyinput=/WEB-INF/jsp/AccountsHTML.jsp Billyforward name=accounts path=/WEB-INF/ui/AccountsHTML_jsp/ Billy /action Billy Would anybody knows how can I make this work? You don't change your struts-config.xml at all to use precompiled JSP pages. You do have to change your web.xml file, however, to include the servlet mappings for the generated servlets. You also have to include the generated and compiled servlet class files in your WAR file. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Stop auto fill in html:password
Hi folks, IE will auto fill the password if user enables it. Is there a way to clear the history in the html:password? Billy Ng
Re: Stop auto fill in html:password
I got the answer in the previous email. Please ignore this one. Billy Ng - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, October 26, 2002 3:00 PM Subject: Stop auto fill in html:password Hi folks, IE will auto fill the password if user enables it. Is there a way to clear the history in the html:password? Billy Ng -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: RedirectingActionForward?
I posted a question earlier regarding the redirect. I notice I can't do the sendRedirect after the mapping.findForward is called. Oterwise, it works very good with return null. Billy Ng - Original Message - From: Eddie Bush [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, October 07, 2002 8:59 PM Subject: Re: RedirectingActionForward? I need to dig into the source more deeply. I looked briefly but couldn't satisfy myself as to whether you could do a redirect that wasn't (at least) relative to the application. Sorry, but this isn't an issue I've had to face. As a last resort you could do: response.sendRedirect(response.encodeUrl(path)); return null; Returning null is very important, as it signals the RequestProcessor that it doesn't need to do anything else. Hopefully someone else will have additional wisdom for you. Angie Lin wrote: Trying again Anybody with clues on why RedirectingActionForward isn't redirecting? This used to work in 1.0.2. Angie Lin wrote: Hi there, RedirectingActionForward doesn't seem to redirect anymore. It's trying to forward and I'm ending up with a garbled URL like: http://localhost:7001/myapp/http://someothersite.com/ My code is: ActionForward oldfwd=mapping.findForward(othersite); String path=oldfwd.getPath(); path.append(?id=+id); RedirectingActionForward newfwd=new RedirectingActionForward(path); return newfwd; This used to work in 1.0.2, but I've since upgraded to 1.1b. I'm also using WL6.1 if that helps at all. I've searched the archive and read the thread on message 38728, but that problem was fixed by setting the contextRelative attribute to true, which doesn't quite help me, since I'm trying to forward to another domain. Any other configuration settings I might be missing? -- Eddie Bush -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Image path question
I am building an app that has lots of TD contains the backgrpound images. In the html:img tag I can use the page attribute without defining the app name, but the in the TD's background attribute, I need to add the app name in the path like /myApp/img/imgae.gif. If I don't want to write the custom tag to generate the TD tag, what other option do I have? In additional, this program will be the only one app that will on the intranet. If I can map the http://localhost:8080/myApp to http://localhost/, it may solve the problem. Can I do it in Struts? or this will be the Tomcat or Apache thing? Thanks! Billy Ng
Redirect Question
I am trying to create a redirect method. What I am trying is following things in the Action. but I got the error saying I can't set the Response since it is already commited. If I don;t want to specify a redirect forward in the struts-conf.xml, how can I do it in the Action? HttpServeletResponse.sendRedirect(url); return null; Thanks! Billy Ng
error page for jsp
Hi folls; I don't want to see the exception error if anything goes wrong in jsp. Should I use % page errorPage=errorpage.jsp %? or Struts has better mechanism to handle the exception is thrown in jsp? Thanks! Billy Ng
help on validate attribute
Hi folks, If I put validate=true in the action tag, the form will be validated once it is load. Is it a right behavior? Since there is no data in the form bean, some madatory fields that I specify in the validate method will be treated as error. How should I handle it? Billy Ng
Re: Cannot find bean error
Make sure your clsoing tag is right. I had the similar error message when I had an incorrect closing /html:form tag. Hope this helps! Billy Ng - Original Message - From: Anoop [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, October 07, 2002 12:55 AM Subject: RE: Cannot find bean error I checked these out, and seems correct. Are there anything specific issues which have to be looked into. Anoop. -Original Message- From: deepank [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 1:12 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Cannot find bean error Hi, I am not sure about this, but i have had this problem. Make sure your bean follows the specifications of a Bean. All properties have getter/setter methods. Sometimes Struts(or reflection i should say) will not recognize your class as bean because if this. Also double check if your storing it in some scope in your Action class. Deepank - Original Message - From: Anoop [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 07, 2002 12:30 PM Subject: Cannot find bean error Hi, I am trying to loop through an ArrayList returnd by a bean inside logic:iterator Name in the Iterator tag specifies a bean set in request scope in my ActionBean, getter on which will return an ArrayList. I am trying to read the bean returned by the ArrayList inside the Iterator tag. There is an exception thrown: javax.servlet.ServletException: Cannot find bean EMTTaskDetail in scope null I tried specifying all the possible scopes, session and request but it still throw this exception The scriptlet looks something like this: logic:iterate id=EMTTaskDetail name=timesheetDetails property=taskDetails tr class=welcometxt td bgcolor=#f0f0f0pbean:write name=EMTTaskDetail property=taskName//p/td ... getTaskDetails() on the bean set in the request scope with key timesheetDetails returns an ArrayList of EMTTaskDetail objects. Thanks for your help. Thanks Regards, Anoop. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Business Logic Bean Question
Thanks all of you, I think I got the picture! Billy Ng - Original Message - From: Pavel Kolesnikov [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, October 04, 2002 10:47 AM Subject: Re: Business Logic Bean Question On Fri, 4 Oct 2002, Billy Ng wrote: I have been reading some articles briefly talking about the business logic beans. The way I build my Struts app is to use the Action's perform or execute method to do the business logic. Then, I set the data into a bean and pass it off to the JSP. It works just fine. However, my question is if I should do the business logic in Action? Am I supposed to hand down the job to a business logic bean? Yes, it's a good practice. It will be helpful if anyone can provide me samples or links for how a business logic looks alike. It can be any common class. OK, it would be nice if it followed some simple rules like - don't accept any client specific (e.g. http related) parameters - don't expose business logic implementation details (e.g. SQL or EJB related exceptions) I recommend you EJB Design Patterns book from Floyd Marinescu (you can download it for free from www.theserverside.com), try to find something about Business Delegate pattern there. Pavel -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Business Logic Bean Question
Hi folks, I have been reading some articles briefly talking about the business logic beans. The way I build my Struts app is to use the Action's perform or execute method to do the business logic. Then, I set the data into a bean and pass it off to the JSP. It works just fine. However, my question is if I should do the business logic in Action? Am I supposed to hand down the job to a business logic bean? It will be helpful if anyone can provide me samples or links for how a business logic looks alike. Thanks in advance! Billy Ng
Problem with JDBC Connector 2 driver
My app still hangs once in a while. I am supsecting the problem comes from the JDBC driver becuase it only stalls on the pages that need database access. Would anybody please tell me if you have experieneced the same problem with using Linux, mysql, and Connector 2 driver. Thanks! Billy Ng
set ContentType to application/msword
I am trying to let user to open the HTML with MS Word. I changed the content type to ContentType=application/msword in the jsp, but it still did not bring up the Word. Does Struts set the content type to text/html somewhere? Thanks! Billy Ng
RE: Access JSP in the WEB-INF
I was told I could do this; action name=aPage .. [put the jsp file here] /action action forward name=aPage path=aPage.do / /action Billy Ng From: Andrew Hill [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Subject: RE: Access JSP in the WEB-INF Date: Mon, 30 Sep 2002 23:43:12 +0800 Im in a bit of a rush right now to try and get a taxi home before the midnight charge kicks in, but Im sure there are many others out there who can give you a good example (right guys???) -Original Message- From: Smith, Johnathan M. [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 23:34 To: '[EMAIL PROTECTED]' Subject: RE: Access JSP in the WEB-INF Can you send me a sample on how to do this in my action -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 11:14 AM To: Struts Users Mailing List Subject: RE: Access JSP in the WEB-INF Once they are under web-inf a direct access from the client will not be allowed by the container, however forwards on the server side are allowed, thus to get to the JSP you can forward to it from an Action. The benefit of this is that users will not be able to hit your JSP without first going through an Action, and thus through the struts front-controller thinghy. You can thus ensure that everything is set up that that JSP needs (ie: beans in the request etc...) or could redirect them to another jsp or action if business logic demanded it... -Original Message- From: Smith, Johnathan M. [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 23:08 To: '[EMAIL PROTECTED]' Subject: Access JSP in the WEB-INF I was reading that I should put all my JSP inside the WEB-INF dir so clients cant access them without going to the controller. My issues is that How do I access them?? can someone please tell me how to setup my Action so I can display the JSP files?? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: taglib url problem
Actually, I consider it to be added simplicity. ;-) It simplifies my app because I know that the container will prevent someone from accessing my JSP pages directly, and there is *nothing* else I have to do to ensure this. It always my concern on people trying to access anything after /. I have tried to find the way to limit the users to view the directory tree with the tomcat configuration, but failed. Therefore, I put a default index file to each directory after /. I am pretty new to Struts so I don't know how to handle it. Is there a way to avoid users to see the directory tree? If not, I need to move things to after the /WEB-INF. Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: xml transformation
After I used the JTSL's x:transfom tag, it is working now. Thanks a lot, Eddie! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
taglib url problem
The c tag cannot find the xml document if the directory is behind th WEB-INF directory like: %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % c:import url=/WEB-INF/xml/my.xml var=xml/ c:import url=/WEB-INF/xml/my.xsl var=xslt/ x:transform xml=${xml} xslt=${xslt}/ , but I change the xml directory to root, it will work %@ taglib prefix=c uri=http://java.sun.com/jstl/core; % %@ taglib prefix=x uri=http://java.sun.com/jstl/xml; % c:import url=/xml/my.xml var=xml/ c:import url=/xml/my.xsl var=xslt/ x:transform xml=${xml} xslt=${xslt}/ Would anybody please tell me why? Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
use Jakarta TagLibs in Struts
) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170 ) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java: 1012) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107 ) at java.lang.Thread.run(Thread.java:536) Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
preserve Forward order
When I use mapping.findForwards(), it returns me the sorted forward names. How can I get the forward names in the same order as in the struts-conf.xml? Thanks! Billy Ng
Re: preserve Forward order
I knew somebody would ask me why :-) Okay, I am using the String[] that returns from mapping.findForwards() to generate links in the left nav bar. This way, I will only generate the links for the Action I call. For example, action path=/project type=com.evebill.billyng.ui.about_me.AboutMeBase name=AboutMeAction forward name=bridge path=/jsp/about_me/bridge.jsp/ forward name=subway path=/jsp/about_me/subway.jsp/ forward name=library path=/jsp/about_me/library.jsp/ /action String[] forwards = mapping.findForwards(); for (int i=0; i forwards.length; i++) { ActionForward forward = mapping,findForward(forwards[i]); out.print(A href=\+forward.getPath()+\+forward.getName()+/A; } I know I am lazy, but it works very good except the sorting. That's why I want the elements of the String[] has the order I put in struts-conf.xml Billy Ng - Original Message - From: Eddie Bush [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, September 21, 2002 8:23 AM Subject: Re: preserve Forward order I'm not sure what you're trying to do. Most generally, folks use 'mapping.findForward( success)' -- or something very close to it. That returns the forward in question. Why do you need the whole list? Billy Ng wrote: When I use mapping.findForwards(), it returns me the sorted forward names. How can I get the forward names in the same order as in the struts-conf.xml? Thanks! Billy Ng -- Eddie Bush -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: preserve Forward order
Good idea! I won't go for hacking Struts either. By the way, I heard you guys talking about plugin so many times (I know, I am a slower learner). Any web site I can look at. I am very interested in learnig it. Billy Ng - Original Message - From: Eddie Bush [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, September 21, 2002 9:24 AM Subject: Re: preserve Forward order Well, I'm not sure what sort of collection those are kept in. It may not be ordered. My (pure) guess is that those get stored in a Hashmap of sorts. That being the case, I don't think there's a way to determine their original order - you'd have to cook something up. You could: - write a plugin to build an object-graph representing your navigation console - hack struts to use a different sort of collection The plugin idea has some merit to it. You'll get a reference to the application configuration for whichever module you're in. You could use that to determine your links etc. What you'd probably do is something along these lines: - arrive at a design for your heirarchy - arrive at a deisgn for an XML file that models that heirarchy - use digester to parse the XML and create/populate your beans - iterate through your beans and use some attribute of the bean to do a lookup in the application config and retrieve the links you need - set your bean properties per the action - stuff your top-level bean out into application scope so you can reference it later Help any? Billy Ng wrote: I knew somebody would ask me why :-) Okay, I am using the String[] that returns from mapping.findForwards() to generate links in the left nav bar. This way, I will only generate the links for the Action I call. For example, action path=/project type=com.evebill.billyng.ui.about_me.AboutMeBase name=AboutMeAction forward name=bridge path=/jsp/about_me/bridge.jsp/ forward name=subway path=/jsp/about_me/subway.jsp/ forward name=library path=/jsp/about_me/library.jsp/ /action String[] forwards = mapping.findForwards(); for (int i=0; i forwards.length; i++) { ActionForward forward = mapping,findForward(forwards[i]); out.print(A href=\+forward.getPath()+\+forward.getName()+/A; } I know I am lazy, but it works very good except the sorting. That's why I want the elements of the String[] has the order I put in struts-conf.xml Billy Ng -- Eddie Bush -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: preserve Forward order
Thanks! I ask you more when I am stuck. Billy Ng - Original Message - From: Eddie Bush [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, September 21, 2002 9:50 AM Subject: Re: preserve Forward order Here's what I would do: - grab source from CVS - located the source for ValidatorPlugin.java (or is it ValidatorPlugIn.java?) - read up on the javadoc for the Plugin interface. (You could just browse CVS over the web and find that file to examine, if you prefer. I find having the full source handy for consultation is a big help at times though.) It's *really* simple. I think the most difficult part will be figuring out the digester and what you want your graph to look like. Be sure you look at the digester package javadocs: org.apache.commons.digester (I believe). There's quite a long explaination of how to use the digester. If you get stuck, I can possibly give you a pointer or two. I haven't used it long, but I manage to get it to build heirarchys just fine (create this, set it's properties, add it to this other object ...) A skelleton plugin might be: -- BEGIN MyPlugin import org.apache.struts.action.PlugIn; import org.apache.struts.action.ActionServlet; import org.apache.struts.config.ApplicationConfig; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.digester.Digester; import org.xml.sax.SAXException; import javax.servlet.ServletException; import javax.servlet.UnavailableException; import java.io.IOException; import java.util.Collection; import java.util.ArrayList; public class MyPlugin implements PlugIn { private Log log = LogFactory.getLog(MyPlugin.class); private ActionServlet servlet = null; private ApplicationConfig config = null; private String configFile; public MyPlugin() { } public void destroy() { this.servlet = null; this.config = null; } public void init(ActionServlet servlet, ApplicationConfig config) throws ServletException { if (log.isTraceEnabled()) log.trace(Initializing module configuration); this.servlet = servlet; this.config = config; Digester digester = new Digester(); ... java.io.InputStream is = servlet.getServletContext().getResourceAsStream(configFile); try { digester.push(...); digester.parse(is); is.close(); } catch (IOException ioe) { log.fatal(IOException thrown while parsing config: + ioe.getMessage(), ioe); throw new UnavailableException(IOException thrown while parsing modules config); } catch (SAXException saxe) { log.fatal(SAXException thrown while parsing config: + saxe.getMessage(), saxe); throw new UnavailableException(SAXException thrown while parsing config); } ... servlet.getServletContext().setAttribute(myTopLevelBean, myTopLevelBean); if (log.isTraceEnabled()) log.trace(Finished initializing module configuration); } public java.lang.String getConfigFile() { return configFile; } public void setConfigFile(java.lang.String configFile) { if (log.isTraceEnabled()) log.trace(Setting configFile to + configFile); this.configFile = configFile; } } -- END MyPlugin Billy Ng wrote: Good idea! I won't go for hacking Struts either. By the way, I heard you guys talking about plugin so many times (I know, I am a slower learner). Any web site I can look at. I am very interested in learnig it. Billy Ng -- Eddie Bush -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Possible memory leak in Tomcat 4.1.10
Good pointer, I will do it. Thanks, Craig! Billy Ng - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 8:16 PM Subject: Re: Possible memory leak in Tomcat 4.1.10 What you observe is what I would expect to see on pretty much any container, on any JVM, if you are measuring memory allocated to the JVM process. The reason this happens is that the JVM expands its heap dynamically as necessary, but most JVMs are *not* programmed to return memory to the OS. Instead, the memory will be available in Java's heap, for the creation of new Java objects as needed. What you really want to check for, when looking for memory leaks, is repeated accesses to the same URLs. If memory goes up continuously, you probably have a leak. If not, you're probably OK. Doing just one or two requests tells you basically nothing useful. Craig On Tue, 10 Sep 2002, Billy Ng wrote: Date: Tue, 10 Sep 2002 18:53:08 -0700 From: Billy Ng [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Possible memory leak in Tomcat 4.1.10 Hi folks, I am trying to find what is causing the memory leak in my app. I changed to use the Tomcat 4.1.10. By only hitting the Tomcat's servlet and jsp exampes, the free memory is already going down and never back up. I heard the Tomcat 4.0.4 has memory leak problem, but I do not hear anything about the 4.1.10. I am wondering if anyone experienced the same problem before. If you are using any version of Tomcat that you feel it is stable, please let me know. Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Possible memory leak in Tomcat 4.1.10
Craig, I did it as you said. I ran the Hello World page on the Tomcat's Servlet Examples, then kept refreshing it. The free memory is continuously going down. I will report this to Tomcat team. Billy Ng. - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 8:16 PM Subject: Re: Possible memory leak in Tomcat 4.1.10 What you observe is what I would expect to see on pretty much any container, on any JVM, if you are measuring memory allocated to the JVM process. The reason this happens is that the JVM expands its heap dynamically as necessary, but most JVMs are *not* programmed to return memory to the OS. Instead, the memory will be available in Java's heap, for the creation of new Java objects as needed. What you really want to check for, when looking for memory leaks, is repeated accesses to the same URLs. If memory goes up continuously, you probably have a leak. If not, you're probably OK. Doing just one or two requests tells you basically nothing useful. Craig On Tue, 10 Sep 2002, Billy Ng wrote: Date: Tue, 10 Sep 2002 18:53:08 -0700 From: Billy Ng [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Possible memory leak in Tomcat 4.1.10 Hi folks, I am trying to find what is causing the memory leak in my app. I changed to use the Tomcat 4.1.10. By only hitting the Tomcat's servlet and jsp exampes, the free memory is already going down and never back up. I heard the Tomcat 4.0.4 has memory leak problem, but I do not hear anything about the 4.1.10. I am wondering if anyone experienced the same problem before. If you are using any version of Tomcat that you feel it is stable, please let me know. Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Servlte-level Resource Files
Hi folks, I don't know if anybody is doing this. I want to move the resoruces to the servlet level which means each servlet has its own resources instead of putting the entire app's subtitutes in ApplicationResources.properties. If you have the mechanism like this, would you please give me some points for how to do it. Thanks! Billy Ng
Possible memory leak in Tomcat 4.1.10
Hi folks, I am trying to find what is causing the memory leak in my app. I changed to use the Tomcat 4.1.10. By only hitting the Tomcat's servlet and jsp exampes, the free memory is already going down and never back up. I heard the Tomcat 4.0.4 has memory leak problem, but I do not hear anything about the 4.1.10. I am wondering if anyone experienced the same problem before. If you are using any version of Tomcat that you feel it is stable, please let me know. Thanks! Billy Ng
Re: Possible memory leak in Tomcat 4.1.10
I have already mailed to Tomcat mailing list before. I mailed here because there are some Struts users might experience this before. Sorry, I am using Linux and the top command. I just keep track on the free memory reading evey time I hit the servlet. Billy Ng - Original Message - From: Rosdi bin Kasim [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 6:46 PM Subject: Re: Possible memory leak in Tomcat 4.1.10 Probably it is better if you ask this in Tomcat mailing list. Btw, how do you know how much memory your tomcat is holding at a time?.. I would like to check it here too, I am running Tomcat on Win98 though... :-) - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 11, 2002 9:53 AM Subject: Possible memory leak in Tomcat 4.1.10 Hi folks, I am trying to find what is causing the memory leak in my app. I changed to use the Tomcat 4.1.10. By only hitting the Tomcat's servlet and jsp exampes, the free memory is already going down and never back up. I heard the Tomcat 4.0.4 has memory leak problem, but I do not hear anything about the 4.1.10. I am wondering if anyone experienced the same problem before. If you are using any version of Tomcat that you feel it is stable, please let me know. Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Detect errors in Action
thanks! I thought there was a method or a way to see the ActionError is not null or its length larger than 0 in the Action before the view with error displayed Billy Ng - Original Message - From: John Yu [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 04, 2002 6:39 PM Subject: Re: Detect errors in Action Billy, What do you mean by detecting any errors? Does this work for you: try { ... } catch(..) { // set things into the request // forward to the error page } At 07:37 am 05-09-2002, you wrote: Hi folks, Would anybody tell me if I can detect any errors occur in the Action? It is because i have some objects created in the Action. If there is error, I need to set the objects into the request becuase the view displayed. Thanks! Billy Ng -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610 Scioworks Camino - Don't develop Struts Apps without it! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Detect errors in Action
I did that. But the object I set in the Action before would be lost when the ActionForm's validate method find the errors and then return to the view. Billy Ng - Original Message - From: Dan Walker [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 04, 2002 5:59 PM Subject: RE: Detect errors in Action Maybe your Action should just forward to a different page if an error occurs. -Dan -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 04, 2002 6:38 PM To: Struts Users Mailing List Subject: Detect errors in Action Hi folks, Would anybody tell me if I can detect any errors occur in the Action? It is because i have some objects created in the Action. If there is error, I need to set the objects into the request becuase the view displayed. Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
The app freezes with plenty free memory
Hi folks, I thought my app was okay after I put more RAM and added the autoReconnect to JDBC url. It hangs again today. I look at the top and I find out that I still get much free memory. I restart the mySQL, but it still freezes. Finally, I have to restart Tomcat and the problem is gone. Does anyone have the same problem? Billy Ng
Re: Need help in struts-config.xml file
I ran into the same problem, but I brand it in the properties file and I have a URL object to pick it. So you just need to change it in one place if the app name is changed. Billy Ng - Original Message - From: Ashish Kulkarni [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 04, 2002 12:16 PM Subject: Need help in struts-config.xml file Hi,I am developing a web application using struts, my URL to the main page ishttp://localhost:8080/maps/pages/index.jspMy web application is maps, so if i have to define a action tag in struts-config.xml how can i do it.i have defined a action tag like below, action path=/pages/signout type=com.pfizer.maps.SignoutAction scope=request forward name=success path=/pages/signout.jsp redirect=true/ /action and i have in my selectenv.jsp javascript like this document.forms[0].action= '/pages/signout.do'; document.forms[0].submit(); but i when i call this javascript i get 404 error and the URL i get is http://pfizer-maps:8080/pages/signout.do so how can i make it work, i dont want to hardcode my application, as i may change the name in future = A$HI$H __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Not using JSP as the view
Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng
Re: Not using JSP as the view
ic, I thought the ActionForward had to be jsp file. Thanks a lot! Billy Ng - Original Message - From: Ted Husted [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, September 04, 2002 2:25 PM Subject: Re: Not using JSP as the view The Struts Action returns an ActoinForward object. The path property of determines which resource gets control. The resource can be anything, not just a JSP or Struts Action. So if you had a servlet that rendered XML, you could forward to that instead. The Expresso framework has a standard option for using XML/XLS with Struts. The Stxx extension also looks quite good. http://jakarta.apache.org/struts/resources/views.html Depending on what you need to do, another technique is to use the digester to convert XML to a JavaBean (if the XML is someplace where the Action can get it), and then pass that down to the JSP. There are also tags for doing XML/XLS conversions within the JSP. http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html -Ted. Billy Ng wrote: Hi folks, I am thinking to repsonse the XML instead of HTML. In Struts, how can I response to the browser without displaying the JSP as the view? Thanks! Billy Ng -- Ted Husted, Husted dot Com, Fairport NY US co-author, Java Web Development with Struts Order it today: http://husted.com/struts/book.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Detect errors in Action
Hi folks, Would anybody tell me if I can detect any errors occur in the Action? It is because i have some objects created in the Action. If there is error, I need to set the objects into the request becuase the view displayed. Thanks! Billy Ng
Re: Hanging Struts
Yes, I had the same problem before. I did the follwoing things to fix the problem: 1) add autoReconeet=true in the url like: data-sources data-source autoCommit=false description=My App Data driverClass=com.mysql.jdbc.Driver maxCount=4 minCount=2 user=myUser password=foobar url=jdbc:mysql://localhost:3306/myAppDB?autoReconnect=true/ /data-sources 2) I noticed the free memory was going down every time a user hit the site. Finally, I found there was memory leak that caused my app failed over time. One more thing, you may try the Connect/J mysql driver, it takes less memory. Hope this help! Billy Ng From: Alex McLintock [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hanging Struts Date: Tue, 03 Sep 2002 17:44:29 +0100 Hi folks, I have a simple Struts application which decides to hang and not serve pages after some time. It seems to be database related because the index pages which don't require the database still work, whereas the ones which require the database don't respond. The database appears to be still working since other things can access it fine. A restart of tomcat fixes the problem - but that of course is hardly a permanent solution. I am using a fairly recent version of struts, Tomcat 4.13b, a farily recent MySQL, RedHat 7.2, mm.jdbc driver, I see on this mailing list that other people have had problems with hanging if left overnight. I have tried to use a refresh setting in my struts-config.xml but that doesn;t seem to have cured the problem. Alex Openweb Analysts Ltd, London. Software For Complex Websites http://www.OWAL.co.uk/ Open Source Software Companies please register here http://www.OWAL.co.uk/oss_support/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: confusion about view part!!!
I am working on very large scale b2b portal containing Jsp pages which usus javascripts and style sheets in bulk. So, I am confused that view pages should be made directly using struts tag or it should be easy to make in html and then convert into struts. I am confused too. Since you have jsp pages, why do you bother to make them in html in Struts? You can simply forward whatever the jsp page (forward tag) that is registered in the struts-config.xml. In my company designers are not aware with struts so we are going to get html pages. do any one has idea that how difficult it is going to be if we converts html pages(with bulky javascript and stylesheets) into struts? You can mix servlet script, tags, and html in the jsp file. In the tags, e.g. html tag, you can set the style-sheet or javascript event attributes. It should not be hard. Also, designers are used to make pages using frames, so is there any problem using frames in struts or templates (or tiles) is better option? I have not used frames in my struts app. I don't know this. You can find what other people say in the mail archives. I heard lots of good things about Tiles. I am using template tags. I find it pretty handy. Please help me to sort out. Thanks in reading the mail. Amit Badheka. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
First time penatly
Hi folks, Everytime I start or restart the app, the user will experience the slowness becuase the jsp pages have to be compiled. Long time ago, I read a book saying there is a way to pre-compile the jsp files to avoid this first time penatly, but I can't make it work. Would anybody tell me how to do pre-compile, thanks! Billy Ng _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: senfing query strings in action forward
I don't know if this is the right way to handle this, but it works for me. ActionForward af = mapping.findForward(forward_name); af.setPath(path/user.jsp?user_id=100); return af; Also, I always like to call the Action instead of the calling the jsp file directly. This way, you can do some business logic before you load the page. so my version will be ActionForward af = mapping.findForward(forward_name); af.setPath(path/myAction.do?user_id=100); af.Redirect(true); return af; Billy Ng From: dmitry [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: senfing query strings in action forward Date: Thu, 29 Aug 2002 13:12:15 -0400 I'm trying to figure out how to forward success action to a jsp page with parameters. For example, I have a user.jsp page that shows user information, but it needs to be invoked with user_id parameter like this: user.jsp?user_id=100 When creating a new user, my action does all the db related stuff, generates a new user_id, now, the question is how do I pass it (new user_id) as a parameter to the success page. Can I attache something to the instance of ActionForward that is being returned from execute method. It's essential that I could pass the parameters in the url rather then in session so that the user can book mark the page. And besides that, I already have a user.jsp page and really want to reuse it. If I'm missing something conceptually, please advide the better way of doing things like that. Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: First time penatly
Thanks, Karr! I am using Tomcat. I find the jspc.bat in TOMCAT_HOME/bin directory. Couple more questions, 1) after I pre-compile the jsp files, should I put them in the TOMCAT_HOME/work/ directory or in the TOMCAT_HOME/webapps/myApp/WEB-INF/classes/ directory. 2) should I put the package declaration in the jsp files? Billy Ng - Original Message - From: Karr, David [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 29, 2002 10:36 AM Subject: RE: First time penatly -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 9:40 AM To: [EMAIL PROTECTED] Subject: First time penatly Hi folks, Everytime I start or restart the app, the user will experience the slowness becuase the jsp pages have to be compiled. Long time ago, I read a book saying there is a way to pre-compile the jsp files to avoid this first time penatly, but I can't make it work. Would anybody tell me how to do pre-compile, thanks! This has nothing to do with Struts. This is a web container issue. Read your web container docs. In short, there are two basic ways to do this: Write a single servlet that nudges the web container to compile all of your JSP pages. I believe several web containers already provide a feature to do this, including Tomcat. Alternatively, all web containers have a command-line class, often called something like JspC, which will generate the servlet source code from the JSP pages. After you generate the servlet source code, you have to use the java compiler to compile them, and you'll also most likely have to insert servlet and servlet-mapping elements in your web.xml file for each one of those generated servlets. The tradeoff between these two strategies is that the first one is often much easier (if the web container provides the servlet), but the second one provides for a more robust build process, as you'll see more possible errors in your build, as opposed to after it's deployed. On the other hand, the second strategy causes you to deploy a war file that is web-container specific. The JspC class in some containers also compile the generated servlet at the same time. Some of these web containers may either generate the web.xml fragment that needs to be inserted, or modify the web.xml directly with the updated mappings. Look for features like these in your web container docs and experiment. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: html:options tag help ASAP
Open the struts-exercise-taglib/html-select.jsp, there are 2 examples to show you how to use Collection to deal with html:option Billy Ng From: Ashish Kulkarni [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: html:options tag help ASAP Date: Thu, 29 Aug 2002 15:28:42 -0700 (PDT) Hi, I get a result set from a query which has id and description, now I have to show the it in select tag some thing like this, select name=option option value=id1desc1/option option value=id2desc2/option /select I think that i can use html:options tag which will do my work, but i m not sure how to use it, how do to define the bean, and also how to set the properties, does anyone have sample code of the bean and the tag for that bean options tag, it will help me alot.. Thanx Ashish A$HI$H - Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Memery Leak
Hi folks, I am using Tomcat 4.0.3, Struts 1.0.2, and Debian Linux 2.2.19. I notice the size of the free memory is going down everytime there is a user hitting my app. It will never go back up. Anybody having the same problem? Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Memery Leak
I am a beginner here. Would you please tell me how to ensure the tags/servlets are garbage collected correctly, thanks! Thanks! Billy Ng - Original Message - From: Martin Samm [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 1:53 AM Subject: RE: Memery Leak have you tried profiling your application? It could be objects not be garbage collected. Check your tags/servlets to ensure they are garbage collecting correctly. -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: 28 August 2002 09:50 To: [EMAIL PROTECTED] Subject: Memery Leak Hi folks, I am using Tomcat 4.0.3, Struts 1.0.2, and Debian Linux 2.2.19. I notice the size of the free memory is going down everytime there is a user hitting my app. It will never go back up. Anybody having the same problem? Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Memery Leak
I don't know. Yes, the memory usage is getting higher and higher. Billy Ng - Original Message - From: Cliff Rowley [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 2:15 AM Subject: RE: Memery Leak Could it be the old javac memory leak bug? Does memory usage get progressively bigger? The bug is fixed in JDK 1.4.1-beta, but it's not a recommended upgrade yet as there are other bugs in it. On Wed, 2002-08-28 at 09:53, Martin Samm wrote: have you tried profiling your application? It could be objects not be garbage collected. Check your tags/servlets to ensure they are garbage collecting correctly. -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: 28 August 2002 09:50 To: [EMAIL PROTECTED] Subject: Memery Leak Hi folks, I am using Tomcat 4.0.3, Struts 1.0.2, and Debian Linux 2.2.19. I notice the size of the free memory is going down everytime there is a user hitting my app. It will never go back up. Anybody having the same problem? Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Regards --- Cliff Rowley| [EMAIL PROTECTED] Software Engineer | www.doctype.co.uk +44 (0) 1206 514263 | www.cliffrowley.com --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Memery Leak
So you think it's not from Struts? I would not think so either. Otherwise, there must be many people complaining about it. Do you mean to use OptimizeIt to check it? By the way, I have a Account Manager object in the session. If user click on the Log out, it will remove the object form the session. What about the user exit the program without click on Log Out. Will the object being holding in the session forever? How should I hamdle this? Thanks! Billy Ng - Original Message - From: Cliff Rowley [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 10:59 AM Subject: Re: Memery Leak Ok, then it's possibly not that. I should check your code, as suggested use a profiler - which will give you an indication as to what is causing the leak. On Wed, 2002-08-28 at 19:09, Billy Ng wrote: I don't know. Yes, the memory usage is getting higher and higher. Billy Ng - Original Message - From: Cliff Rowley [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 2:15 AM Subject: RE: Memery Leak Could it be the old javac memory leak bug? Does memory usage get progressively bigger? The bug is fixed in JDK 1.4.1-beta, but it's not a recommended upgrade yet as there are other bugs in it. On Wed, 2002-08-28 at 09:53, Martin Samm wrote: have you tried profiling your application? It could be objects not be garbage collected. Check your tags/servlets to ensure they are garbage collecting correctly. -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: 28 August 2002 09:50 To: [EMAIL PROTECTED] Subject: Memery Leak Hi folks, I am using Tomcat 4.0.3, Struts 1.0.2, and Debian Linux 2.2.19. I notice the size of the free memory is going down everytime there is a user hitting my app. It will never go back up. Anybody having the same problem? Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Regards --- Cliff Rowley| [EMAIL PROTECTED] Software Engineer | www.doctype.co.uk +44 (0) 1206 514263 | www.cliffrowley.com --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Regards --- Cliff Rowley| [EMAIL PROTECTED] Software Engineer | www.doctype.co.uk +44 (0) 1206 514263 | www.cliffrowley.com --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Run out of Memeory
I am using Tomcat 4.0.3, Struts 1.0.2, and Debian Linux 2.2.19. I think I have memory leak in my app. I notice the size of the free memory is going down everytime there is a user hitting it. The size of free memory will never went back up. Adding more memory only delays the app to fail. Billy Ng - Original Message - From: Donald Ball [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 7:15 AM Subject: RE: Run out of Memeory On 8/27/2002 at 4:48 PM Billy Ng wrote: I should say the app is hung silently. It won't do anything when I click on any links or submit buttons. So I shutdown the tomcat and startup again, but it will say java.net.BindException: Address already in use... something like that. I need to kill the java process manually and startup again. When I look at the tomcat log, it has no expection logged. Do you think it is the memory issue? Dunno, try increasing the amount of memory available to your JVM (-Xmx128m?) and see if the problem goes away. To me, it sounds suspiciously like the struts hanging problem I reported yesterday. Are you using struts-1.1b2? Once your webapp has hung processing a request, can you still hit other URLs that it serves or is the whole thing frozen? - donald -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Memery Leak
Good info. I like to use static for those frequently acesss objects. I think I need to revisit them. Very high chance it leaks from there. Thanks! Billy Ng - Original Message - From: Michael Lee [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 1:04 PM Subject: Re: Memery Leak Dude, just do this... on the command line where you run java . com.yourstuff.YourClass add this parameter -Xrunhprof:file=java.hprof.txt,heap=all,format=a,doe=y Look at the end of the file. It will have all the objects allocated/deallocated. Run your program for a while. Look for the objects that get allocated but NEVER deallocated. These are many times static objects like singletons and such that don't clean up well. enjoy, Michael Lee Architect Afterbot [EMAIL PROTECTED] - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 2:38 PM Subject: Re: Memery Leak So you think it's not from Struts? I would not think so either. Otherwise, there must be many people complaining about it. Do you mean to use OptimizeIt to check it? By the way, I have a Account Manager object in the session. If user click on the Log out, it will remove the object form the session. What about the user exit the program without click on Log Out. Will the object being holding in the session forever? How should I hamdle this? Thanks! Billy Ng - Original Message - From: Cliff Rowley [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 10:59 AM Subject: Re: Memery Leak Ok, then it's possibly not that. I should check your code, as suggested use a profiler - which will give you an indication as to what is causing the leak. On Wed, 2002-08-28 at 19:09, Billy Ng wrote: I don't know. Yes, the memory usage is getting higher and higher. Billy Ng - Original Message - From: Cliff Rowley [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, August 28, 2002 2:15 AM Subject: RE: Memery Leak Could it be the old javac memory leak bug? Does memory usage get progressively bigger? The bug is fixed in JDK 1.4.1-beta, but it's not a recommended upgrade yet as there are other bugs in it. On Wed, 2002-08-28 at 09:53, Martin Samm wrote: have you tried profiling your application? It could be objects not be garbage collected. Check your tags/servlets to ensure they are garbage collecting correctly. -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: 28 August 2002 09:50 To: [EMAIL PROTECTED] Subject: Memery Leak Hi folks, I am using Tomcat 4.0.3, Struts 1.0.2, and Debian Linux 2.2.19. I notice the size of the free memory is going down everytime there is a user hitting my app. It will never go back up. Anybody having the same problem? Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Regards --- Cliff Rowley| [EMAIL PROTECTED] Software Engineer | www.doctype.co.uk +44 (0) 1206 514263 | www.cliffrowley.com --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Regards --- Cliff Rowley| [EMAIL PROTECTED] Software Engineer | www.doctype.co.uk +44 (0) 1206 514263 | www.cliffrowley.com --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Memory Leak
Thanks everybody! I found where my app caused the memory leaks already. Somebody is right (sorry, I forget your name)! It is from a singleton call. I will be very careful for the static calls next time. This mailing lists is great! Thanks! Billy Ng _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Run out of Memeory
Hi folks, I have a Linux box that has only 64MB for the beta testing of my Struts app. The app died silently after a while. I believe it runs out of memory. Would anybody tell me how much the RAM I should put? Thanks! Billy Ng _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Run out of Memeory
I should say the app is hung silently. It won't do anything when I click on any links or submit buttons. So I shutdown the tomcat and startup again, but it will say java.net.BindException: Address already in use... something like that. I need to kill the java process manually and startup again. When I look at the tomcat log, it has no expection logged. Do you think it is the memory issue? Billy Ng Considering that the JVM tries to grab ~40 MB of memory as soon as it initializes, I'm not surprised. If you run your Linux box without a windowing system (no KDE or Gnome), you might be able to limp along with 64 MB. I'd recommend doubling that amount though. If you're running a windowing system, you might be able to survive on 128 but it will be painful every time the JVM comes up--I'd recommend 256+. b.t.w., no process ever dies 'silently' in Linux. First, the JVM will issue out-of-memory errors if it runs out of space in the heap and can get no more memory from the OS. Second, you can get a thread dump in Linux from any console, I believe the command is Ctrl - \ (control and backslash keys at same time) -- this should tell you if an out-of-memory error terminated the application. Finally, you can use the Linux command 'top' to see how much memory an app. is grabbing while its running. Their are numerous other text-based and GUI tools for doing the same in Linux, search the web. Note that any of these tools will also consume memory, the ol' Heisenberg principle manifesting itself. :) hope this helps, Joe Barefoot -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 27, 2002 4:10 PM To: [EMAIL PROTECTED] Subject: Run out of Memeory Hi folks, I have a Linux box that has only 64MB for the beta testing of my Struts app. The app died silently after a while. I believe it runs out of memory. Would anybody tell me how much the RAM I should put? Thanks! Billy Ng _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: connecting to a database
I am new to Struts. I don't know if your syntax is right or not. However, some other users used my way and it works. You may read this http://nagoya.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]msgId=432989 Billy Ng From: Jim Conrad [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: connecting to a database Date: Tue, 27 Aug 2002 15:40:27 -0600 I am having trouble when I include the data-source entry in my struts-config.xml. It looks as follows (slightly changed to protect the innocent): data-sources data-source set-property property=key value=my_db/ set-property property=type value=org.apache.struts.util.GenericDataSource/ set-property property=autoCommit value=true/ set-property property=description value=My db description/ set-property property=driverClass value=oracle.jdbc.driver.OracleDriver/ set-property property=loginTimeout value=10/ set-property property=maxCount value=4/ set-property property=minCount value=2/ set-property property=password value=xx/ set-property property=readOnly value=false/ set-property property=url value=jdbc:oracle:thin:@my_ip_address:1521:mySchema/ set-property property=user value=my_user/ /data-source /data-sources When I leave this in my struts-config.xml I get the following error during startup of Tomcat: ... ... Pop org.apache.struts.util.GenericDataSource New org.apache.struts.action.ActionFormBean Set org.apache.struts.action.ActionFormBean properties Call org.apache.struts.action.ActionServlet.addFormBean(ActionFormBean[brickForm ]) Pop org.apache.struts.action.ActionFormBean New org.apache.struts.action.ActionMapping Set org.apache.struts.action.ActionMapping properties Call org.apache.struts.action.ActionServlet.addMapping(ActionMapping[path=/brick Form, type=com.budget.controller.BrickFormAction]) Pop org.apache.struts.action.ActionMapping cannot load servlet name: action the problem Add ValidatorAction: required,com.wintecinc.struts.validation.StrutsValidator Add ValidatorAction: integer,com.wintecinc.struts.validation.StrutsValidator Add ValidatorAction: range,com.wintecinc.struts.validation.StrutsValidator ... ... My data source initializes correctly, but then comes the error cannot load servlet name: action. Without the data source in struts-config.xml this error does not appear, and my pages work (except for having access to the database). If I can't connect to my database I can't build my site using Struts. Obviously it is possible to access a database using Struts. What am I doing wrong? Where is my error in struts-config.xml? Using: Java 1.3.1 Tomcat 3.2.1 Struts 1.0.2 Thanks! _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem with Proxy Pass
Thanks Adrain! I'm interested in learning how to work around with properties lookup. Please shoot me the info. Thanks again! Billy Ng - Original Message - From: Adrian Brown [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, August 20, 2002 7:51 PM Subject: Re: Problem with Proxy Pass Hi Billy, This might not be optimal for you, but try altering the org.apache.struts.taglib.html.BaseTag to generate the altered server name, this is one way to get it to work. You might want to control it using a properties lookup of some sort. If you want more details, let me know. Adrian --- Billy Ng [EMAIL PROTECTED] wrote: Hi folks, I use the proxy pass in Apache to translate the url from http://www.myDomian.com:8080/myApp to http://www.myDomian.com In the html:form tag, it looks like, html:form action=/logon.do method=POST ... However, you will notice Struts will add the app name in the action path if you view the html form action=/myApp/logon.do method=POST ... This will break the url. Would anybody please me how can tell Struts not to add the app name? Thanks! Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] http://digital.yahoo.com.au - Yahoo! Digital How To - Get the best out of your PC! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem with Proxy Pass
I also notice another Proxy Pass problem. Apache will pass the request to the internal ip like ProxyPass /myApp /192.168.0.8:8080/myApp If I call reuqest.getContextPath(), it will return 192.168.0.8:8080. I can't see the server name which I defines in the virtual host. Any remedy? Thanks! Billy Ng From: Adrian Brown [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Problem with Proxy Pass Date: Wed, 21 Aug 2002 12:51:47 +1000 (EST) Hi Billy, This might not be optimal for you, but try altering the org.apache.struts.taglib.html.BaseTag to generate the altered server name, this is one way to get it to work. You might want to control it using a properties lookup of some sort. If you want more details, let me know. Adrian --- Billy Ng [EMAIL PROTECTED] wrote: Hi folks, I use the proxy pass in Apache to translate the url from http://www.myDomian.com:8080/myApp to http://www.myDomian.com In the html:form tag, it looks like, html:form action=/logon.do method=POST ... However, you will notice Struts will add the app name in the action path if you view the html form action=/myApp/logon.do method=POST ... This will break the url. Would anybody please me how can tell Struts not to add the app name? Thanks! Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] http://digital.yahoo.com.au - Yahoo! Digital How To - Get the best out of your PC! -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Problem with Proxy Pass
Hi folks, I use the proxy pass in Apache to translate the url from http://www.myDomian.com:8080/myApp to http://www.myDomian.com In the html:form tag, it looks like, html:form action=/logon.do method=POST ... However, you will notice Struts will add the app name in the action path if you view the html form action=/myApp/logon.do method=POST ... This will break the url. Would anybody please me how can tell Struts not to add the app name? Thanks! Billy Ng _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
error handling in jsp
Hi folks, I am using struts-template.tld to generate the pages. For example, %@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' % template:insert template='/main_template.jsp' template:put name='head' content='/templates/head.jsp' template:put name='content' content='/content.jsp' template:put name='footer' content='/templates/footer.jsp' template:insert/ When any exception is thrown in the content.jsp, the page will display with header only. I want to display the error_content.jsp if any eception is thrown in content.jsp is caught. Would anybody please share how you handle this, thanks! Billy Ng _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Unable to return error to jsp page
Would you please tell me how did you get the errors in the Action? Is there a method to call? Thanks! Billy Ng From: Martin Cooper [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: Unable to return error to jsp page Date: Wed, 14 Aug 2002 16:05:23 -0700 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 1:50 PM To: [EMAIL PROTECTED] Subject: Unable to return error to jsp page Hi, I'm stuck... getting an error when the controller servlet is trying to return my error to the jsp which issued the request. The controller did successfully hand off to your JSP page - it was the execution of the page that failed. It looks like your page needs a bean (poInfoList) in request scope to populate it, and you didn't create/store that in your action. -- Martin Cooper I am returning the error directly from my Action servlet: System.out.println(Saving errors...); saveErrors(request,errors); System.out.println(Returning to: + mapping.getInput()); return new ActionForward(mapping.getInput()); My action mapping: action path=/viewPODocument type=com.canopyint.app.rsvp.actions.PODocumentViewAction input=/listPOInfo.jsp name=poDocumentForm scope=request forward name=success path=/PODocumentView/ /action Form beans: form-beans form-bean name=userProfileForm type =com.canopyint.app.rsvp.entity.UserProfile/ form-bean name=poDocumentForm type =com.canopyint.app.rsvp.entity.PODocument/ form-bean name=poInfoListForm type =com.canopyint.app.rsvp.entity.POInfo/ /form-beans Error message: javax.servlet.jsp.JspException: Cannot find bean poInfoList in scope request at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag .java:149) at org.apache.jsp._0002flistPOInfo_jsp._jspService (_0002flistPOInfo_jsp.java:112) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service (JspServlet.java:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet .java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:458) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(Applicat ionDispatcher.java:679) at org.apache.catalina.core.ApplicationDispatcher.doForward(Appli cationDispatcher.java:431) at org.apache.catalina.core.ApplicationDispatcher.forward(Applica tionDispatcher.java:355) at org.apache.struts.action.ActionServlet.processActionForward(Ac tionServlet.java:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.j ava:1595) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) Thanks for your help. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
exception handling in jsp
Hi folks, Would you anybody tell me what is the simplest way to catch the exception is thrown in the jsp file so that I can display a error page. Thanks! Billy Ng _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: App will hang if it runs over night
The problem is totally gone after I added the autoReconnect parameter in the mysql's url. Here is the example data-sources data-source autoCommit=false description=Example Data driverClass=org.gjt.mm.mysql.Driver maxCount=4 minCount=2 user=ie password=foobar url=jdbc:mysql://localhost:3306/ieDB?autoReconnect=true/ /data-sources Billy Ng From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: App will hang if it runs over night Date: Fri, 9 Aug 2002 09:28:29 -0400 Hey, I am having the same problem and tried the same solution to no effect. I've upgraded to the newest stable release of MM.Mysql and that did not help. I am fairly confident that it is a connection timing out, but the autoReconnect has not helped at all. I put the autoreconnect in a set-property property=autoReconnect value=true/ After awhile, I get a communications link failure... -Original Message- From: janof [mailto:[EMAIL PROTECTED]] Sent: Friday, August 09, 2002 8:05 AM To: struts-user Cc: Stephen.Chambers; nuil Subject: Re: App will hang if it runs over night Billy, Edwin, Steve or anybody else: Where do I put this parameter (autoReconnect) in struts-config.xml ? Can you give me an example ? It doesn't seem to work for me. Thanks. Jano Billy Ng wrote: Thanks! Billy Ng From: E.M. van Nuil [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: App will hang if it runs over night Date: Wed, 07 Aug 2002 15:48:27 +0200 Thanks, This seems to be the solution to my problem. I just looked at the site of the mm.mysql driver and the author writes : MySQL closes connections after idle times. Your connection pool needs to refresh connections, or (with a performance penalty), you can add autoReconnect=true to your JDBC URL. This is covered in the documentation with the latest driver versions. Is there a way to refresh connections in the connection pool of struts ?? I'll just use the autoReconnect for now. Edwin [EMAIL PROTECTED] wrote: I had this before. You need to set autoReconnect=true within your connection url for the mysql driver. Do a google to do a search on the exact syntax or you can look on the mysql site. Steve E.M. van NuilTo: Struts Users Mailing List [EMAIL PROTECTED] nuil@oblivion cc: .nl Subject: Re: App will hang if it runs over night 08/07/2002 08:13 AM Please respond to Struts Users Mailing List This looks like the same problem I'm having. I posted this a few days ago, but still no response. I mailed Craig my trace dumps and he is looking at the problem. But I hadn't thought the problem was with the MySQL driver but with my beans. Can you give some more info ? Edwin Billy Ng wrote: My app will be unable to access the mysql database if I leave it on over night. I cannot even shut Struts down when this happens. Did anybody experience this before? Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: redirect
I ddi try this forward name=action2 path=/action2.do redirect=true / in the struts-config.xml, it will hit the Action2's perform(). However, how can I put the query string in the path? Thanks in advance! Billy Ng - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, July 26, 2002 10:40 AM Subject: Re: redirect Sorry, I am a new Struts user and slow. I need to hit the Action2's perform() from Action1's perform() to have further business logic to do. Also, I will have query string in the url. If I only put the redirect='true' in the ?forward tag, it won't do the work. Would you please tell me how to do it, thanks! Billy Ng - Original Message - From: Erich Meier [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 26, 2002 3:01 AM Subject: Re: redirect On Fri, Jul 26, 2002 at 11:07:14AM +0800, Tuck Wai wrote: Hi, ActionForward newAF=new ActionForward(the url you will to redirect);//for example 'yourAction.do?action=first' newAF.setRedirect(true); return newAF This won't work with the upcoming struts 1.1 release. You should better use the redirect='true' attribute of the action statement in the struts-config.xml. Erich - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 26, 2002 10:10 AM Subject: redirect This question may have asked so many time. Would anybody tell me how to do redirect. If I have 2 Action objects, The Action1 finsihes the business logic and want to rediect to Action2 to display the jsp page. How can I do it? Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Dr. Erich Meier, Software Process Improvement method park Software AG, Wetterkreuz 19a, 91058 Erlangen, Germany Tel. +49-9131-97206-316 mailto:[EMAIL PROTECTED] Fax. +49-9131-97206-200 http://www.methodpark.de/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: redirect
Sorry, I am a new Struts user and slow. I need to hit the Action2's perform() from Action1's perform() to have further business logic to do. Also, I will have query string in the url. If I only put the redirect='true' in the ?forward tag, it won't do the work. Would you please tell me how to do it, thanks! Billy Ng - Original Message - From: Erich Meier [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 26, 2002 3:01 AM Subject: Re: redirect On Fri, Jul 26, 2002 at 11:07:14AM +0800, Tuck Wai wrote: Hi, ActionForward newAF=new ActionForward(the url you will to redirect);//for example 'yourAction.do?action=first' newAF.setRedirect(true); return newAF This won't work with the upcoming struts 1.1 release. You should better use the redirect='true' attribute of the action statement in the struts-config.xml. Erich - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, July 26, 2002 10:10 AM Subject: redirect This question may have asked so many time. Would anybody tell me how to do redirect. If I have 2 Action objects, The Action1 finsihes the business logic and want to rediect to Action2 to display the jsp page. How can I do it? Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Dr. Erich Meier, Software Process Improvement method park Software AG, Wetterkreuz 19a, 91058 Erlangen, Germany Tel. +49-9131-97206-316 mailto:[EMAIL PROTECTED] Fax. +49-9131-97206-200 http://www.methodpark.de/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Define Pre-selected items in html:select
I have tried so many different ways to pre-selected multiple items in the html:select tag, but no luck. Would any body please tell me how to do it, thanks! Billy
Re: Define Pre-selected items in html:select
Hey, Martin! You've saved my life, thanks a million! Billy Ng - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, July 22, 2002 2:49 PM Subject: RE: Define Pre-selected items in html:select As long as you don't specify the 'value' attribute, and do specify the 'multiple' attribute, the tag will pick up the array of values from your name+property, and use those values to preselect the corresponding options. -- Martin Cooper -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 2:49 PM To: Struts Users Mailing List Subject: Define Pre-selected items in html:select I have tried so many different ways to pre-selected multiple items in the html:select tag, but no luck. Would any body please tell me how to do it, thanks! Billy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
multiple selected values
I have a html:select that enabled multiple attribute. html:select property=collectionSelect size=10 multiple=true html:options collection=classOptions property=value labelProperty=label/ /html:select I know I can use the html:select's value attribute to mark a pre-selected item. But if I have more than 1 item to be selected, what variable should I pass to the value attribute? Thanks in advance! Billy Ng
[off topic] how to define array to jsp
I have a array that needs to pass from the Action page to jsp. e.g. Agent[] agents = getAgents(); session.setAttibute(agents, agent); In jsp, I try to do this, but it doesn't work jsp:useBean id=agents scope=session class=[com.myApp.Agent / Would anybody please tell how to define the array object in jsp, thanks! Billt Ng
how to render query string in html:link
Hi folks, Would anybody please provide me some sample code for how to make a link with multiple parameters in the href's url with using html:link tag. Thanks in advance! Billy Ng _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: how to render query string in html:link
It is because I need get the parameter data from a bean. I have tried something like: html:link page=blah.do?param1=%= bean.getFirstArg() %param2=%= bean.getSecondArg() %/ but it won't work. Some said I need to use the param* attributes. I know it is easy for 1 parameter, but I don't know how to use it with multiple parameters. Billy Ng From: Kamholz, Keith (corp-staff) USX [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: how to render query string in html:link Date: Fri, 5 Jul 2002 12:41:54 -0400 Hey, Why don't you just use the regular html synatx? html:link page=blah.do?param1=firstparam2=second/ ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Friday, July 05, 2002 12:36 PM To: [EMAIL PROTECTED] Subject: how to render query string in html:link Hi folks, Would anybody please provide me some sample code for how to make a link with multiple parameters in the href's url with using html:link tag. Thanks in advance! Billy Ng _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
query string
I try to use the html:link tag html:link page=/products.do%= product.getProductID() %Product 1/html:link to render the link like a href=/myWebapp/products.do?id=1Product 1/a However, it becomes a href=/myWebapp/products.do?%= product.getProduct() %Product 1/a What did I do wrong? What is the right way to put the query string to html:link tag? Thanks! Billy Ng _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: html:img ... problem!
You may try href attribute instead of page Billy Ng From: Struts Newsgroup (@Basebeans.com) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: html:img ... problem! Date: Fri, 21 Jun 2002 16:10:01 -0700 Subject: html:img ... problem! From: Jack Gao [EMAIL PROTECTED] === Hi, There I have a question about html:img tag. I use html:img page=/images/mainlogo.gif align=left border=0/ to show the logo in my page. But the problem is: sometimes, when I first time to open the page, the logo doesn't show, because it's append something like: ;jsessionid=DC41A.. follow the image file name in the url. Anybody have idea how this happen? and how to resolve it? Thanks Jack -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Why Tiles?
Sorry for my ignorance! Since Struts has the struts-template.tld, why Tiles? Billy Ng From: Trieu, Danny [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: Why Tiles? Date: Mon, 24 Jun 2002 10:20:50 -0700 Yeah, my name was on that article...:) -Original Message- From: Arik Levin ( Tikal ) [SMTP:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 12:03 AM To: 'Struts Users Mailing List' Subject:RE: Why Tiles? There's a good article about UI design. I think you'll get the answer there. (I did). http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html -Original Message- From: Trieu, Danny [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 9:56 PM To: 'Struts Users Mailing List' Subject: RE: Why Tiles? Yeah, may be that is it. But I need to something to compare against Tiles. -Original Message- From: Ted Husted [SMTP:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 8:53 AM To: Struts Users Mailing List Subject: Re: Why Tiles? Why not Tiles? Trieu, Danny wrote: Does any body know what other framework available out there that does what Tiles does? My boss wanna find a framework that help you do the ViewComposition part, and works well with Struts. And the only one that I came up with is 'Tiles'. danny -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ted Husted, Husted dot Com, Fairport NY US -- Java Web Development with Struts -- Tel: +1 585 737-3463 -- Web: http://husted.com/about/services -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: debug
Never mind. I find it in the catalina.out Thanks! Billy Ng - Original Message - From: Billy Ng [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, June 21, 2002 10:08 PM Subject: Re: debug How come I do not see the System.out result print to the xterm? How do you do it? Billy Ng - Original Message - From: Andrew Hill [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, June 21, 2002 9:57 PM Subject: RE: debug Hehe, Im still just using System.out and watching the Tomcat window! -Original Message- From: Billy Ng [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 22, 2002 10:17 To: Struts Users Mailing List Subject: debug Would anybody share with me how you debug the program? I am using simply emacs. Is the getServlet.log() my only choice if I just want to do something equivalent to System.out.print()? Thanks! Billy Ng -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
url object
I want cetntralize all the urls that will provided by one object so that I don't need to either to remember the urls by heart or I don't have to go to every views to make changes if I have change the paths. Please share with me if you are doing something like this in Struts. Thanks in advance! Billy Ng
debug
Would anybody share with me how you debug the program? I am using simply emacs. Is the getServlet.log() my only choice if I just want to do something equivalent to System.out.print()? Thanks! Billy Ng