RE: Arraylists/Collections
It depends on the database you are using. If using oracle, then you can create a new datatype in database to store array of numbers(if you require to work with Collection of number) Then you can pass a array of numbers to stored proc using the setArray method The code snippet is as follows: --Creating a type (a datatype stored in database) CREATE OR REPLACE TYPE ENT_GENERIC_NUMBER_TYPE AS TABLE OF number; --In java layer suppose you have a collection of integer objects (say numlist) ArrayDescriptor numberArrDescriptor = ArrayDescriptor.createDescriptor("ENT_GENERIC_NUMBER_TYPE", connection); Array numarray = new Array(numberArrDescriptor,connection, numlist.toArray()); Preparedstatement.setArray(1, numarray); -- DB layer accessing the array PROCEDURE arraytester ( numarray inent_generic_number_type, ) Is Begin FOR i IN numarray.FIRST .. numarray.LAST Loop dbms_output.put_line(numarray(i)); End loop; End; Similarly you can create type of any oracle datatype(number,date,varchar2) Hope it helps Thanks, Satish Kataria -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Thursday, June 24, 2004 9:07 PM To: '[EMAIL PROTECTED]' Subject: Arraylists/Collections Is there a proper way to pass an arraylist/collection to a pl/sql procedure besides turning it into a string on the java-side and passing it then as a VARCHAR parameter? ___ Chris Cranford Programmer/Developer SETECH Inc. & Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: preventing user from validating twice
You can use savetoken(request) method for generating a token (when loading the screen)and Cheque for the existence of token using istokenvalid(request) method for ensuring that you do not submit same data again. Code in action wld be like isTokenValid(request) { ... DB insert } Thanks, Satish -Original Message- From: Olivier Citeau [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 23, 2004 3:49 PM To: [EMAIL PROTECTED] Subject: preventing user from validating twice Hi, i think it must be a FAQ, but i did not found anything on this issue. When my user submits a form, the action executes an SQL Insert in the DBMS. What happened is that when user click twice, the second inserts fails with SQLException. What is strange, is that i cannot reproduce it in WSAD, but it happens on a full Websphere. Is there a way i can know that a user already submitted a form ? = Olivier Citeau Paris, France Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.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: Struts alternative to using request.getParameterValues in an actionform?
You can use nested tags to automatically retrive and populate information. A snippet of code is as follows It assumes you have a attribute named sitesList in ur action form This way you can access any type of attribute from ur action form -Original Message- From: Asif Rahman [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:31 AM To: [EMAIL PROTECTED] Subject: Struts alternative to using request.getParameterValues in an actionform? Importance: High Hi Im using shown below to iterate through an arraylist (sitesList) in my actionform (OpportunitySitesForm). This arraylist contains a number of Site objects which have the properties siteName, address1, and city. This is getting displayed correctly. Now when processing the form, I am wondering whether in struts there is a way to retrieve these as objects and automatically populate setSitesList(ArrayList) method, rather than manually use request.getParameterValues for siteName, address1, city, create individual Site objects, add the site objects to an arraylist with Site objects and finally pass the list into setSitesList(arraylist). Any help would be most appreciated. Thanks! -Asif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: can i have multiple struts-config.xml
Yes you can have any number of struts-config file. You have to name them differeently though and put allof them in WEB-INF folder. Then declare all the struts-config files in web.xml E.g action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml, /WEB-INF/a.xml, /WEB-INF/b.xml Where struts-config.xml,a.xml and b.xml are the struts config files Thanks, Satish -Original Message- From: sougata [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 5:29 PM To: Struts Users Mailing List Subject: can i have multiple struts-config.xml Hi All I have one question.Can I have 2 struts-config.xml for one web application. Thanks Sougata -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Lionel Sent: Tuesday, June 15, 2004 5:22 PM To: [EMAIL PROTECTED] Subject: Re: security roles Zhang, Larry (L.) wrote: > (2)also say a manager logon our sites, I can obtain the info for this > user such as "managerFlag", and then where should I put the logic to > decide whether the user is a manager or an employee, and how to map > this user to a security-role defined above? this is a websphere issue. loook for : com.ibm.websphere.security Interface UserRegistry - 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]
RE: Cannot Find Bean in Any Scope
You are getting the error because you have not defined a scripting variable for the threadbean. Simple way of doing that is using the bean:define tag Please let me know if there is any problem in using this Thanks, Satish -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, June 13, 2004 5:30 AM To: Struts Users Mailing List Subject: RE: Cannot Find Bean in Any Scope Sorry for not being clear about the problem that I have. 1. I have a JavaBean, which is named as ThreadBean with lots of properties. 2. My ListThread.java class extends Action. In that class, I created a collection of beans. Each of those beans is a ThreadBean. 3. By the end of the ListThread.java, I passed those beans to my JSP in the request scope this way: request.setAttribute( "ThreadBeans", beans ); 4. In my JSP (I did import the ThreadBean), I have <% Collection threadRows = ( Collection )request.getAttribute( "ThreadBeans" ); int odd = 0; Iterator iterator = threadRows.iterator(); while( iterator.hasNext() ) { odd = ( odd + 1 )%2; ThreadBean threadBean = ( ThreadBean )iterator.next(); . } %> 5. when I tried to write out the properties; for example: <%=threadBean.getSender()%> <%=threadBean.getThreadReplyCount()%> <%=threadBean.getThreadViewCount()%> .. I got the error message: - Root Cause - javax.servlet.ServletException: Cannot find bean threadBean in any scope --- "CRANFORD, CHRIS" <[EMAIL PROTECTED]> wrote: > > -- If you want to specify a new bean instance, use > this: > type="org.MyOrg.MyProj.message.ThreadBean" /> name="threadBean" property="sender"/> property="threadReplyCount"/> > property="threadViewCount"/> > > -- If the bean already exists > type="org.MyOrg.MyProj.message.ThreadBean"/> > > > > I think this is right .. > Chris > > -Original Message- > From: Caroline Jen [mailto:[EMAIL PROTECTED] > Sent: Saturday, June 12, 2004 7:28 PM > To: [EMAIL PROTECTED] > Subject: Cannot Find Bean in Any Scope > > > I am using the Struts framework. I have a JSP, > which > imports a JavaBean "ThreadBean". Therefore, in the > beginning of my JSP, in addition to > > <%@ taglib uri="/tags/struts-html" prefix="html" %> > <%@ taglib uri="/tags/struts-bean" prefix="bean" %> > <%@ taglib uri="/tags/struts-logic" prefix="logic" > %> > <%@ taglib uri="/tags/tiles" prefix="tiles" %> > <%@ taglib uri="/tags/request" prefix="req" %> > > I have > > <%@ page > import="org.MyOrg.MyProj.message.ThreadBean" > %> > > In my JSP, I try to write out the properties of this JavaBean; for > example: > > <%=threadBean.getSender()%> > <%=threadBean.getThreadReplyCount()%> > <%=threadBean.getThreadViewCount()%> > > I got the error message: > > - Root Cause - > javax.servlet.ServletException: Cannot find bean > threadBean in any scope > > What is the correct way to do it? > > > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.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] > > __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.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: Help with validate ActionForm method
I hope you have not set validate="true" for the both the load and submit action mapping i.e there wld be a action mapping for loading the screen(say load) The validate attribute for this action Be set to false Then there wld be a action maqpping when to want to validate(say on submit of a button - lets call it submitaction). The validate attribute of only this shld be set to true Thanks, Satish -Original Message- From: Lesaint Sébastien [mailto:[EMAIL PROTECTED] Sent: Monday, June 14, 2004 1:19 PM To: Struts Users Mailing List Subject: Help with validate ActionForm method Hi, I'm using ActionForm for one of my pages and I implemented the validate method as follow: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (isFieldEmpty(login)) { errors.add("login", new ActionError("loginForm.login.required")); } if (isFieldEmpty(password)) { errors.add("password", new ActionError("loginForm.password.required")); } if (errors.isEmpty()) { if (!isConnected(login, password)) { errors.add("login", new ActionError("loginForm.msgs.wrongLoginorPassword")); } } if (!errors.isEmpty()) { getLogger().info(this, "Failed attempt to log in : [" + login + "/" + password + "] from : " + request.getRemoteHost()); } return (errors); } You can see that I log each time someone fail to log in. When the validate method returns an empty Error Array, login/password are checked in an Action object. The problem is that I have the following trace in the log when somebody successfully log in : 09:26:54,500 INFO [lex.LoginAction] User logged in [login/pwd] sessionId [773BB4634682A159DC680847073E4EC8] from [10.10.10.10] 09:26:54,587 INFO [lex.LoginActionForm] Failed attempt to log in : [/] from : 10.10.10.10 These traces obiviously means that the validate method is called twice, the second time the ActionForm having empty fields. Does anybody know why such a thing would happen Thanks -- Seb' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Find Index Value
Use the indexId attribute from the nested:ietrate tag Thanks, Satish -Original Message- From: Srinivas Rao [mailto:[EMAIL PROTECTED] Sent: Thursday, June 10, 2004 2:18 PM To: Struts Users Mailing List Subject: How to Find Index Value Hi Friends, I am using tag. Here is the code i am writing What my problem is, how to get the index of select list in the tag ... I am able to getting the select lists but i am not getting the index of select lists. Please Help me .. Thanks Srinivas - Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Logic:iterate property
You can do it through bean:define or jsp:usebean custom tags Thanks, Satish -Original Message- From: Srilatha Ravuri [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 09, 2004 7:33 PM To: [EMAIL PROTECTED] Subject: Logic:iterate property Hi all, I have a question about the logic:iterate tag. I have the following in my jsp page. If I am not setting any attribute list like session.setAttribute("list", list) as I don't any action class forwarding to the jsp page. How do I grab the list into the jsp page if I have a class for countries list. Is it through bean:define. or through any java scriptlets. Thanks in advance Srilatha - 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:
Here is the code for defalt value SELECTED Thanks, Satish -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 09, 2004 8:00 AM To: [EMAIL PROTECTED] Subject: I try to create a drop down menu as follow: I am able to disply the menu. I want one of the options to be selected by default. Therefore, I want to type SELECTED somewhere. How do I do it? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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: user defined beans in form bean
Hi, You can use struts nested tags to retrieve the beans stored in the action form. Code snippet is as follows Thanks, Satish -Original Message- From: Jannu Winod [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 9:40 AM To: Struts Users Mailing List Subject: user defined beans in form bean how to handle user defined beans if we are using them in form beans. see the following code. Im looking for the jsp code in struts to define the text fields pls send me the code. with thnx. class MyBean { private String firstName; private String lastName; public void setFirstName(String strFirstName){ this.firstName=strFirstName; } public String getFirstName(){ return this.firstName; } public void setLastName(String strLastName){ this.lastName=strLastName; } public String getLastName(){ return this.lastName; } } FormBean : public class MyForm extends ActionForm { private MyBean mybean; private String ssno; public void setMybean(MyBean mybean){ this.mybean=mybean; } public MyBean getMybean(){ return this.mybean; } public void setSsno(String ssno){ this.ssno=ssno; } public String getSsno(){ return this.ssno; } } JSP: First Name : Last Name : SSNo : - Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Checking a default option in radio
Hi, Can I select a particular option as the default option in a set of radio buttons. If yes, then what is the way of doing it using nested:radio tag. Any code snippet will be very helpful Thanks, Satish
RE: Semi-OT: Organizing WEB-INF/lib dir...
Instead of you putting all the jar files in the WEB-INF/lib folder I would suggest that create a directory structure for libraries aoutside WEB-INF Advantages of this is this approach is cleaner and easily mantainable as You can add any new libraries with minimum of effort e.g the directory structure may look like Application libraries struts hibernate Web-inf lib classes And then use ant to include the jars in the classpath. All the web containers garantee that if you put the path of all the libraries using the manifest.mf (which is created when you create ur Application's WAR file) then the web container will include them in ur application's classpath A sample ant target for including the path of libraries in manifest.mf is given below Where ${project.manifest.classpath} contains the path of all the libraries. This has to be relative to web application root and not absolute path myweb.war -- the application's war file ${jar.dir} -- the directory from which to jar the files Please revert to me in case you require any other details Thanks, Satish Kataria -Original Message- From: Riyad Kalla [mailto:[EMAIL PROTECTED] Sent: Friday, June 04, 2004 9:29 AM To: Struts Users Mailing List Subject: Semi-OT: Organizing WEB-INF/lib dir... Quick question for the people more versed in web apps than me, can you organized your libs in your WEB-INF/lib dir into separate sub dirs? I ask because my project is using Struts and Hibernate right now, and there is a such a mish-mash of JARs forming in my WEB-INF/lib dir, that its hard for me to upgrade the right jars when a new release comes out. I'd like to have something like: WEB-INF/lib/struts WEB-INF/lib/hibernate or something to that extent. Can I do this? TIA - 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: struts workflow extension: help on workflow violation handling
Hi, There are certain things I wld want to point out: Lets assume you have page1 ,page2 and page3 as part of wizard. Page1 has a next button, page2 has next & back and page3 has back & submit button. I would create a formbean which contains attributes for all the 3 pages and define the formbean to be session scope. Also I would create one action class and write methods for all the actions triggered from wizard screens Code wld be like this: Struts-config.xml Assuming the actions for next and back on page2 are named page2next and page2back respectively similarly the action names for the rest of the pages as well The action class WizardAction wld have methods page1next,page2next,page3submit,page2back,page3back Hope this helps Thanks, Satish -Original Message- From: Derek [mailto:[EMAIL PROTECTED] Sent: Monday, April 12, 2004 2:14 AM To: [EMAIL PROTECTED] Subject: struts workflow extension: help on workflow violation handling I need some guidance and/or an example of how to achieve this... I have a multi-page wizard that uses a form bean (in the session) per page. "Next" and "Back" buttons submit to the same Action which is necessary to save all data entered into the form beans. On a workflow violation, I want the user to remain on the same wizard page that they were on and just display a message about the violation. It seems that when any violation occurs, no matter which page the user is on, the violation "handler" is called, the data in the session is removed and all workflows and states are removed. When running the demo application, it seems that the behavior is what I want but I can't seem to duplicate it in my application. Any help would be greatly appreciated. derek - 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]