Form validation before pop-up window openning
Hi, I have a form with several buttons in it, one of them is a save button, that opens a pop-up window where you fill the name under which you want to save the informations you filled in the opener form. My problem is that I would like to validate the opener window before openning the pop-up window, using the validate(mapping,request) method of my ActionForm. Do you know a way to do so ?? Is it possible to call struts methods in the javascript script that open the pup-up window ?? If I use the same action and actionform for the opener form and the pop-up form, can I validate the openner before openning the pop-up form -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Q: How to get all the Form properties contained in a JSP ??
Hi all, I would like to get dynamically all the ActionForm properties present in a JSP file. Do you have a idea of this ??? Why do I need so ?? In fact, I am builduing a struts application with a wizard style part (5 jsp pages for one business functionnality). As It is explained in the Struts Tutorial, I built One ActionForm containning all the field to be displayed and as Ted Husted explained in his tutorial I built one Action class dealing with all the possible actions through my wizard, and use several mapping in my Struts-confing.xml file to be redirected to the correct JSPs. My problem is that I have several multiboxes and multiple select fields in my wizard, so i use the reset(mapping,request) method in my Form to get my form resetted before receiving the newly chosen fields ( this is the way to be able to catch the global de-selection of a field by a user). Thanks to the mapping and as Ted Husted explained, I am able to reset the only fields present in the jsp, because I know them, as I use the pages. BUT if the page designers rearrange the fields among the various pages I will have to modify my reset(mapping,request) method to take into account the newly put fields in the JSP. And This is not possible. As a solution to this, I would like to dynamically get the list of the fields (or properties) present in my JSP page concerning my ActionForm, in order to build a generic reset method, whatever fields are present in pages. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Pb with un-selection of multibox or select multiple objects
Hi all, I have a problem with objects such a multibox, and select multiple : I cannot un-select those objects after having set them in a prior action. Let see somme details: I go to a page named Fill to fill a form containing multibox and select multiple struts tags. I choose several values in each form objects then I submit. I then go to another page where I have sereval navigation options, one of them is to modify the previous form I filled. When I choose modify, I go to the Fill form correctly initialized with the previous values, I then deselect every multiple select or multibox object and submit: my form is not updated by those un-selection.() Everything is OK if I choose to CHANGE my selection, but nothing is taken into account if I UNSELECT all. Do you have an explaination to this, and an solution to bypass this Xavier BRUNEL -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
One ActionForm One Action for Multiple different JSP
hi all, I have a software design problem with Struts. I have to deal with an application where you fill a global form across several jsp's : I have to fill some fields in the first JSP, then press next, fill other fields, press next(or back), fill other fields, ... In each JSP, i can submit the form. I decide to Build one big ActionForm, containing all the possible fields of all JSPs, and one big Action class where you find all the action possible on these JSPs. I then modify the struts-config.xml file and make several action tags, mapping this same ActionForm and this same Action but forwarding to different JSP in order to deal with the navigation. My problem is that when I move from one JSP to another through the next or back buttons or submit the form in the current page, I lost the previous containt of my ActionForm. It seems that I get a new instance of my ActionForm as soon as i navigate in my application. I think it's a software design problem, not an implementation one though it is working pretty well elsewhere. Has anybody an idea of the way to solve this, or an explanation on how to organize a Struts application to deal with multiple JSP for one ActionForm and one Action ??? Xavier
How to catch the Session Time Out event ??
Hi all, I am using Struts for an Intranet application (Linux,Sybase,Java) and it is working very well. The last thing I would like to do is forwarding automatically the current client to the welcome page when his session is timeout, through a call to a particular ActionForward of struts-config.xml I built a JSP page (index.jsp) who calls the correct forward : %@ page language=java % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % logic:forward name=welcome/ I have the correct struts-config.xml structure (when i call the jsp directly i actually go to the welcome page who is a template). - global-forwards forward name=welcome path=/jsp/t-welcome.jsp/ /global-forwards - But I have one last problem : I would like to know how to catch the session time out event, in order to call the index.jsp page. As anybody an idea about this ??? Xavier
RE: getting all items from a html:select to an array bean property
Hi, Here is a way to obtain the selected elements of the html:select tag: Imagine JSP page where you set the kind of market sector (Oil,Telecom,Government,...) of the current compagny you are editing. In the ActionForm associated with the JSP I have: - an attribut listeTypeSociete which is an ArrayList of Bean for all the kind of market sectors listed in my database (each market sector is a bean) - an attribut selectedIdTypeSociete which is a String for the pre-selected kind of market sectors i get in my JSP when i edit a compagny (the id of the sector market pre-selected) - an attribut socType which is a String for the new selected value of kind of market sectors i will get from my JSP (the id of the sector market newly selected) In the JSP I have - a html:select based on the selectedIdTypeSociete for its value attribut and whi will set the socType attrubut - a html:options based on the listeTypeSociete attribut And it works pretty well: I retreive in the JSP all the kind of market sectors + the one pre-selected for this compagny I receive the new selected king of market through the getSocType() method of my Action Form. As an ActionForm can be considered as a Bean I think you should try to do the same to be able to get the value of the select in a bean : simply give a property corresponding to an attribut of your bean Bye Xavier Here is the code : ___ SocieteDetailForm.java private ArrayList listeSite = new ArrayList(); private String selectedIdTypeSociete = null; private String socType = null; and their getter and setter methods/// ___ ___ SocieteDetail.jsp TR TD class=Texte width=35%BChoose a compagny /B/TD bean:define name=SocieteDetailForm property=listeTypeSociete id=lidy13/ bean:define name=SocieteDetailForm property=selectedIdTypeSociete id=societeType type=java.lang.String/ TD colSpan=3nbsp; html:select size=1 property=socType value=%=societeType% html:options property=idType collection=lidy13 labelProperty=libelleTypeSociete/ /html:select /TD/TR ___ -Message d'origine- De : Rachel Warburton [mailto:[EMAIL PROTECTED]] Envoyé : jeudi 26 juillet 2001 17:34 À : Struts-User (E-mail) Objet : getting all items from a html:select to an array bean property Anyone know how to get all the values from a html:select and save them to a bean property, which is an array? I already have a solution which uses javascript to get all the values and save them to a hidden field as one long string to be submit to an ActionForm, which needs to convert the string to an array of integers. However, I figure there must be a better way to do this.? cheers, Rachel ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
Problem initializing (pre-selected) html:select multiple=true
Hello, I have a problem with multiple html:select struts tag initialization. I am unable to initialize the select tag with the values i retrieve from my database. I have a JSP with - a html:select multiple who will retrieve the selected compagnies I choose. - a html:options containing all the compagnies in my database I have in the Form associated with this JSP : - an attribut rattacheInitialChoisi who retrieve a String[] of compagnies already choosen - an attribut listeSociete who retrieve a ArrayList of all compagnies - an attribut rattacheSocieteChoisie who will retreive a String[] of the new chosen compagnies All these attributs are correctly initialized (I saw this in my logs files) But I am unable to initialize the selected elements of my html:select list in the jsp thanks to the rattacheInitialChoisi attribut (pre-selected the select list when the jsp appears) Has anyone experimented this and have an idea of how to do so ??? HELP Here is my code -- SiteDetailForm.java private ArrayList listeSociete = new ArrayList() ; private String[] rattacheSocieteChoisie= new String[0]; private String[] rattacheInitialChoisi = new String[0] ; public void setListeSociete(ArrayList _listeSociete) { this.listeSociete = _listeSociete; } public ArrayList getListeSociete() { return this.listeSociete; } public void setRattacheSocieteChoisie(String[] _rattacheSocieteChoisie) { this.rattacheSocieteChoisie = _rattacheSocieteChoisie; } public String[] getRattacheSocieteChoisie() { return this.RattacheSocieteChoisie; } public void setRattacheInitialChoisi(String[] _rattacheInitialChoisi) { this.rattacheInitialChoisi = _rattacheInitialChoisi; } public String[] getRattacheInitialChoisi() { return this.rattacheInitialChoisi; } --- --- SiteDetail.jsp bean:define name=SiteDetailForm property=listeSociete id=lidy/ bean:define name=SiteDetailForm property=rattacheInitialChoisi id=initial type=java.lang.String[]/ html:select property=rattacheSocieteChoisie value=initial multiple=true size=2 html:options property=idSociete collection=lidy labelProperty=raisonSociale/ /html:select --- Xavier Brunel France
set-property and form-bean tag in struts-config.xml ??
Hi all, I am using Struts since a couple of months and i face a problem with the set-property tab in the form-bean tag in struts-config.xml I understood that the set-property could be used to initialize parameters of JavaBeans (see struts-config.dtd). But in fact this doesn't work in my case: I am building an Application System and a Administration System using Struts,Apache and Tomcat. I have a UserListForm in my Administration System, which is a ActionForm listing all the users registered in my Application System. This UserListeForm is linked, through action-mapping,with a JSP Page UserList.jsp, who is just displaying the list. I would like to give to the Administrators the possibility to fix the maximum number of element in the list, and giving them the possibility to view the rest of the list by links next and previous. This works pretty well if I initialize this number directly in my application code in UserListeForm. But when i want to make it fixed through the struts-config.xml, the max number is never initialized. Can anybody help me on my problem ??? Here is My Struts-config.xml : form-bean name=UserListForm type=com.myapplication.form.UserListForm set-property property=numberOfElement value=4/ /form-bean Here is my UserListForm extending the ActionForm to be able to use the set-property : public final class UserListForm extends ActionForm{ private int numberOfElement; public void setNumberOfElement(int _numberOfElement){ numberOfElement=_numberOfElement; } public int getNumberOfElement(){ return numberOfElement; } }
RE:PROBLEM SOLVED : set-property and form-bean tag in struts-config.xml ??
OK, I found a way to solve my problem (see the problem below) I make my ListeActionFormBean' methods static and imported this class in my UserListAction to be able to access to the desired property. Then I set the similar property to my UserListForm and this is OK !! It's not clean at all so i am waiting for an other idea . Bye Xavier Brunel -Message d'origine- De : Xavier Brunel [mailto:[EMAIL PROTECTED]] Envoyé : lundi 16 juillet 2001 20:27 À : [EMAIL PROTECTED] Objet : RE: CORRECTION : set-property and form-bean tag in struts-config.xml ?? Ok guys, looking at the Struts starting messages I saw this : Set org.apache.struts.action.ActionFormBean property numberOfElement to 4 So I understand that Struts try to set the property numberOfElement of ActionFormBean, property which does not exist in ActionFormBean so it does not work So I extends ActionFormBean in a class ListActionFormBean adding the property numberOfElement _ public class ListeActionFormBean extends ActionFormBean{ private int numberOfElement; public void setNumberOfElement(int _numberOfElement){ numberOfElement=_numberOfElement; } public int getNumberOfElement(){ return numberOfElement; } } ___ Then I modify struts-config.xml with the new reference to ListActionFormBean for UserListForm: form-bean name=UserListForm type=com.myapplication.form.UserListForm className=com.myapplication.struts.formbean.ListeActionFormBean set-property property=numberOfElement value=4/ /form-bean The rest of my code did not change When I start Struts I now get the following message : New com.profileup.struts.formbean.ListActionFormBean Set com.profileup.struts.formbean.ListActionFormBean properties Set com.profileup.struts.formbean.ListActionFormBean property numberOfElement to 4 But I am unable to get back this property to assign it to my UserListForm !! How do you make that possible ??? I presume that it is in the action class associed to the UserListForm (UserListAction), but which command can I use ?? Thanks for Help Xavier -Message d'origine- De : Xavier Brunel [mailto:[EMAIL PROTECTED]] Envoyé : lundi 16 juillet 2001 20:03 À : 'Struts-User Objet : set-property and form-bean tag in struts-config.xml ?? Hi all, I am using Struts since a couple of months and i face a problem with the set-property tab in the form-bean tag in struts-config.xml I understood that the set-property could be used to initialize parameters of JavaBeans (see struts-config.dtd). But in fact this doesn't work in my case: I am building an Application System and a Administration System using Struts,Apache and Tomcat. I have a UserListForm in my Administration System, which is a ActionForm listing all the users registered in my Application System. This UserListeForm is linked, through action-mapping,with a JSP Page UserList.jsp, who is just displaying the list. I would like to give to the Administrators the possibility to fix the maximum number of element in the list, and giving them the possibility to view the rest of the list by links next and previous. This works pretty well if I initialize this number directly in my application code in UserListeForm. But when i want to make it fixed through the struts-config.xml, the max number is never initialized. Can anybody help me on my problem ??? Here is My Struts-config.xml : form-bean name=UserListForm type=com.myapplication.form.UserListForm set-property property=numberOfElement value=4/ /form-bean Here is my UserListForm extending the ActionForm to be able to use the set-property : public final class UserListForm extends ActionForm{ private int numberOfElement; public void setNumberOfElement(int _numberOfElement){ numberOfElement=_numberOfElement; } public int getNumberOfElement(){ return numberOfElement; } }
Different JSPs directories for the same Struts Application
Hi, I am developping a Apache Tomcat Struts Web Application that will be use in ASP mode (Application Service Provider not the MSoft stuff) by different Users. The thing is that Users will have common JSP for a part and specific ones for the other part (Number of fields in page forms, look and feel, stylesheet, different navigation across application, etc ...). So JSPs are placed in different directories /jsp/commun/*jsp /jsp/user1/*jsp /jsp/user2/*jsp The user will be identify through his login/passwd on the application I would like to use one JVM for my application to be used by all users. How can I deal which the dynamic redirection to the good path to the correct JSP ?? Do I have to use one struts-config.xml per user ?? Do I have to treat that in the ActionForms sub classes ??? Thanks for answering if you've already seen this problematic Xavier