RE: How do I handle (ignore) multiple submits from one client?
Hi, I did search the archive before I submitted my question. I used your suggested search string (minus typo g), which did turn up two threads I hadn't run across (thanks!), however, neither of them seemed to fit my particular problem. However, I have been able to get an approach to work (having a busy flag on the session), I was confused about the fact that I was seeing Connection reset by peer: socket write error exceptions in the Servlet console window...but then I realized they would be expected under the circumstances. Thanks for your help. -Chris -Original Message- From: Developer [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 7:44 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: How do I handle (ignore) multiple submits from one client? Hi Chris, That's been discussed on this list many times, I have not paid much attention to it but I know it can be found in the archives at http://www.mail-archive.com/struts-user%40jakarta.apache.org/. There you can do a search on miltiple submits. Please post the thread that was most helpful to you in solving your problem. Thank you. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How do I handle (ignore) multiple submits from one client?
Hi, My web app is a single form where a user can move about an image. Zoom in, zoom out, etc. However, a user can just sit there and click the Zoom In button very fast, not giving my application enough time to handle the first request etc.. (no click buffer g) The bottle-neck is a SOAP service that's actually generating the image. It'll generate an exception Object already in use. What I'd like to be able to do is to ignore the latter requests without throwing an exception...I am able to trap the exception then ignore it, but I was wondering if there was a more elegant approach. I've attempted to use the generateToken/saveToken methods, but as everything is handled in one Action and one Page, it doesn't seem like the right approach. I've tried using a busy token in the session, checking for it's existence before continuing, setting and releasing it in the body, but that doesn't seem to be doing the trick either. This seems like it would be a common problem...what solutions are there? Thanks. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to finalize a custom connection object?
Hi, One of my WebApp pages needs to make a connection to a remote SOAP service that uses a String token to identify unique sessions. When a user reaches that page, my init action acquires a String token for the SOAP session (via another SOAP object call), and when the user leaves the page (via buttons/links on the page) I can release the token, allowing the remote resource to return to it's pool. If a user leaves my web app some other way (address bar, favorites link etc..) I don't know they've left until the Tomcat/Struts session timeout. My problem is that I need to find someway to always know when the user is done with that page as soon as possible (I have no problem waiting for the session to timeout) so that I can release the remote resource. I've tried implementing the finalize method on my connection object (so that once it goes out of scope, the remote resource is relinquished), however, from what I've read, this is not a guaranteed mechanism like a destructor in C++ or Delphi, and in my simple tests it doesn't seem to have been called at all. Is there someway in Java/Servlets/Struts to have a method called when an object is available for the Garbage Collector? Or some event for when a session timesout? Or some other way I can make sure a method is called on my connection object just before the object is destroyed? This seems more like a basic Java question, rather than a Struts question, but I've not been able to find anything in the searches I've performed so far, and as my object runs within the context of Struts I was hoping that there might be an answer here. Note: I'm not trying to delete or free local objects here, I'm dealing with a remote resource that needs to receive an event telling it I'm done... Thanks. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to finalize a custom connection object?
Hi Kenneth, The SOAP service maintains the state of the object I'm interacting with. It maintains a pool of the objects, but dedicates an object once it's in use. I don't have a persistent/stateful SOAP session, it's the handle I get, and use with all subsequent calls, that makes sure I'm dealing with the same resource on the remote server. It's not the SOAP session that I've acquired, so much as a handle to an object being managed by the remote SOAP service. When the user is done with my page, I need a way to tell the remote SOAP service that it can return the object back to the pool. Problem is, I don't see a way to handle the loss of the HTTPSesion object. Am I making better sense? -Chris -Original Message- From: Kenneth Stout [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 6:52 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: How to finalize a custom connection object? Chris, Why are you holding onto the SOAP service? If I understand your explanation correctly you get a request from a user, obtain a SOAP session, obtain information via SOAP, send the response back; then wait for the user to go somewhere else before you release the SOAP session. Why not release the SOAP session just prior to sending the response back? If you are worried about performance having to open/close a SOAP session for multiple accesses to this page in your application you may what to think about creating a pool of SOAP sessions and hold a small number of SOAP sessions open for longer periods of time. The pool could then handle the opening and closing of SOAP sessions as needed. Having a small number of SOAP sessions always open may provide a performance improvement for your site as well. Overall that may prove to be a better utilization of the SOAP server in the long run. Kenneth. - Original Message - From: Chris Means [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 24, 2002 3:34 PM Subject: How to finalize a custom connection object? Hi, One of my WebApp pages needs to make a connection to a remote SOAP service that uses a String token to identify unique sessions. When a user reaches that page, my init action acquires a String token for the SOAP session (via another SOAP object call), and when the user leaves the page (via buttons/links on the page) I can release the token, allowing the remote resource to return to it's pool. If a user leaves my web app some other way (address bar, favorites link etc..) I don't know they've left until the Tomcat/Struts session timeout. My problem is that I need to find someway to always know when the user is done with that page as soon as possible (I have no problem waiting for the session to timeout) so that I can release the remote resource. I've tried implementing the finalize method on my connection object (so that once it goes out of scope, the remote resource is relinquished), however, from what I've read, this is not a guaranteed mechanism like a destructor in C++ or Delphi, and in my simple tests it doesn't seem to have been called at all. Is there someway in Java/Servlets/Struts to have a method called when an object is available for the Garbage Collector? Or some event for when a session timesout? Or some other way I can make sure a method is called on my connection object just before the object is destroyed? This seems more like a basic Java question, rather than a Struts question, but I've not been able to find anything in the searches I've performed so far, and as my object runs within the context of Struts I was hoping that there might be an answer here. Note: I'm not trying to delete or free local objects here, I'm dealing with a remote resource that needs to receive an event telling it I'm done... Thanks. -Chris -- 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: How to finalize a custom connection object?
Kenneth, That make a lot more sense. Thanks. Good. The only way I can think of to determine when a user moves on to another site, or closes the browser, would be to have your page create a persistent connection to you. Once the user moves on, the connection would be broken. I'm not aware of any way to force the browsers to keep the connection alive, so you would have to look at JavaScript and/or Applets. Other than that you have no way of determining what the user is doing until he/she comes back with another request, or the SOAP session times out (which I assume has the same timeout value as the HTTP session timeout.) It's do-able but extremely messy. I'm not sure what you mean by have your page create a persistent connection to you. The user is just interacting with a Struts web app. My webapp is using remote resources that it needs to release, when the HTTP session timeout at the latest. As I am the developer of the remote resource pool, I can see that I can help solve this problem (at that end) by implementing a remote session timeout. But, I would think that it's possible to run into this problem again, possibly with a service I don't have developmental control over, so I'd still like to dig around and see if a solution pops up. As I recall, doesn't a servlet have a destroy method. Maybe if Struts exposed it in someway that might help, or maybe there's someway to listen in on the HTTP Session, and get an event when the session is terminated. Thanks. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Possibly Solved: RE: How to finalize a custom connection object?
Kenneth, Sorry for the confusion. It's my there is always a solution mentality getting in the way. It wasn't getting in the way...I wanted a solution too...I'm a programmer, I know anything is possible...even if I have to change code g Unfortunately for your purposes I believe that everyone is using lazy garbage collection. I think that you will also find that the fact that the HttpSession has timed out may not be detected until the servers have some time to spare. I may have found two potential options: #1) HttpSessionBindListener. I'm still using Tomcat v3.2.1, so this interface may still be supported. It supports two methods, one called for when my object is added to a Session, the other when it's being removed. Seems to fit the bill. There is another Listener for later Servlet versions, but as you say, they seem a little less guaranteed. #2) javax.lang.ref.Reference/ReferenceQueue. Let's me apply a weak reference to my object, giving me time to do stuff with it just before it goes totally out of reference...kind cool. I've not tried either of these yet, but they seem on the right track. Thanks for your help. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm
Is this a typo or maybe the problem: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. You'll notice that you have ype not type. My names' not Syntax Error for nothing! -Original Message- From: Kevin J. Turner [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 10, 2002 12:57 PM To: Struts Users Mailing List Subject: I'm bagging my head on the keyboard on this one: Cannot retrieve definition for form bean PlayerMessageForm I'm getting this error message: Cannot retrieve definition for form bean PlayerMessageForm (PlayerMessageForm is a form bean in my project) Here is that path I am following (struts-config entries to follow: 1) (other actions.. omitted for brevity) 2) /messageTypePRE.do, which forwards to... 3) /messaging/start.jsp, which submits to 4) /messageTypePOST.do, which forwards to... 5) /playerListPRE.do, which forwards to... 6) /messaging/playerList.jsp, where I get the error message I know for a fact that the action playerListPRE.do does complete its processing. I verified this with the debugger and also with System.out statements. Its when it tries to load the JSP page, player_list.jsp. that it craps out. Even with the following bare- bones version of player_list.jsp: -- snip -- body html:form action=/editMessage.do /html:form /body -- snip -- I have the following mappings (among others) in my struts-config.xml file: -- snip -- .. form-beans type=org.apache.struts.action.ActionFormBean form-bean name=playerMessageForm ype=com.dceg.webapps.messaging.PlayerMessageForm / /form-beans .. action path=/messageTypesPOST type=com.dceg.webapps.messaging.MessageTypeAction name=playerMessageForm scope=request parameter=POST validate=false forward name=allPlayers path=/allPlayers.do / forward name=playerList path=/playerListPRE.do / forward name=gameTypes path=/gameTypesPRE.do / /action action path=/playerListPRE type=com.dceg.webapps.messaging.PlayerListAction name=playerMessageForm scope=request validate=false parameter=PRE forward name=next path=/messaging/player_list.jsp/ /action -- snip -- So what is causing Cannot retrieve definition for form bean PlayerMessageForm error??? Anyone? -- Kevin J. Turner / dot com Entertainment Group 150 Randall Street, Oakville, Ontario L6J 1P4 telephone: 905.337.8524 fax: 905.337.8630 -- 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: passing parameters
Alternatively, I believe that the Action class supports a parameter attribute, which you could possibly use if the Action class doesn't use it itself. -Original Message- From: Albertsen, Juergen [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 8:27 AM To: 'Struts Users Mailing List' Cc: Bridges, Edward Subject: AW: passing parameters You have to use a custom Mapping class. Depending on whether you use Struts 1.0 or the 1.1-dev prerelease you either specify the mapping class globally or for each action mapping. In case of the former - 1.0.x - you use an init parameter called mapping when configuring the Action servlet in the web.xml descriptor. In case of the latter - 1.1-dev - you would use the className attribute in the action element of the struts-config. (BTW, is there any elegant way to globally set the mapping class to be used? I could not find one). This mapping class should provide the properties in question and appropriate getter and setter methods (in your case needsLogin). In the perform() method of your Action class you can then cast the mapping parameter to your custom mapping class and retreive the value for the property. Regards, Jürgen -Ursprüngliche Nachricht- Von: Edward Q. Bridges [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 28. Februar 2002 15:25 An: Struts Users Mailing List Betreff: passing parameters simple question, (i hope!) if i set a property for an action in struts-config.xml like this: action path=/view-channels type=contentdb.view.channels.ViewChannelsAction name=viewChannelsForm scope=request validate=true input=/WEB-INF/jsp/ViewChannelItems.jsp set-property property=needsLogin value=true/ /action how could i then retrieve the value of needsLogin from an Action class? thanks! --e-- -- 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]
View controls populated via Form Bean?
Hi, I'm still trying to figure-out the best practices for use of Struts... I do now understand about using an Action to initialize a Form bean before it's displayed via another action...if data is being retrieved from a backend or something... But, does it break the MVC/Struts model to use the Form bean as the source of html:options lists etc.? This is data that is strictly for pick lists, etc., and does come from the model, and is not input by the user themselves. It seems very handy to me to put both the list data retrieved from the model (during initialization) there, and have the users responses in the same object. Struts seems to approve of this approach, as the html:options tag is data for display only, but takes its data from the Form bean. But maybe this is just a case of Struts making it possible, and not a suggested approach. I realized I can put objects in the session/request, and have additional tags in the .jsp that would pull them out, and (I think) still let me use the html:options tag, but this just doesn't seem as nicely formalized as using the Form bean itself...especially within the context of the html:form tags. Is this a case where maybe the Struts approach might include another bean strictly for populating the view? Or is that just creating more work for a feature that's already possible, just not formalized? Thanks for any input and clarification... -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: How to include struts.jar the proper way
I'm a newbie, but I ran into something like this before. Make sure you have a good Struts.jar (look at the contents and see if that class is in there). Look around and see if you've got another struts.jar (or download it again from the web site). I think I was accidentally using one from a 3rd party package...which was missing some thinkgs... Just an idea to try if it's really in your classpath or lib. -Original Message- From: Ida Dørum [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 9:06 AM To: [EMAIL PROTECTED] Subject: How to include struts.jar the proper way I get the following error when i run my struts-application, and it tries to instantiate my ActionForm class: java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm As I see from the archives this is a pretty common problem, however none of the solutions i've found here seem to work, and many of them condradict eachother () This is my setup: - struts.jar is included in my WEB-INF/lib directory - struts.jar is not included in my server (WL6.1) lib directory or in its classpath - my application is deployed as an .ear (and must be) I've tried: - exluding WEB-INF/lib/struts.jar when building my .ear (using ant), both with and without struts.jar in the WL classpath and lib Any good suggestions on what's wrong? Thanks in advance - Ida ...mogul technology as... mogul technology ida dørum - software engineer mailto:[EMAIL PROTECTED] www.mogul.no ... -- 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: bean:message as content of template:put tag
Phil, I ran into the same problem. I don't know if my solution was the best approach...but it worked: replace 4. with: template:put name='title' content='index.title'/ then in your template use: tiles:useAttribute id=title name=title classname=java.lang.String / titlebean:message key=%=title % //title HTH. -Chris -Original Message- From: Phil Miller [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 4:07 PM To: [EMAIL PROTECTED] Subject: bean:message as content of template:put tag Hi, I am developing an internationalized program using struts, and am using bean:message tags to display copy in different languages. On my site index page, I'd like to use the template:put tag on line 4 below to insert my locale specific page title. It seems that struts does not support this. Is there a workaround to this problem? index.jsp. 1. %@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' % 2. %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % 3. template:insert template='/template/template.jsp' 4. template:put name='title' content='bean:message key=index.title/'/ 5. template:put name='advert' content='advert here' direct='true'/ 6. template:put name='nav' content='/inc/nav.jsp'/ 7. template:put name='body' content='body here' direct='true'/ 8. /template:insert Any help would be greatly appreciated, Phil, Chamonix, France -- 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]
Checkbox state not changing after checked on
I'm having a problem with setting check box states on my form. I have a checkbox on my form, it's supposed to be checked if muting is occurring, and not checked otherwise. The user just needs to click the checkbox to change/toggle the state. However, I only seem to get an Action setting if the checkbox is not checked...any ideas what I'm doing wrong? Shouldn't the property be set regardless of the state of the object? My JSP: html:checkbox property=mute onclick=this.form.submit () /Mute My FormBean: public void setMute (boolean newMute) { mute = newMute ; action = mute ; } My ActionForm: ControlPanelForm cp = (ControlPanelForm) form ; String action = cp.getAction () ; System.out.println (Action: + action) ; if (mute.equals (action)) api.mute () ; status.refresh () ; cp.setMute (status.isMuted ()) ; return (mapping.findForward (success)); TIA. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox state not changing after checked on
Thanks Ted. So if I want to keep the checkbox metaphor (rather than use a radio button, which might confuse the UI), I should use an image of a checkbox (in either of it's states). Yes? Is there an obvious way to derive a mapping between the Form bean and the image on the JSP? Thanks for your help. -Chris -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 23, 2002 4:32 PM To: Struts Users Mailing List Subject: Re: Checkbox state not changing after checked on The underlying problem is that the HTML spec tells the browsers to not submit a checkbox if it is not checked. (Or any other blank control for that matter.) There's not a lot we can do about that =:o( What happens with a box that starts out checked, is that when it is unchecked, nothing is submitted. If the box represents a persistent state, it just stays checked, since nothing turned it off. Some times a radio button is a better way to go, since something will always be submitted. The reset method grew out of a need to set the checkboxes to a known state, to get around this quirk of HTML. The alternative is to scan the request for the missing checkboxes, and set them as expected if they are missing. -- Ted Husted, Husted dot Com, Fairport NY US -- Developing Java Web Applications with Struts -- Tel: +1 585 737-3463 -- Web: http://husted.com/about/services Chris Means wrote: I'm having a problem with setting check box states on my form. I have a checkbox on my form, it's supposed to be checked if muting is occurring, and not checked otherwise. The user just needs to click the checkbox to change/toggle the state. However, I only seem to get an Action setting if the checkbox is not checked...any ideas what I'm doing wrong? Shouldn't the property be set regardless of the state of the object? My JSP: html:checkbox property=mute onclick=this.form.submit () /Mute My FormBean: public void setMute (boolean newMute) { mute = newMute ; action = mute ; } My ActionForm: ControlPanelForm cp = (ControlPanelForm) form ; String action = cp.getAction () ; System.out.println (Action: + action) ; if (mute.equals (action)) api.mute () ; status.refresh () ; cp.setMute (status.isMuted ()) ; return (mapping.findForward (success)); TIA. -Chris -- 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: Struts Clone?
Maybe it'll be cheaper g -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2002 5:44 AM To: Struts (E-mail) Subject: Struts Clone? http://www.jotobjects.com/ http://www.jotobjects.com/ Mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How do I init a Form bean via business logic?
Hi, If Form beans are supposed to be distant from the model, that means I probably shouldn't use the reset method of a form bean to populate it with data (other than blanks/defaults etc..). So how do I set a form bean's properties prior to the form ever being displayed? One suggestion has been to force a call to the forms' Action and check for a submit property on the form...if it's not there, then initialize it, otherwise, you're dealing with a submitted form. Is this the best approach available? Thanks. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Newbie: Form bean JSP tag question
Hi, I've got Struts working fine under Tomcat 3.2.1. Now, I'm trying to tackle how to build the JSP and form bean objects, and would appreciate some help/input. FYI: I am very comfortable with JSP/Servlets Java, but I have no experience with the tag library stuff...though it seems quite intuitive. I'm creating a form that will control an audio device with controls like: Mute, Random, Repeat (checkboxes) Previous, Next, Play/Pause, Stop (buttons) My questions are: 1) JSP tags. How can I get the checkboxes to perform a submit when toggled using the tag libraries? I know I can add this.form.submit() to the onclick event, but I was curious if there was a better tag oriented approach. 2) It seems like my Action should extend the DispatchAction class, with a method for each basic action. How would I construct a FormBean that would correctly model both the check boxes (which have state) verses the buttons which don't (well, Stop, Next and Previous don't). Play/Pause would toggle. I'm not looking for anyone to write this for me, just point me in the right direction. TIA. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]