Re: ReQ: Only one logged in session at a time for each user
Hi Guys They way i have done this is create a singleton class for logged on users and keep a hash of the usernames logged on. However when a user does not loggof the user is still in the hash, so what i do before a user tries to logon again is to check whether the session is valid . if it is then i give a mutliple loggon message, invalidate the session and create a new session. If the session is invalid i know he expired so i just logg the user on normally. Also at each request check for valid session. kayode Dosunmu From: Alvin Kutttikkat Antony [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: ReQ: Only one logged in session at a time for each user Date: Mon, 28 Jan 2002 16:22:39 +0100 Hi there, I am too interested on this.The suggestion is good.How can I get session object from the Id.I think one way is through HttpSessionContext class. I found this class has been deprecated. any other way to achieve this Alvin second time, that you invalidate the *old* session and let them continue with new one. I've seen that approach used on a large public web site. Sean On Sunday, January 27, 2002, at 08:01 PM, Antony Stace wrote: Hi I want the users in a Struts application to be only logged in once at any one time. What is the best way to go about this. I was thinking that I can have have some sort of record in (an application wide bean)/(a database record)/(the logon action) that keeps track of who is logged on and when the log on process happens this record is checked, if the user is already logged on then don't let them log on again. The problem I can see with this is that this works fine if the user logs out of the application through a logout action - the logout action can simply clear the record of the user being logged in. But if the users browser crashes, they reboot the machine, they simply restart the browser then this record will not be cleared and thus they will not be able to log in. I cannot think of how I can implement a mechanism to ensure only one log in at a time. The thought of adding some sort of timeout value seems a little nasty, since I hate it when I go to a site and I am told I am alread logged in, please try back in 10 minutes. Any ideas folks on how to handle this? -- Cheers Tony - _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:struts-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:struts-user- [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] alvin kuttikkat antony Internet und Virtuelle Hochshule Directory Universität München Leopoldstr .3 80802 München Germany Office Tel + 49.89.21025979 Office Fax + 49.89.21025980 _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: ReQ: Only one logged in session at a time for each user
Hi Kayode Just a note, a Singleton will not work if you have a cluster of JSP containers serving your application. You would have to use the database or a stateful session bean if you want it to work in a distributed environment. You could try the application context, but I am not sure if the container will persist that to other servers. Keith -Original Message- From: Kayode Dosunmu [mailto:[EMAIL PROTECTED]] Sent: Sunday, 3 February 2002 5:58 p.m. To: [EMAIL PROTECTED] Subject: Re: ReQ: Only one logged in session at a time for each user Hi Guys They way i have done this is create a singleton class for logged on users and keep a hash of the usernames logged on. However when a user does not loggof the user is still in the hash, so what i do before a user tries to logon again is to check whether the session is valid . if it is then i give a mutliple loggon message, invalidate the session and create a new session. If the session is invalid i know he expired so i just logg the user on normally. Also at each request check for valid session. kayode Dosunmu From: Alvin Kutttikkat Antony [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: ReQ: Only one logged in session at a time for each user Date: Mon, 28 Jan 2002 16:22:39 +0100 Hi there, I am too interested on this.The suggestion is good.How can I get session object from the Id.I think one way is through HttpSessionContext class. I found this class has been deprecated. any other way to achieve this Alvin second time, that you invalidate the *old* session and let them continue with new one. I've seen that approach used on a large public web site. Sean On Sunday, January 27, 2002, at 08:01 PM, Antony Stace wrote: Hi I want the users in a Struts application to be only logged in once at any one time. What is the best way to go about this. I was thinking that I can have have some sort of record in (an application wide bean)/(a database record)/(the logon action) that keeps track of who is logged on and when the log on process happens this record is checked, if the user is already logged on then don't let them log on again. The problem I can see with this is that this works fine if the user logs out of the application through a logout action - the logout action can simply clear the record of the user being logged in. But if the users browser crashes, they reboot the machine, they simply restart the browser then this record will not be cleared and thus they will not be able to log in. I cannot think of how I can implement a mechanism to ensure only one log in at a time. The thought of adding some sort of timeout value seems a little nasty, since I hate it when I go to a site and I am told I am alread logged in, please try back in 10 minutes. Any ideas folks on how to handle this? -- Cheers Tony - _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:struts-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:struts-user- [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] alvin kuttikkat antony Internet und Virtuelle Hochshule Directory Universität München Leopoldstr .3 80802 München Germany Office Tel + 49.89.21025979 Office Fax + 49.89.21025980 _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- 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: nested iterate
try using nested tags example and code available at http://www.keyboardmonkey.com/struts nested:iterate property=articles nested:iterate property=picturesContainer /nested:iterate /nested:iterate -Original Message- From: Philippe Hodapp / 1genia [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 4:56 PM To: Struts Users Mailing List Subject: nested iterate I have some problems to use an iterate tag in an iterate tag. I have tried to use the define tag but it don't work too. I have the message : Cannot create iterator for this collection Here's the code : logic:iterate id=aLaUneItem name=aLaUne property=articles scope=session A HREF=detail.do?idArticle=bean:write name=aLaUneItem property=noArticle / bean:write name=aLaUneItem property=titre //A bean:write name=aLaUneItem property=resume / bean:define id=article name=aLaUneItem/ logic:iterate id=pictureItem name=article property=picturesContainer img src=bean:write name=pictureItem property=idArt/ /logic:iterate /logic:iterate -- 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: nested iterate
Tried the nested:iterate tag and the rest of the nested library? It comes in the nightly build, or you can get it separately here (along with tutorial and such on how to use it)... http://www.keyboardmonkey.com/struts Arron. Philippe Hodapp / 1genia wrote: I have some problems to use an iterate tag in an iterate tag. I have tried to use the define tag but it don't work too. I have the message : Cannot create iterator for this collection Here's the code : logic:iterate id=aLaUneItem name=aLaUne property=articles scope=session A HREF=detail.do?idArticle=bean:write name=aLaUneItem property=noArticle / bean:write name=aLaUneItem property=titre //A bean:write name=aLaUneItem property=resume / bean:define id=article name=aLaUneItem/ logic:iterate id=pictureItem name=article property=picturesContainer img src=bean:write name=pictureItem property=idArt/ /logic:iterate /logic:iterate -- 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: is indexed=true working on Struts 1.0?
I'm quite certain the indexed option in the tags is only available in the nightly build. Arron. [EMAIL PROTECTED] wrote: I have an array of object in myForm, say, users. Each user has a name, a password ... I want to put these fields as html:text name=user property=name indexed=true/ and can be submited. Is there any way to do so with Struts 1.0? or I have to use Struts 1.0.1? I tried it on Struts 1.0 and got an error: editUser.jsp(236,5) Attribute indexed invalid according to the specified TLD Thank you for any help. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: is indexed=true working on Struts 1.0?
If you're willing to get the nightly build, you may as well use the nested extension that comes with it. The iterations are easier and just generally better for what it sounds like you're trying to do. Arron. [EMAIL PROTECTED] wrote: Thank you. Can I use part of the nightly code for indexed form objects? What files should be replaced? I don't want my stuff to be messed up too much. It's a working application and it's working, at least. Now what I did to keep the array objects is that I used a hashtable in Action to kepp it in the session and asign each form a form id and put it into the hashtable with the array of object user. It's ugly. and I can't change multiple user's name or password at once. I can only do delete one and add one. I want to keep the array of users in the Form, and hopefully editable. Yunming -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 12:52 PM To: Struts Users Mailing List Subject: Re: is indexed=true working on Struts 1.0? no. nightly build required til 1.1 released. Dave [EMAIL PROTECTED] on 02/01/2002 10:19:35 AM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: is indexed=true working on Struts 1.0? I have an array of object in myForm, say, users. Each user has a name, a password ... I want to put these fields as html:text name=user property=name indexed=true/ and can be submited. Is there any way to do so with Struts 1.0? or I have to use Struts 1.0.1? I tried it on Struts 1.0 and got an error: editUser.jsp(236,5) Attribute indexed invalid according to the specified TLD Thank you for any 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]
Multiple beans
I am new to struts so excuse me if this is an incredibly naïve question, I have searched through the archive put am not sure what to even search on. I have multiple beans for a form an example would be contact.jsp where the ContactForm.java has the get and set methods for the contact e.g. firstName, lastName etc, I have a bean AddressForm to handle the contacts address/s with get and set methods (adress1, address2 and so on) and a bean for the phone details (PhoneForm.java) with the corresponding phone information. html:form action=contact html:text property=firstName size=30 maxlength=30 / html:text name=addressForm property=address1 size=30 maxlength=30 / html:text name=phoneForm property=phoneNumber size=30 maxlength=30 / In struts-config I have actionpath=/contact type=com.blah.blah.ContactAction name=contactForm scope=request validate=true input=/contact.jsp form-bean name=contactForm type=com.blah.blah.ContactForm/ form-bean name=addressForm type=com. blah.blah.AddressForm/ form-bean name=phoneForm type=com. blah.blah.PhoneForm/ However the result is Cannot find bean addressForm in scope null. If you could point me to some link with information it would be greatly appreciated. TIA Joe
Re: Form fields submitted multiple times...
If you are forwarding from Action to Actoin, the ActionServlet will handle each request the same as the first. If you do not want your ActionForm to be repopulated from the request as you forward it around, the workaround is to put an readonly property on the form. The public setters for your properties can then check this to see if they should allow changes or not. The first action can then set the ActionForm to readonly before forwarding it along. public void setProperty(String property) { if (isMutable()) { this.property = property; } } There's a SuperForm class in the Scaffold package in the contrib folder that demonstrates this and some other techniques [org.apache.scaffold.http.SuperForm]. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Kearfott, David (DST-CLT) wrote: Has anyone ever noticed the Set methods in the ActionForm invoked multiple times (always using the values submitted from the html:form) from Action to Action? In our JSP, we have several buttons pertaining to the same form (thisActionForm). Depending on which button was pressed, a different action mapping is invoked from Struts: action path=/handleButtons type=HandleButtonsAction name=thisActionForm validate=false scope=session input=/home.jsp forward name=updateDetailsButton path=/updateDetails.do/ forward name=resetDetailsButton path=/resetDetails.do/ forward name=calculateButton path=/calculateAmounts.do/ forward name=deleteButton path=/deleteDetails.do/ /action action path=/resetDetails type=ResetDetailsAction name=thisActionForm validate=false scope=session input=/home.jsp forward name=success path=/calculateAmounts.do/ /action action path=/calculateAmounts type=CalculateAmountsAction name=thisActionForm validate=false scope=session input=/home.jsp forward name=success path=/details.jsp/ /action We see the fields entered/changed in thisActionForm set before entering the HandleButtonsAction class. We also see the same field values set again before entering the ResetDetailsAction class, as if the HTML form has been submitted a second time. The ResetDetailsAction resets some date fields on thisActionForm, by invoking various Set methods. We then see the original field values set a third time before entering the CalculateAmountsAction class, clearing out the values reset in the ResetDetailsAction As anyone seen anything similar? Is there an attribute we could use in the action element that would disallow the form from submitting again and again and again? Our current work around is to not use thisActionForm on any other actions, except the HandleButtonsAction, and just grab thisActionForm off of the session in ResetDetailsAction and CalculateAmountsAction, but we feel that there's an easier way. Sorry for the novel... -dave kearfott -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Formatting Dates, Integers...
Pesonally, I recommend doing such things in the ActionForm. You can do them in the page, but that means modifying the page, and placing what is really business logic in the presentation tier. While it seems we are talking about how data looks, formatting it this way or that is really a business requirement. The part about stuffing the formatted string into HTML is the presentation tier. The J2EE blueprints call these helper beans or methods. Generally, I add a second getter to provide the formatted version. This does the same thing a tag would do, but is easier to write. The actual formatting code I would put into a library in the business tier that the ActionForm method would simply call. So you could add these without touching your existing methods, and just have the bean:write call these getters instead. Of course, if we are talking about display data, and you already have beans that render the formatted data, just use those. The ActionForms are only important for inputting data. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Hudayioglu, Fehmi wrote: Hi fellows, I have searched the mailing list in hope to find a way to display a number in format (e.g:120.200,32). I couldn't find any solution. There were some messages proposing to play on the getter and setter methods. But, this is not a solution we imagine. Because we have some object properties in the Form Bean and their properties can be set by struts directly. So changing getter and setter methods requires tons of effort to modify our data classes and form beans which is of course NOT desirable. I also know that there is a DateTag library of Jakarta, which is yet in beta release. Therefore, my managers (regards to them) don't want to use beta releases. They don't want to modify struts tags neither. However, I believe this is quite straightforward way (hopefully they will be contended soon). So, 1. Do you have any clever solution for this common problem? 2. What necessary steps should I take in order to add a new Format attribute to the form:text and bean:write? 2.1 In case, I added necessary methods, how can I guarantee that struts set this formatted value to the property. According to my tries, it doesn't set them correctly? 2.2 How long does an ordinary developer require to modify struts to do so? thanks and my best regards, fehmi. -- 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: Multiple beans
Thanks for the reply, I can see the sense in putting contact, address and phone in one (Action) form. However how do you deal with one contact - one to many addresses/phones? -Original Message- From: twang7090 [mailto:[EMAIL PROTECTED]] Sent: Monday, 4 February 2002 4:56 AM To: Struts Users Mailing List Subject: Re: Multiple beans Hi Joe, Please keep in mind that Struts's ActionForm is a map to a HTML Form object. In a HTML page, you will define a form this way: FORM Name =contactForm ACTION=contact.do TEXT name=firstName TEXT name=lastName /Form In Jsp page, using the struts tags, we do this way html:form action=contact html:text property=firstName / html:text property=lastName / /html:form Comparing this two, you find that the name of the form is specified in the struts-config.xml file by the action path=/contact name=contactForm ... The action tag in the struts-config.xml is the linker which links the struts tags in the jsp to the ActionForm in the servlet. html:form action=contact on the jsp page causes the servelet created the contactForm as it is specified as the name in the contact action. And this is the only ActionForm that will be created for this action. (struts no any clue to see that you have to have a address or phone form to be created). Now in your case, as a edit page of jsp, in the user interface part, you'd better to put contact, address, phone in one form, and in your servlet you may create different objects and save them separately. If you really need to separate them on the jsp page, you may end up using three forms in the same jsp page with three submit buttons(or one by the help of javascript) to submit them. In this case you will create three action in struts-config.xml and define three html:form in the jsp page. Hope this helps, Tony - Original Message - From: Joe Latty [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, February 03, 2002 9:32 PMSubject: Multiple beans I am new to struts so excuse me if this is an incredibly naïve question, I have searched through the archive put am not sure what to even search on. I have multiple beans for a form an example would be contact.jsp where the ContactForm.java has the get and set methods for the contact e.g. firstName, lastName etc, I have a bean AddressForm to handle the contact's address/s with get and set methods (adress1, address2 and so on) and a bean for the phone details (PhoneForm.java) with the corresponding phone information. html:form action=contact html:text property=firstName size=30 maxlength=30 / html:text name=addressForm property=address1 size=30 maxlength=30 / html:text name=phoneForm property=phoneNumber size=30 maxlength=30 / . In struts-config I have actionpath=/contact type=com.blah.blah.ContactAction name=contactForm scope=request validate=true input=/contact.jsp form-bean name=contactForm type=com.blah.blah.ContactForm/ form-bean name=addressForm type=com. blah.blah.AddressForm/ form-bean name=phoneForm type=com. blah.blah.PhoneForm/ However the result is Cannot find bean addressForm in scope null. If you could point me to some link with information it would be greatly appreciated. TIA Joe -- 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-action reading property set in config
This implies that you have setup a subclass of ActionMapping with setTest() and getTest properties, and have specified that class in your ActionServlet's config. This being the case, when the mapping is passed to the perform method of your Action, you can cast the mapping to your subclass, and call the new methods. MyMapping myMapping = (MyMapping) mapping; String test = myMapping.getTest(); -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Dirk Storck wrote: Hi I have the following action defined: action path=/admin/account/create parameter=create validate=true unknown=false scope=session type=com.tecmath.cms.mt.struts.UserDataAction name=userDataBean set-property property=test value=test / forward name=failure path=accountDef redirect=false / forward name=success path=/user/account/show.do redirect=false / /action How Can I now read that property test within my Action? Thanks ! -- 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]
global forwards (Struts Catalog)
I was just reading Ted's Struts Catalog to improve the building of my struts based application and I misunderstand the section on 'Use Global Forwards for all entry points to application' Also it says 'all links in the application should be to ActionMappings. Rather than embed the path to an ActionMapping in a JSP, a link should refer to a Global Forward instead. This is what I either misunderstand or can't get to work. I have a global forward: forward name=view path=/do/view/ Now I have a custom tag that would typically generate links to /do/view but would like to instead use the global forward name view. example where n is generated from some set (not using global forward): a href=/do/view?item=nitem n/a obviously this is the kind of link we're trying to avoid cause it's hard coded to /do/view So how do I generate a link that will follow / use the Global Forward? Thanks rob -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: global forwards (Struts Catalog)
forward name=view path=/do/view/ html:link forward=view ... or forward name=view/n path=/do/view?item=n / html:link forward=view/n ... -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ rob wrote: I was just reading Ted's Struts Catalog to improve the building of my struts based application and I misunderstand the section on 'Use Global Forwards for all entry points to application' Also it says 'all links in the application should be to ActionMappings. Rather than embed the path to an ActionMapping in a JSP, a link should refer to a Global Forward instead. This is what I either misunderstand or can't get to work. I have a global forward: forward name=view path=/do/view/ Now I have a custom tag that would typically generate links to /do/view but would like to instead use the global forward name view. example where n is generated from some set (not using global forward): a href=/do/view?item=nitem n/a obviously this is the kind of link we're trying to avoid cause it's hard coded to /do/view So how do I generate a link that will follow / use the Global Forward? Thanks rob -- 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: global forwards (Struts Catalog)
Hi Ted, sorry to ask for clarification again and it's probably completely obvious but I've overlooked it. How can I specify the link from within a custom tag (since the struts html:link forward=xyz / tag) can only be used within a JSP page and not in the body of doStartTag()/doEndTag()? or can it? Thanks for the quick reply before I appreciate it rob - Original Message - From: Ted Husted [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 04, 2002 3:14 PM Subject: Re: global forwards (Struts Catalog) forward name=view path=/do/view/ html:link forward=view ... or forward name=view/n path=/do/view?item=n / html:link forward=view/n ... -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ rob wrote: I was just reading Ted's Struts Catalog to improve the building of my struts based application and I misunderstand the section on 'Use Global Forwards for all entry points to application' Also it says 'all links in the application should be to ActionMappings. Rather than embed the path to an ActionMapping in a JSP, a link should refer to a Global Forward instead. This is what I either misunderstand or can't get to work. I have a global forward: forward name=view path=/do/view/ Now I have a custom tag that would typically generate links to /do/view but would like to instead use the global forward name view. example where n is generated from some set (not using global forward): a href=/do/view?item=nitem n/a obviously this is the kind of link we're trying to avoid cause it's hard coded to /do/view So how do I generate a link that will follow / use the Global Forward? Thanks rob -- 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: Multiple beans
If it helps, you can also nest beans on the ActionForm and refer to them with a dotted syntax. In the html tags, you could then refer to name=billingAddress.street or name=shippingAddress.street where shippingAddress and billingAddress are properties on ContactForm, accessible through getShippingAddress() and getBillingAddress() -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ Joe Latty wrote: Thanks for the reply, I can see the sense in putting contact, address and phone in one (Action) form. However how do you deal with one contact - one to many addresses/phones? -Original Message- From: twang7090 [mailto:[EMAIL PROTECTED]] Sent: Monday, 4 February 2002 4:56 AM To: Struts Users Mailing List Subject: Re: Multiple beans Hi Joe, Please keep in mind that Struts's ActionForm is a map to a HTML Form object. In a HTML page, you will define a form this way: FORM Name =contactForm ACTION=contact.do TEXT name=firstName TEXT name=lastName /Form In Jsp page, using the struts tags, we do this way html:form action=contact html:text property=firstName / html:text property=lastName / /html:form Comparing this two, you find that the name of the form is specified in the struts-config.xml file by the action path=/contact name=contactForm ... The action tag in the struts-config.xml is the linker which links the struts tags in the jsp to the ActionForm in the servlet. html:form action=contact on the jsp page causes the servelet created the contactForm as it is specified as the name in the contact action. And this is the only ActionForm that will be created for this action. (struts no any clue to see that you have to have a address or phone form to be created). Now in your case, as a edit page of jsp, in the user interface part, you'd better to put contact, address, phone in one form, and in your servlet you may create different objects and save them separately. If you really need to separate them on the jsp page, you may end up using three forms in the same jsp page with three submit buttons(or one by the help of javascript) to submit them. In this case you will create three action in struts-config.xml and define three html:form in the jsp page. Hope this helps, Tony - Original Message - From: Joe Latty [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, February 03, 2002 9:32 PMSubject: Multiple beans I am new to struts so excuse me if this is an incredibly naïve question, I have searched through the archive put am not sure what to even search on. I have multiple beans for a form an example would be contact.jsp where the ContactForm.java has the get and set methods for the contact e.g. firstName, lastName etc, I have a bean AddressForm to handle the contact's address/s with get and set methods (adress1, address2 and so on) and a bean for the phone details (PhoneForm.java) with the corresponding phone information. html:form action=contact html:text property=firstName size=30 maxlength=30 / html:text name=addressForm property=address1 size=30 maxlength=30 / html:text name=phoneForm property=phoneNumber size=30 maxlength=30 / . In struts-config I have actionpath=/contact type=com.blah.blah.ContactAction name=contactForm scope=request validate=true input=/contact.jsp form-bean name=contactForm type=com.blah.blah.ContactForm/ form-bean name=addressForm type=com. blah.blah.AddressForm/ form-bean name=phoneForm type=com. blah.blah.PhoneForm/ However the result is Cannot find bean addressForm in scope null. If you could point me to some link with information it would be greatly appreciated. TIA Joe -- 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]
Scaffold+Artimus Documentation
Hi All, Is there any documentation for Scaffold+Artimus packages in nightly build? Any reference will be appreciated. Thanks Hertzel -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Template Question
Thanx Cedric, I realized that a few days later, so I used a .jsp with frames where one of the frames loads the page. Regards, Konstantina - Original Message - From: Cedric Dumoulin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 01, 2002 6:39 PM Subject: Re: Template Question Hi, Content of put tag can only be a jsp local to current web application. It can't be an url starting with http://... Cedric Konstantina Stamopoulou wrote: Hello, I'm a beginner to Struts, and I'm using its template tag library for my web application. I would like to load in one of the areas of the template a URL. To be more specific what I'm trying to do is the following: template:insert template='/infotemplate.jsp' template:put name='title' content='Subscription information' direct='true'/ template:put name='sidebar' content='/details.jsp'/ template:put name='content' content='http://www.in.gr'/ template:put name='footer' content='/footer.html'/ /template:insert The result of this is a big Exception: java.io.IOException: the filename, directory,or volume label syntax is incorrect. My template is the following: html head titletemplate:get name='title'//title /head body background='graphics/blueAndWhiteBackground.gif' table tr valign='top' tdtemplate:get name='sidebar'//td tdtable trtdtemplate:get name='header'//td/tr trtdtemplate:get name='content'//td/tr trtdtemplate:get name='footer'//td/tr /table /td /tr /table /body /html I'm I doing something wrong or the thing I'm trying to do is not possible using templates? Can anyone give me any suggestion on what I should use to overcome this problem? Thank U in advance, Konstantina -- 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]