RE: Converting a ResultSet to a List of POJOs
You could also consider using Torque. I believe it will generate a schema from an existing database that will allow you build a set of data aware objects. It also some good classes for working directly with XML. I wrote a simple Struts plugin to work with Torque. It's not as cool as Hibernate but it may get the job done and the code base has been around a while. I have been using it for over two years and have a good luck with it. http://db.apache.org/builds/torque/release/3.1/ r, Hugh plug-in className=com.dci.strutsdemo.plugins.TorquePlugin set-property property=pathnames value=E:/JakartaProjects/jakarta-struts/struts-demo/WEB-INF/Torque.properti es/ /plug-in /* * Created on May 19, 2003 * * To change the template for this generated file go to * WindowPreferencesJavaCode GenerationCode and Comments */ package com.dci.strutsdemo.plugins; import java.io.File; import javax.servlet.ServletException; import org.apache.struts.action.ActionServlet; import org.apache.struts.action.PlugIn; import org.apache.struts.config.ModuleConfig; import org.apache.torque.Torque; import org.apache.torque.TorqueException; /** * @author Administrator * * To change the template for this generated type comment go to * WindowPreferencesJavaCode GenerationCode and Comments */ public class TorquePlugin implements PlugIn { /** * A comma delimitted list of Validator resource. */ private String pathnames = null; /** * Gets a comma delimitted list of Validator resources. * @return comma delimited list of Validator resource path names */ public String getPathnames() { return pathnames; } /** * Sets a comma delimitted list of Validator resources. * @param pathnames delimited list of Validator resource path names */ public void setPathnames(String pathnames) { this.pathnames = pathnames; } /* (non-Javadoc) * @see org.apache.struts.action.PlugIn#destroy() */ public void destroy() { Torque.shutdown(); } /* (non-Javadoc) * @see org.apache.struts.action.PlugIn#init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig) */ public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { File file = new File(.); System.err.println(file.getAbsolutePath()); if (pathnames != null pathnames.length() 0) { System.out.println(pathnames); } try { Torque.init(pathnames); } catch (TorqueException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: Saturday, September 06, 2003 2:36 PM To: Struts Users Mailing List Subject: Re: Converting a ResultSet to a List of POJOs We wrote something like this at work: ResultSetTransformer is an interface with a single method: public Object instanceFromRow(java.sql.ResultSet rset) throws java.lang.Exception; We mostly use a single implementation of the interface which we call SimplePropertyMappedTransformerYou set the bean class when you construct the SPMT, and then for each call to instanceFromRow, it creates a new instance of the bean class and calls the following: protected void populateBean(Object bean, ResultSet rset) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.sql.SQLException { Map properties = new HashMap(); ResultSetMetaData metaData = rset.getMetaData(); int cols = metaData.getColumnCount(); for (int i = 1; i = cols; i++) { String value = rset.getString(i); if (value == null) { value = ; } log.debug(property: + metaData.getColumnName(i) + , value: + value); properties.put(metaData.getColumnName(i), value); } BeanUtils.populate(bean, properties); } This assumes that you can alias the column names in your SQL to property names. This works fine in Oracle, but I'm not very expert on the differences between ANSI SQL and Oracle SQL. If you had to, you make a version which also takes a Properties which mapped column names to bean property name. Then we have another layer which takes a SQL string and a ResultSetTransformer and is responsible for managing the connection, executing the query, and iterating through the
RE: Combining struts and JSTL tags...
This can happen if you have included the bean taglib twice. Is the page with which you get an error included via an %@ include statement? Paul -Original Message- From: Loren Hall [mailto:[EMAIL PROTECTED] Sent: 06 September 2003 00:13 To: Struts Users Mailing List Subject: RE: Combining struts and JSTL tags... i haven't found a resolution to a problem previously posted under another subject, since it fits this topic I thought i'd put it out there again. I started my app using struts tags, and recently incorporated jstl. Unfortunately I get an error when I import both struts-bean.tld and c.tld c.tld: urihttp://java.sun.com/jstl/core/uri) struts-bean.tld: urihttp://jakarta.apache.org/struts/tags-bean-1.0.2/uri) i.e. when these 2 taglib directives appear on a single .jsp %@ taglib uri=/WEB-INF/c.tld prefix=c % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % i get the following exception: jsp.error.tlv.invalid.page null: org.xml.sax.SAXParseException: Attribute xmlns:bean was already specified for element jsp:root. FULL ERROR MESSAGE ``` HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: jsp.error.tlv.invalid.page null: org.xml.sax.SAXParseException: Attribute xmlns:bean was already specified for element jsp:root. at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler. java:105) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430 ) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:112 ) at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:661) at org.apache.jasper.compiler.Validator.validate(Validator.java:613) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:230) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:4 73) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:1 90) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
Any potential drawbacks with this design
Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant G This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Bad URL transformation with Opera Browser and frames
Hi Adam, Thanks, but it doesn´t work. Now I´m writing html:base/ in my jsp with the frames, but this is translated in this waay: base href=http://localhost:8988/application/WEB-INF/jsp/fsPage.jsp; So, the base tag is translated with directory information, And of course it doesn´t work. Why? Thanks in advance. -Mensaje original- De: Adam Hardy [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 03 de septiembre de 2003 10:44 Para: Struts Users Mailing List Asunto: Re: Bad URL transformation with Opera Browser and frames Are you using the html:base/ tag in your page? It sounds like the browser is misinterpreting relative paths. Adam On 09/03/2003 08:19 AM Jose Ramon Diaz wrote: Hi all, I have an action frames.fo, which load a frame according to some arameters. It works rigth in explorer and Netscape, but when I load the URL in Opera browser, the pages URL of each frame is changed and it´s added the WEB-INF/jsp directory in the URL. I mean, for example, if the frameset is loaded in this page: http://loacalhost/application/frames.do?position=frameBottoma ction=default and in the source one frame is defined (and loaded in browser) in this way: frame name=bottomLeft marginwidth=0 marginheight=0 src=frames.do?posicion=frameBottomLeftaction=default scrolling=AUTO bordercolor=#66 frameborder=0 Opera browser gives the next error: Resource /application/WEB-INF/jsp/frames.do not found on this server I have all the JSPs inside WEB-INF directory to protect them. But I can´t imagine what´s the HTTP request Opera is doing. Why does it search for the JSP as if the URL contains WEB-INF directory? Can anybody help, please? Thanks Jose R. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - 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: Any potential drawbacks with this design
Better extend the RequestProcessor class. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Any potential drawbacks with this design Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant G - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Any potential drawbacks with this design
This is a common approach that many application use. The only possible drawback would be that a developer could bypass the common functionality by extending Action instead of your base Action class. But, in some cases, that might be preferable. As mentioned, extending the RequestProcessor is another alternative, but not everyone is comfortable with that. -Ted. [EMAIL PROTECTED] wrote: Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant G This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Any potential drawbacks with this design
I did look into the subclassing the RequestProcessor class as well. I am not sure if it can do the following -- throw Exceptions. -- NOT call the corresponding action class (instead return to a default page) depending on some conditions. Is there any advantage subclassing the RequestProcessor class as opposed to the implementation I wrote below. Regards Sreekant G @ 98404-65630 Viral_Thakkar [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] fosys.com cc: Subject: RE: Any potential drawbacks with this design 09/08/2003 02:36 PM Please respond to Struts Users Mailing List Better extend the RequestProcessor class. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Any potential drawbacks with this design Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: two actionForms for one action class?
- Original Message - From: Rick Col [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 06, 2003 4:12 PM Subject: two actionForms for one action class? Hi, Is there any way to use two action forms for one action class. I have the following situation: one html form (form1) and a go button for sample1.jsp, another html form (form2) and submit button for sample2.jsp. Once user clicks on go button, she will be directed to sample2.jsp, form1 values will be used and displayed on sample2.jsp. Once user clicks on submit button on sample2.jsp, form2 values should be saved to database. I need to desgin one action form (actionForm1) for form1 to be retrived and displayed on sample2.jsp, and design another action form (actionForm2) to be retrieved and saved to database. Thus, the action class I design for sample2.jsp needs two actionForms. I am wondering there is any way to set up two forms for one action class (in struts-config and elsewhere)? One way to do this is to assign actionForm1 to a property in actionForm2 in the Action1.execute() method: ... ActionForm2 form2 = new ActionForm2(); ... form2.setForm1(form1); // put form2 in the expected scope for sample2 action mapping ... return new ActionForward(/sample2.jsp); Then you could use the nested properties in form1 for possible display in the sample2.jsp. And save them, if desired, in the Action2.execute() method. Jing Netspread Carrier http://www.netspread.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Any potential drawbacks with this design
The difficulty with extending the RP occurs if not ALL the actions need this common functionality. Where this is the case your design is a good one. (I have used it to great effect in my own apps already). Id suggest you continue with this method. If you have other developers on the project make sure they know to extend your class if they need that functionality. You might also wish to declare the execute() method in your base class final so that they dont inadvertantly override it. -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Monday, 8 September 2003 17:25 To: Struts Users Mailing List Subject: Re: Any potential drawbacks with this design This is a common approach that many application use. The only possible drawback would be that a developer could bypass the common functionality by extending Action instead of your base Action class. But, in some cases, that might be preferable. As mentioned, extending the RequestProcessor is another alternative, but not everyone is comfortable with that. -Ted. [EMAIL PROTECTED] wrote: Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant G This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - 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]
Struts action in the login-config
I've been exploring the co-mingling of container-based security and struts actions through FORM-based authentication. While many options have been presented and discussed (including subclassing the Action and directly calling container-managed security methods), it seems to me (a newbie) that one obvious solution has not been addressed: What are the side-effects of directly pointing the error and login pages directly to a struts action (in the example below /login.do) , rather than to an HTML or JSP file? For example: login-config auth-methodFORM/auth-method form-login-config form-login-page/login.do/form-login-page form-error-page/loginError.do/form-error-page /form-login-config /login-config And in the view of the login form: form method=POST action=j_security_check Username: input type=text name=j_usernamebr / Password: input type=password name=j_passwordbr / /form If this won't work, what about pointing the login and error pages to a JSP, and using a logic:forward or a tiles:insert tag in the file to handle the request through struts? Am I missing something subtle (or not so subtle)? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Any potential drawbacks with this design
I'm interested in folks response to this also. This is the approach I have used on 2 different projects and seems to work very nicely. In addition, I modified the signature of my abstract method (in this case executeTask) to take a custom ActionForm with some additional functionality. It seems to be a convenient way to provide extra/common functionality for free using inheritance, but, I'd like to hear if anyone can think of any significant disadvantages to doing it this way. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 4:54 AM To: [EMAIL PROTECTED] Subject: Any potential drawbacks with this design Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant G This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Create new nested bean instance
Nate, you may want to look into indexed properties: http://jakarta.apache.org/struts/faqs/indexedprops.html and ListUtils.lazyList(): http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect ions/ListUtils.html robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 9:32 PM To: [EMAIL PROTECTED] Subject: Create new nested bean instance Hi, What is the proper Struts way to implement create/update pages in the following scenario. You've got a Customer Form bean with the following properties: - First Name - Last Name - List of PhoneNumber Beans A PhoneNumber bean with these properties: - Country Code - Area Code - Number - Description I'd like it to be set up like this: CreateCustomer.jsp has text fields for first and last name, and it displays the list of added phone numbers. It also has an Add New Phone Number link. This link takes you to AddPhoneNumber.jsp. This page has fields for all the phone number properties, and an Add button. When you press the Add button it returns you to the CreateCustomer.jsp. The list of phone numbers on this page will reflect the newly added phone number. The part of this I'm having trouble figuring out is how the List of phone number beans gets updated. Is there a way to tell Struts to add a new PhoneNumberBean to CustomerBean's list of phone numbers? Or do I have to do it myself in an Action? I haven't been able to find any examples like this with nested beans. All the nested examples I find just show you how to display nested data. I need to create new nested data and add it to the parent. Any help would be greatly appreciated. Thanks, Nate - 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: Any potential drawbacks with this design
+1 On 09/08/2003 10:53 AM [EMAIL PROTECTED] wrote: Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant G This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
click on button--save data--go to another page?
Hi, If I have a go button like this: html:submitbean:message key=button.go/html:submit once I click on this button on sample1.jsp, I want to save some data to database, then go to another jsp page sample2.jsp. I definne an action class to handle data saving. Thus, once user clicks on go button, user should be directed to the data saving action class first to save data, then go to sample.jsp page. In struts-config, I define mapping as the following: action path=/saveData.do type=SaveDataAction input=/sample.jsp name=saveDataForm .. forward name=sample2 path=/sample2.jsp /action Will that work? And I am not sure how I can make go button go to action class first and save data, then go to sample12.jsp? regards, __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Create new nested bean instance
Robert, Thanks for the links. I already read the Indexed Property FAQ (and I just re-read it again), but I didn't really see anything in it that relates to my problem. The lazyList stuff looks more promising. I have a question about it, though. Where do I create the new LazyList? In the ActionForms reset() method? Thanks again. Nate On Mon, 2003-09-08 at 06:18, Robert Taylor wrote: Nate, you may want to look into indexed properties: http://jakarta.apache.org/struts/faqs/indexedprops.html and ListUtils.lazyList(): http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect ions/ListUtils.html robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 9:32 PM To: [EMAIL PROTECTED] Subject: Create new nested bean instance Hi, What is the proper Struts way to implement create/update pages in the following scenario. You've got a Customer Form bean with the following properties: - First Name - Last Name - List of PhoneNumber Beans A PhoneNumber bean with these properties: - Country Code - Area Code - Number - Description I'd like it to be set up like this: CreateCustomer.jsp has text fields for first and last name, and it displays the list of added phone numbers. It also has an Add New Phone Number link. This link takes you to AddPhoneNumber.jsp. This page has fields for all the phone number properties, and an Add button. When you press the Add button it returns you to the CreateCustomer.jsp. The list of phone numbers on this page will reflect the newly added phone number. The part of this I'm having trouble figuring out is how the List of phone number beans gets updated. Is there a way to tell Struts to add a new PhoneNumberBean to CustomerBean's list of phone numbers? Or do I have to do it myself in an Action? I haven't been able to find any examples like this with nested beans. All the nested examples I find just show you how to display nested data. I need to create new nested data and add it to the parent. Any help would be greatly appreciated. Thanks, Nate - 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: Any potential drawbacks with this design
There is no *drawbacks* or *advantage* design in regard to extending Action or RequestProcessor. It depends. The key is how you actually interpret the word common: -If the *common* functionality is applicable to *all* action mappings in a given application module, you do it by extending RequestProcessor. For example, a custom security checking facility in RequestProcessor. -If the *common* functionality is required to happen before certain logic you do it by extending RequestProcessor. For example, a custom form token checking facility before the form bean population. -If the *common* functionality is applicable to a sub set of Action classes in the application module, then you do it by extending Action. For example, a CRUD operation for a set of business entities. And you also give other developers a way to interpret the CRUD operation differently when they see fit. I could see you have good reasons to extend Action. Jing Netspread Carrier http://www.netspread.com - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, September 08, 2003 5:43 AM Subject: RE: Any potential drawbacks with this design I did look into the subclassing the RequestProcessor class as well. I am not sure if it can do the following -- throw Exceptions. -- NOT call the corresponding action class (instead return to a default page) depending on some conditions. Is there any advantage subclassing the RequestProcessor class as opposed to the implementation I wrote below. Regards Sreekant G @ 98404-65630 Viral_Thakkar [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] fosys.com cc: Subject: RE: Any potential drawbacks with this design 09/08/2003 02:36 PM Please respond to Struts Users Mailing List Better extend the RequestProcessor class. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Any potential drawbacks with this design Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant - 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: click on button--save data--go to another page?
The action class that handles the saving of your data returns an ActionForward - your execute() code determines what that forward is. To go to sample2.jsp you want to end your execute() with: return mapping.findForward(sample2); Paul -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: 08 September 2003 14:03 To: [EMAIL PROTECTED] Subject: click on button--save data--go to another page? Hi, If I have a go button like this: html:submitbean:message key=button.go/html:submit once I click on this button on sample1.jsp, I want to save some data to database, then go to another jsp page sample2.jsp. I definne an action class to handle data saving. Thus, once user clicks on go button, user should be directed to the data saving action class first to save data, then go to sample.jsp page. In struts-config, I define mapping as the following: action path=/saveData.do type=SaveDataAction input=/sample.jsp name=saveDataForm .. forward name=sample2 path=/sample2.jsp /action Will that work? And I am not sure how I can make go button go to action class first and save data, then go to sample12.jsp? regards, __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] How to get an object stored in ServletContext from a SessionBean?
Hi, I know this is a bit OT, but here it is: any help is much appreciated. This relates to the Hibernate Plugin for Struts.. How do I get a handle on the SessionFactory that is stored in the ServletContext?? (From a SessionBean, that is) The following is a shortened (an uncompiled!) version of how the SessionFactory is stored... Colm import org.apache.struts.action.PlugIn; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cfg.Configuration; import java.net.URL; import javax.servlet.ServletContext; import javax.servlet.ServletException; public class HibernatePlugIn implements PlugIn { public void init(ActionServlet servlet, ModuleConfig config)throws ServletException { Configuration configuration = null; URL configFileURL = null; private SessionFactory factory = null; ServletContext context = null; configFileURL = new URL (/hibernate.cfg.xml); configuration = (new Configuration()).configure(configFileURL); factory = configuration.buildSessionFactory(); context = servlet.getServletContext(); context.setAttribute(SessionFactory.class.getName(), factory); } } ** This message is sent in confidence for the addressee only. The contents are not allowed to be disclosed to anyone other than the addressee. Unauthorised recipients must preserve this confidentiality and should please advise the sender immediately of any error in transmission. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
image property
Hi, The struts documentation of attribute property for image tag says that The property name of this image tag. The parameter names for the request will appear as property.x and property.y, the x and y representing the coordinates of the mouse click for the image. A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=) The image tag does not have a name or id attribute. If I have more than one image tag in a form how do I differentiate one getX() from another? For example, let consider that I have two image tags in my form. The ActionForm has the following lines public class MyForm extends ActionForm { private String x; public String getX(){ return(this.x); } .. Following the documentation how do I get the value of x in my JSP page? And how do I differentiate x values for the two image tags? Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Failing to get an answer,can it be done?
Thanks Mike. It is working now. -Original Message- From: Mike Jasnowski [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 5:37 PM To: Struts Users Mailing List Subject: RE: Failing to get an answer,can it be done? Are you sure the value isn't getting reset before it gets to your page? I assume no exceptions are being thrown which prevent the field from initializing, I saw earlier you're initializing this value in the constructor. What happens if you just leave the value assigned from the private instance var and have the accessor retrive that w/o the stuff in the constructor? html:image src='%= MapForm.mapSource() %' property= / From your example, I also assume you retrieved the MapForm object from the session in the proper scope? -Original Message- From: Das, Amar [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 4:37 PM To: 'Struts Users Mailing List' Subject: RE: Failing to get an answer,can it be done? Thanks. But it is not working. In my form bean (MapForm) I am setting the following variable public class MapForm extends ActionForm { /* Map Source*/ private String mapSource=http://geo.tpmc.com/output/dqs_GEO2056217212.jpg;; . public MapForm(){ try { mapSource = map.getMapOutput().getURL(); . Then on my jsp page I am using the following html:image src='%= MapForm.mapSource() %' property= / Any suggestion? -Original Message- From: Mike Jasnowski [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 3:16 PM To: Struts Users Mailing List Subject: RE: Failing to get an answer,can it be done? Sure, html:image src='%= formBean.url %'/ or wi html-el html:image src=${formBean.url}'/ I haven't used the html-el lib so I'm guessing on that last one -Original Message- From: Das, Amar [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Failing to get an answer,can it be done? Hi, Is it possible to set the src URL of an input image tag in the action form? For example, how can I assign a URL dynamically to the src attribute of an input tag of type image? html:form .. html:image src=??? / /html:form Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question
Hi all, I think I have a relative easy question. I have a J2EE application which has some entitybeans. I want to display the values of these entitybeans in my JSP pages (using Struts). I have made value objects of the entitybeans. In my ListAllCategoriesAction.java, I do something like the following: Collection allCategories = mySessionFacade.getAllCategories(); DisplayBean displayBean = new DisplayBean(); displayBean.setCategories(allCategories); request.setAttribute(categories, displayBean); return mapping.findforward( SUCCESS ); As you can see I'm using a special bean (displayBean) to pass the categories to my JSP page. In my JSP page I use the logic:iterate tags to iterate through te collection and display the proper information. Is this a normal / good approach? Or do I have to use ActionForm classes for this purpose? Thanks a lot, Harm de Laat Informatiefabriek The Netherlands - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: image property
You might try using an ImageButtonBean. A lot of the work you are doing is done in this bean. Here is the documentation: http://jakarta.apache.org/struts/api/org/apache/struts/util/ImageButtonBean. html HTH, Peter -- Peter Smith Software Engineer InfoNow Corporation From: Das, Amar [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 8 Sep 2003 09:53:22 -0400 To: [EMAIL PROTECTED] Subject: image property Hi, The struts documentation of attribute property for image tag says that The property name of this image tag. The parameter names for the request will appear as property.x and property.y, the x and y representing the coordinates of the mouse click for the image. A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=) The image tag does not have a name or id attribute. If I have more than one image tag in a form how do I differentiate one getX() from another? For example, let consider that I have two image tags in my form. The ActionForm has the following lines public class MyForm extends ActionForm { private String x; public String getX(){ return(this.x); } .. Following the documentation how do I get the value of x in my JSP page? And how do I differentiate x values for the two image tags? Thanks in advance - 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: Any potential drawbacks with this design
Jing sums up the situation well. One point to add :- if it (the functionality) is applicable to all the actions today and you decide to go with the RP approach, that doesnt mean that tomorrow you wont suddenly need to add an action to which it should NOT be applied - at which point you will then either have to factor it out of the RP into some base action anyway - or do it conditional on checking some flag - at which point you run the risk of introducing action logics into the RP... My votes with the Action approach :-) -Original Message- From: Jing Zhou [mailto:[EMAIL PROTECTED] Sent: Monday, 8 September 2003 21:20 To: Struts Users Mailing List Subject: Re: Any potential drawbacks with this design There is no *drawbacks* or *advantage* design in regard to extending Action or RequestProcessor. It depends. The key is how you actually interpret the word common: -If the *common* functionality is applicable to *all* action mappings in a given application module, you do it by extending RequestProcessor. For example, a custom security checking facility in RequestProcessor. -If the *common* functionality is required to happen before certain logic you do it by extending RequestProcessor. For example, a custom form token checking facility before the form bean population. -If the *common* functionality is applicable to a sub set of Action classes in the application module, then you do it by extending Action. For example, a CRUD operation for a set of business entities. And you also give other developers a way to interpret the CRUD operation differently when they see fit. I could see you have good reasons to extend Action. Jing Netspread Carrier http://www.netspread.com - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, September 08, 2003 5:43 AM Subject: RE: Any potential drawbacks with this design I did look into the subclassing the RequestProcessor class as well. I am not sure if it can do the following -- throw Exceptions. -- NOT call the corresponding action class (instead return to a default page) depending on some conditions. Is there any advantage subclassing the RequestProcessor class as opposed to the implementation I wrote below. Regards Sreekant G @ 98404-65630 Viral_Thakkar [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] fosys.com cc: Subject: RE: Any potential drawbacks with this design 09/08/2003 02:36 PM Please respond to Struts Users Mailing List Better extend the RequestProcessor class. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Any potential drawbacks with this design Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the execute() method in MyOwnAction class in which I am doing my desired common functionality. I am also publishing an abstract method executeTask() which should be overridden by the all the application action classes The executeTask() method is called by the execute() method of MOwnAction class. Basically the executeTask() is now the method where the application action classes will write the application code as opposed to execute(). Regards Sreekant - 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]
Plug-in API
Hi I am just trying to learn about the Plug-in API. When exactly is this useful ? How would it be helpful if I want to plug-in a custom-user authentication facility instead of using the vendorspecific XML file ( JDBC realm in tomcat for example ). Mohan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
Yes. This is a normal approach. ActionForms are used only if you want to pre-populate data. i.e If you have to show default values in a text field you can pre-populate the Action Form and forward to a JSP. You can also store a Collection directly in one of the scopes and show that but Custom beans like this are useful because they can be manipulated quite well with the tag handlers. Mohan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 7:15 PM To: [EMAIL PROTECTED] Subject: simple question Hi all, I think I have a relative easy question. I have a J2EE application which has some entitybeans. I want to display the values of these entitybeans in my JSP pages (using Struts). I have made value objects of the entitybeans. In my ListAllCategoriesAction.java, I do something like the following: Collection allCategories = mySessionFacade.getAllCategories(); DisplayBean displayBean = new DisplayBean(); displayBean.setCategories(allCategories); request.setAttribute(categories, displayBean); return mapping.findforward( SUCCESS ); As you can see I'm using a special bean (displayBean) to pass the categories to my JSP page. In my JSP page I use the logic:iterate tags to iterate through te collection and display the proper information. Is this a normal / good approach? Or do I have to use ActionForm classes for this purpose? Thanks a lot, Harm de Laat Informatiefabriek The Netherlands - 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]
Exception running Tomcat
Hi all, I am a newbie in struts, and I am having some problems with them. I am trying to execute tomcat, but I get this exception: INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true 08-sep-2003 16:11:24 org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true 08-sep-2003 16:11:24 org.apache.commons.digester.Digester fatalError GRAVE: Parse Fatal Error at line 69 column -1: El siguiente carßcter debe ser cerrando comentario . org.xml.sax.SAXParseException: El siguiente carßcter debe ser cerrando comentario . at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182) at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3176) at org.apache.crimson.parser.Parser2.nextChar(Parser2.java:3098) I have struts.jar and all commons-*.jar on my classpath. Someone can help me, please? _ Mariano García Ingeniero de Sistemas Optiva Media Viriato,25 - 28010 Madrid - España t. +34 91 445 96 95 m. +34 651 03 33 86 © This message is printed on 100% recycled electrons. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Plug-in API
--- Mohan Radhakrishnan [EMAIL PROTECTED] wrote: Hi I am just trying to learn about the Plug-in API. When exactly is this useful ? How would it be helpful if I want to plug-in a custom-user authentication facility instead of using the vendorspecific XML file ( JDBC realm in tomcat for example ). Plugins are really only helpful to people using a Servlet 2.2 container. If you're using Servlet 2.3 you should use a ServletContextListener. David Mohan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Plug-in API
Struts Plug-In is useful any time you have a resource that needs to be initialized with the web application. In the past you would have needed to extend the ActionServlet and override init(), now you declare a plug-in in your struts-config.xml Troy Mohan Radhakrishnan wrote: Hi I am just trying to learn about the Plug-in API. When exactly is this useful ? How would it be helpful if I want to plug-in a custom-user authentication facility instead of using the vendorspecific XML file ( JDBC realm in tomcat for example ). Mohan - 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: Plug-in API
At 7:40 -0700 9/8/03, David Graham wrote: Plugins are really only helpful to people using a Servlet 2.2 container. If you're using Servlet 2.3 you should use a ServletContextListener. I don't know (but I doubt) that there is a determinate order to how containers process contextInitialized On the other hand, Struts processes plugins in order. I know one developer who leverages this predictability to initialize a series of specialist classes, and then finally a facade type class which proxies for the others. I don't know the details, but this is one other possible use case. Also, PlugIns are module aware -- the initialize method gets a ModuleConfig object. That might matter to some implementations. I suspect in many cases where I use PlugIns, I could be using ServletContextListeners instead, but I haven't broken the habit yet. But the gist is the same -- some component you write needs to know when the application context has been initialized. Joe -- -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com If nature worked that way, the universe would crash all the time. --Jaron Lanier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Plug-in API
+1 Ive always found plugins by far the more convienient of the various methods of initialising stuff at startup. -Original Message- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: Monday, 8 September 2003 22:51 To: Struts Users Mailing List Subject: Re: Plug-in API At 7:40 -0700 9/8/03, David Graham wrote: Plugins are really only helpful to people using a Servlet 2.2 container. If you're using Servlet 2.3 you should use a ServletContextListener. I don't know (but I doubt) that there is a determinate order to how containers process contextInitialized On the other hand, Struts processes plugins in order. I know one developer who leverages this predictability to initialize a series of specialist classes, and then finally a facade type class which proxies for the others. I don't know the details, but this is one other possible use case. Also, PlugIns are module aware -- the initialize method gets a ModuleConfig object. That might matter to some implementations. I suspect in many cases where I use PlugIns, I could be using ServletContextListeners instead, but I haven't broken the habit yet. But the gist is the same -- some component you write needs to know when the application context has been initialized. Joe -- -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com If nature worked that way, the universe would crash all the time. --Jaron Lanier - 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: Plug-in API
--- Joe Germuska [EMAIL PROTECTED] wrote: At 7:40 -0700 9/8/03, David Graham wrote: Plugins are really only helpful to people using a Servlet 2.2 container. If you're using Servlet 2.3 you should use a ServletContextListener. I don't know (but I doubt) that there is a determinate order to how containers process contextInitialized From the Servlet 2.3 spec: SRV.10.3.2 Deployment Declarations Listener classes are declared in the web application deployment descriptor using the listener element. They are listed by class name in the order in which they are to be invoked. On the other hand, Struts processes plugins in order. I know one developer who leverages this predictability to initialize a series of specialist classes, and then finally a facade type class which proxies for the others. I don't know the details, but this is one other possible use case. Also, PlugIns are module aware -- the initialize method gets a ModuleConfig object. That might matter to some implementations. That's really the only reason I can think of to use PlugIns instead of the standard listeners. David I suspect in many cases where I use PlugIns, I could be using ServletContextListeners instead, but I haven't broken the habit yet. But the gist is the same -- some component you write needs to know when the application context has been initialized. Joe -- -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com If nature worked that way, the universe would crash all the time. --Jaron Lanier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Validator] E-Mail Verification
Is there a published specification on e-mail addresses? The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes Comments? Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Create new nested bean instance
Yep. You could create the new lazy list in the form reset(). robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 9:29 AM To: Struts Users Mailing List Subject: RE: Create new nested bean instance Robert, Thanks for the links. I already read the Indexed Property FAQ (and I just re-read it again), but I didn't really see anything in it that relates to my problem. The lazyList stuff looks more promising. I have a question about it, though. Where do I create the new LazyList? In the ActionForms reset() method? Thanks again. Nate On Mon, 2003-09-08 at 06:18, Robert Taylor wrote: Nate, you may want to look into indexed properties: http://jakarta.apache.org/struts/faqs/indexedprops.html and ListUtils.lazyList(): http://jakarta.apache.org/commons/collections/api/org/apache/commo ns/collect ions/ListUtils.html robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 9:32 PM To: [EMAIL PROTECTED] Subject: Create new nested bean instance Hi, What is the proper Struts way to implement create/update pages in the following scenario. You've got a Customer Form bean with the following properties: - First Name - Last Name - List of PhoneNumber Beans A PhoneNumber bean with these properties: - Country Code - Area Code - Number - Description I'd like it to be set up like this: CreateCustomer.jsp has text fields for first and last name, and it displays the list of added phone numbers. It also has an Add New Phone Number link. This link takes you to AddPhoneNumber.jsp. This page has fields for all the phone number properties, and an Add button. When you press the Add button it returns you to the CreateCustomer.jsp. The list of phone numbers on this page will reflect the newly added phone number. The part of this I'm having trouble figuring out is how the List of phone number beans gets updated. Is there a way to tell Struts to add a new PhoneNumberBean to CustomerBean's list of phone numbers? Or do I have to do it myself in an Action? I haven't been able to find any examples like this with nested beans. All the nested examples I find just show you how to display nested data. I need to create new nested data and add it to the parent. Any help would be greatly appreciated. Thanks, Nate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Validator] E-Mail Verification
--- Jerry Jalenak [EMAIL PROTECTED] wrote: Is there a published specification on e-mail addresses? I believe it's RFC 822. The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes Unfortunately, I think that's a valid email address as defined in the RFC. David Comments? Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Validator] E-Mail Verification
Is there a published specification on e-mail addresses? The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes Comments? There was discussion about this earlier on the mailing list. Search the archives for email validation RFC or some such. There's an RFC that covers what're valid email addresses. Your example looks perfectly valid to me... -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TMC Petshop, java performance tuning, struts
I have recently read the results paper from the second benchmark test run by The Middleware Company (TMC) comparing the performance of the Petshop application using Java solution and .NET solutions. (http://www.middleware-company.com/casestudy/tmc-performance-study-jul-2003.pdf) This paper would be very useful I believe to anyone who is interested in fine tuning the performance of their application and server. IMO the results paper seems to suggest that Java solutions can be just as fast as .NET solutions but that some Java solutions can be much much worse. In particular, a java solution using struts is unlikely to perform as well as a solution that does not use some form of introspection (as struts does to populate beans from forms). I have several questions regarding these conclusions. 1. Are they accurate based on the evidence presented in the study 2. Does anyone know the identities of the two java servers used in the study 3. In using struts does the productivity gains outway the performance cost and can this performance cost be adequately mitigated by upgrading hardware. 4. Have any similar tests been run in which the Java servers are run on Unix platforms instead of Windows Server 2003. 5. Has anyone performing tests on their own struts apps found similar results concerning the high costs of the introspection process. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
What you are doing should be fine (as long as your collection is not too terribly big). You use an ActionForm when you want to collect input from the user. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 9:45 AM To: [EMAIL PROTECTED] Subject: simple question Hi all, I think I have a relative easy question. I have a J2EE application which has some entitybeans. I want to display the values of these entitybeans in my JSP pages (using Struts). I have made value objects of the entitybeans. In my ListAllCategoriesAction.java, I do something like the following: Collection allCategories = mySessionFacade.getAllCategories(); DisplayBean displayBean = new DisplayBean(); displayBean.setCategories(allCategories); request.setAttribute(categories, displayBean); return mapping.findforward( SUCCESS ); As you can see I'm using a special bean (displayBean) to pass the categories to my JSP page. In my JSP page I use the logic:iterate tags to iterate through te collection and display the proper information. Is this a normal / good approach? Or do I have to use ActionForm classes for this purpose? Thanks a lot, Harm de Laat Informatiefabriek The Netherlands - 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]
Tiles problem?
Hi all I have JSP code which used to work with older struts versions (1.1 beta xy). Now I use struts 1.1 stable release. I have two jsp pages. I want to nest JSPPage2 into JSPPage1 with tiles:insert ( see JSPCode ). All I get is [ServletException in:/WEB-INF/pages/JSPPage2.jsp] Cannot find bean in any scope' With debugging I have found out that JSP Page 2 losses the parent context (I mean the bean which is assosiated to the /RegisterAddressAction.do action in struts-config.xml). How can I handle over the parent context to the nested JSPPage2 tile? Thanks for any help Roland JSPPage1 -- %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-nested.tld prefix=nested % %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % nested:form action=/RegisterAddressAction.do nested:nest property=orderFB table width=100% border=0 cellspacing=1 tr td class=subtitlebean:message key=jsp.registerAddress.title//td td class=subtitle width=20%html:image property=method_continueShopping src=images/16x16/normal/Purchases-txweitereinkaufen.gif titleKey=common.tooltip.continueShopping align=absbottom/html:image/td /tr /table pbean:message key=jsp.registerAddress.text1//p span class=kleineSchriftbean:message key=common.label.mustFields//span/p p nested:checkbox property=billingEqualShippingAddress value=true /bean:message key=jsp.registerAddress.text2/ /p /nested:nest *** tiles:insert attribute=billingAddress / *** table width=100% border=0 cellspacing=1 tr td width=30%nbsp;/td td width=2%nbsp;/td tdhtml:image property=method_submitAddresses src=images/16x16/normal/Forward-2-txweiter.gif titleKey=common.tooltip.next align=absbottom/html:image/td /tr /table /nested:form end JSPPage1 JSPPage2 (is referenced by tiles:insert attribute=billingAddress / ) %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-nested.tld prefix=nested % nested:nest property=orderFB nested:nest property=orderBean table width=100% border=0 cellspacing=1 tr td colspan=3 class=menubean:message key=jsp.registerAddress.billingAddressSection.title//td /tr tr td width=30%bean:message key=common.label.company//td td width=2%nbsp;/td td nested:text property=invoiceCompany size=50 maxlength=50/ /td /tr /table /nested:nest /nested:nest ---end JSPPage2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Validator] E-Mail Verification
David / Tero - Thanks for the guidance. The RFC822 spec is what I was looking for Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Paananen, Tero [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:34 AM To: 'Struts Users Mailing List' Subject: RE: [Validator] E-Mail Verification Is there a published specification on e-mail addresses? The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes Comments? There was discussion about this earlier on the mailing list. Search the archives for email validation RFC or some such. There's an RFC that covers what're valid email addresses. Your example looks perfectly valid to me... -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: iterator tag
You sure? 'cause normally what I got is just nothing if the list is empty. If the collection you are iterating over contain null values, the loop will still be performed but no page scope attribute (named by the id attribute) will be created for that loop iteration. You can use the logic:present and logic:notPresent tags to test for this case. However, the *brand new* collection has to be defined somehow, i.e., itself cannot be null. Hope this helps. -Original Message- From: LUCERO,DENNIS (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: September 6, 2003 2:34 PM To: ' ([EMAIL PROTECTED])' Subject: iterator tag What is the correct behavior of the logic:iterator tag when given a collection of size zero (when the named collection is a brand new linkedList this tag causes a page to crash??) We come from the land of the ice and snow With the midnight sun, where the hot springs glow The hammer of the gods, will drive our ships to new lands Fight the horde, Sing and cry Valhalla I am coming - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Validator] E-Mail Verification
David Graham [EMAIL PROTECTED] wrote: --- Jerry Jalenak [EMAIL PROTECTED] wrote: Is there a published specification on e-mail addresses? I believe it's RFC 822. Unfortunately, I think that's a valid email address as defined in the RFC. You're better off writing your own. RFC 822 is very generous because it doesn't just deal with remote internet addresses, but email from all sorts of networks. Here's an example of something that's a bit more restrictive. This first runs it through javax.mail.internet.InternetAddress(). You'll need to have the javax.mail package installed to use it. Then it performs additional restrictions (we want to disallow local addresses). private boolean isRemoteAddressSyntax(String emailAddress) { int firstAtPos = emailAddress.indexOf('@'); int lastAtIndexOf = emailAddress.lastIndexOf('@'); int lastDotIndexOf = emailAddress.lastIndexOf('.'); // Must be one @ if (-1 == firstAtPos) return false; // Must be at least one character before @ if (1 firstAtPos) return false; // Must be at least one '.' if (-1 == lastDotIndexOf) return false; // Only one @ allowed. if (firstAtPos != lastAtIndexOf) return false; // '.' must be at least one character after '@' if (lastDotIndexOf (firstAtPos + 2)) return false; // Must be at least one character after '.' if (lastDotIndexOf == (emailAddress.length() - 1)) return false; return true; } public boolean isValidBasicEmailSyntax(String emailAddress) { try { javax.mail.internet.InternetAddress anAddress = new javax.mail.internet.InternetAddress(emailAddress); return isRemoteAddressSyntax(emailAddress); } catch(javax.mail.internet.AddressException anAddressException) { return false; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What's a well defined Struts Project Structure?
What a well defined struts project structure would look like? I am always a bit hesitant with where to put things Right now, I have: MyProject |- documentation |- images |- jsps |- styles |- javascript |- WEB-INF |- classes |- bin struts-config.xml *.tld project.xml ... But I always run into problems with too many files in one folder or too few files in one folder. I searched the apache CVS tree, and found that it's a mess there too. Just compare Tomcat and Struts, you will know what I am talking about. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: image property
Is there any example of using these utility tags? Amar -Original Message- From: Peter Smith [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:09 AM To: Struts Users Mailing List Subject: Re: image property You might try using an ImageButtonBean. A lot of the work you are doing is done in this bean. Here is the documentation: http://jakarta.apache.org/struts/api/org/apache/struts/util/ImageButtonBean. html HTH, Peter -- Peter Smith Software Engineer InfoNow Corporation From: Das, Amar [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 8 Sep 2003 09:53:22 -0400 To: [EMAIL PROTECTED] Subject: image property Hi, The struts documentation of attribute property for image tag says that The property name of this image tag. The parameter names for the request will appear as property.x and property.y, the x and y representing the coordinates of the mouse click for the image. A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property=) The image tag does not have a name or id attribute. If I have more than one image tag in a form how do I differentiate one getX() from another? For example, let consider that I have two image tags in my form. The ActionForm has the following lines public class MyForm extends ActionForm { private String x; public String getX(){ return(this.x); } .. Following the documentation how do I get the value of x in my JSP page? And how do I differentiate x values for the two image tags? Thanks in advance - 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: TMC Petshop, java performance tuning, struts
On Fri, 5 Sep 2003, tum curtin wrote: Date: Fri, 05 Sep 2003 08:59:01 -0400 From: tum curtin [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: TMC Petshop, java performance tuning, struts I have recently read the results paper from the second benchmark test run by The Middleware Company (TMC) comparing the performance of the Petshop application using Java solution and .NET solutions. (http://www.middleware-company.com/casestudy/tmc-performance-study-jul-2003.pdf) This paper would be very useful I believe to anyone who is interested in fine tuning the performance of their application and server. IMO the results paper seems to suggest that Java solutions can be just as fast as .NET solutions but that some Java solutions can be much much worse. In particular, a java solution using struts is unlikely to perform as well as a solution that does not use some form of introspection (as struts does to populate beans from forms). I have several questions regarding these conclusions. 1. Are they accurate based on the evidence presented in the study I would presume they are accurately measured (have no way to verify), but the key to understanding this test is the description of the testing scenario. They spent a LOT of time tuning things so that the database and network were not bottlenecks; the goal being to measure the CPU time in the middle tier. While that's interesting, how often is it relevant in the real world, where database and network latencies are the normal bottlenecks to response time? 2. Does anyone know the identities of the two java servers used in the study Anybody who authoritatively answers that question is in big time trouble because it would break NDA agreements :-). 3. In using struts does the productivity gains outway the performance cost and can this performance cost be adequately mitigated by upgrading hardware. For the first part of this question, you need to determine if it even matters in your particular app. For the second part, it's mitigated by adding more/faster CPUs. 4. Have any similar tests been run in which the Java servers are run on Unix platforms instead of Windows Server 2003. I did some microbenchmarks on the commons-beanutils code that is in turn used by Struts -- see the message archives for the [EMAIL PROTECTED] mailing list and search for microbenchmarks. A couple of things my tests showed were pretty interesting: * When using BeanUtils.copyProperties() or PropertyUtils.copyProperties(), using a DynaActionForm (which uses a HashMap but no reflection) is actually faster than using standard ActionForm beans. * The BeanUtils.populate() method -- which is expressly tuned to deal with copying request attributes into your form bean -- is substantially faster than BeanUtils.copyProperties() is. * As expected, recent JVMs are substantially faster than earlier ones at reflection-based processing. 5. Has anyone performing tests on their own struts apps found similar results concerning the high costs of the introspection process. It can only possibly matter if CPU time on your middle tier server (the one running your webapps) is your response time bottleneck. Is it for you? If so, then this matters. If not, then it probably doesn't. IMHO, the most important single issue for performance of Struts based apps is the quality of your JSP page compiler. Just as an example, the Tomcat admin app is Struts based, and the difference between running it against an early 4.0.x version versus current 4.1.x or 5.0.x versions is night and day -- six times to eight times faster, and visibly more responsive even in a single user environment. If you're looking for performance improvements, in general you should focus on: * JDK you're running * JSP page compiler * Servlet container you're running * Database tuning * Network tuning before getting to the minutiae of CPU time comparisons for things like reflection. Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What's a well defined Struts Project Structure?
Here's what I do - based on Erik Hatcher's recommendations in his Java Development with Ant book: MyProject | - lib (third party jars, etc.) | src (.java files) | test (junit, cactus, webtest tests) | web | images | styles | scripts | WEB-INF | classes | .properties and .xml files web.xml struts-config.xml build.xml For a working example, checkout my appfuse project at: http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse HTH, Matt -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:37 AM To: 'Struts Users Mailing List' Subject: What's a well defined Struts Project Structure? What a well defined struts project structure would look like? I am always a bit hesitant with where to put things Right now, I have: MyProject |- documentation |- images |- jsps |- styles |- javascript |- WEB-INF |- classes |- bin struts-config.xml *.tld project.xml ... But I always run into problems with too many files in one folder or too few files in one folder. I searched the apache CVS tree, and found that it's a mess there too. Just compare Tomcat and Struts, you will know what I am talking about. Thanks! - 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: Create new nested bean instance
Ok, the thing I don't understand now is how to setup the AddNewPhoneNumber jsp so that is uses the lazy list to create a new PhoneNumber instance bean. I'm trying to use the nested taglib, but I don't really understand how to set the top level object to be a new instance out of the list. I've tried something like this: nested:nest property=phoneNumbers nested:text property=countryCode / nested:text property=areadCode / nested:text property=number / nested:text property=description / /nested:nest The thing I can't figure out is how you set the top-level object to be a new instance of the PhoneNumber bean (which should be created from the lazy list). I tried using nested:nest property=phoneNumbers, but that gives me an error stating No getter for property phoneNumbers.countryCode of bean customerForm. I figure that is because the nested:nest sets the top-level object to be the List, and doesn't actually attempt to get an item out of the list (which would cause the lazy list factory to create a new PhoneNumber instance). How is this supposed to work? Am I on the right track at all? Anyone have a link to an example like what I'm trying to do? Thanks. Nate On Mon, 2003-09-08 at 11:41, Robert Taylor wrote: Yep. You could create the new lazy list in the form reset(). robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 9:29 AM To: Struts Users Mailing List Subject: RE: Create new nested bean instance Robert, Thanks for the links. I already read the Indexed Property FAQ (and I just re-read it again), but I didn't really see anything in it that relates to my problem. The lazyList stuff looks more promising. I have a question about it, though. Where do I create the new LazyList? In the ActionForms reset() method? Thanks again. Nate On Mon, 2003-09-08 at 06:18, Robert Taylor wrote: Nate, you may want to look into indexed properties: http://jakarta.apache.org/struts/faqs/indexedprops.html and ListUtils.lazyList(): http://jakarta.apache.org/commons/collections/api/org/apache/commo ns/collect ions/ListUtils.html robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 9:32 PM To: [EMAIL PROTECTED] Subject: Create new nested bean instance Hi, What is the proper Struts way to implement create/update pages in the following scenario. You've got a Customer Form bean with the following properties: - First Name - Last Name - List of PhoneNumber Beans A PhoneNumber bean with these properties: - Country Code - Area Code - Number - Description I'd like it to be set up like this: CreateCustomer.jsp has text fields for first and last name, and it displays the list of added phone numbers. It also has an Add New Phone Number link. This link takes you to AddPhoneNumber.jsp. This page has fields for all the phone number properties, and an Add button. When you press the Add button it returns you to the CreateCustomer.jsp. The list of phone numbers on this page will reflect the newly added phone number. The part of this I'm having trouble figuring out is how the List of phone number beans gets updated. Is there a way to tell Struts to add a new PhoneNumberBean to CustomerBean's list of phone numbers? Or do I have to do it myself in an Action? I haven't been able to find any examples like this with nested beans. All the nested examples I find just show you how to display nested data. I need to create new nested data and add it to the parent. Any help would be greatly appreciated. Thanks, Nate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Searching facility questions
Hide your .jsp files in /WEB-INF/foo (I use /WEB-INF/pages) so that the user cannot navigate directly to them. Alternatively hide them ANYWHERE so they cannot directly link to them. -Original Message- From: Marco Tedone [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 2:03 PM To: Struts-user-list Subject: Searching facility questions Ok, let's say that I would like to translate system's specific URLs (i.e. D:\Tomcat\webapps\foo\foo\bar.jsp and so on...) into web-context specific URLs (i.e. http://myServer/foo/foo/bar.jsp). Well, if I immagine to replace D:\Tomcat\webapps with http://myServer things seem quite easy. My first question is: did anyone encountered this problem before? Secondly a JSP page not necessarily can be executed without passing from a Struts Action (i.e. an Action prepared some data to display, and if we try to access the JSP directly we could have some bad 5 minutes), so my question is: did anyone encountered this kind of problem? Did you find any solution? For this second subject, I could think to a sort of mapping file between JSPs and relevant actions, so that we can assume that if the user clicks on a JSP link, instead the relevant action for that JSP will be executed and then the JSP displayed. The mainteinance for this solution seems CRAP. Hope someone of you will help, Marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What's a well defined Struts Project Structure?
How about documentation folder and jsp files, where would you put them? BTW, I was studying a tool called Maven on Apache. I think it's more relevant to project structure than Ant. Ant is more related to building a project, isn't it? Is there a standard project model/pattern out there we can just follow? -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: September 8, 2003 11:06 AM To: 'Struts Users Mailing List' Subject: RE: What's a well defined Struts Project Structure? Here's what I do - based on Erik Hatcher's recommendations in his Java Development with Ant book: MyProject | - lib (third party jars, etc.) | src (.java files) | test (junit, cactus, webtest tests) | web | images | styles | scripts | WEB-INF | classes | .properties and .xml files web.xml struts-config.xml build.xml For a working example, checkout my appfuse project at: http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse HTH, Matt -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:37 AM To: 'Struts Users Mailing List' Subject: What's a well defined Struts Project Structure? What a well defined struts project structure would look like? I am always a bit hesitant with where to put things Right now, I have: MyProject |- documentation |- images |- jsps |- styles |- javascript |- WEB-INF |- classes |- bin struts-config.xml *.tld project.xml ... But I always run into problems with too many files in one folder or too few files in one folder. I searched the apache CVS tree, and found that it's a mess there too. Just compare Tomcat and Struts, you will know what I am talking about. Thanks! - 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]
FW: Struts 1.0 problem
Hi All, We recently ported the weblogic server from SP1 to SP4 and came accross the following problem while displaying the JSP pages. This was working fine on SP1. Can anyone tell me the possible reason. The line of code in the jsp is : bean:write name=%=formBean% property=name[53] scope=request/ where 53 is a input parameter of getName(int size) method of FormBean. Thanks Naveen Sep 6, 2003 9:45:51 AM EDT Error HTTP 101017 [ServletContext(id=3964479,name=/,context-path=)] Root cause of ServletException java.lang.IllegalArgumentException: Property 'name' is not indexed at org.apache.struts.util.PropertyUtils.getIndexedProperty(PropertyUtils.java:373) at org.apache.struts.util.PropertyUtils.getIndexedProperty(PropertyUtils.java:314) at org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.java:424) at org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:453) at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:503) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._jsp.__clientdirdepv1_45_37._jspService(__clientdirdepv1_45_37.java: 1249) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStu bImpl.java:1075) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418 ) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:20) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.ja va:315) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:1 759) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStu bImpl.java:1075) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418 ) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:20) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at FrontDoorFilter.doFilter(FrontDoorFilter.java:146) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAp pServletContext.java:5523) at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.ja va:685) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContex t.java:3156) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:250 6) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts 1.0 problem
You want to make sure that formBean you compiled has only the simple bean class itself and nothing more, i.e. there is no other BeanInfo class compile with it. This once time my co-worker accidentally hit some bean wizard in Jbuilder and it generate some BeanInfo class that get compiled and he has the exact oout come like yours. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 11:05 AM To: [EMAIL PROTECTED] Subject: FW: Struts 1.0 problem Hi All, We recently ported the weblogic server from SP1 to SP4 and came accross the following problem while displaying the JSP pages. This was working fine on SP1. Can anyone tell me the possible reason. The line of code in the jsp is : bean:write name=%=formBean% property=name[53] scope=request/ where 53 is a input parameter of getName(int size) method of FormBean. Thanks Naveen Sep 6, 2003 9:45:51 AM EDT Error HTTP 101017 [ServletContext(id=3964479,name=/,context-path=)] Root cause of ServletException java.lang.IllegalArgumentException: Property 'name' is not indexed at org.apache.struts.util.PropertyUtils.getIndexedProperty(PropertyUtils.java:3 73) at org.apache.struts.util.PropertyUtils.getIndexedProperty(PropertyUtils.java:3 14) at org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.java:42 4) at org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:453) at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:503) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._jsp.__clientdirdepv1_45_37._jspService(__clientdirdepv1_45_37.j ava: 1249) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle tStu bImpl.java:1075) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :418 ) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:20) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.ja va:315) at org.apache.struts.action.ActionServlet.processActionForward(ActionServletja va:1 759) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle tStu bImpl.java:1075) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :418 ) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:20) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at FrontDoorFilter.doFilter(FrontDoorFilter.java:146) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W ebAp pServletContext.java:5523) at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage r.ja va:685) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntex t.java:3156) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :250 6) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message and any attachments are for the intended recipient(s) only and may contain privileged, confidential and/or proprietary information about Downey Savings or its customers, which Downey Savings does not intend to disclose to the public. If you received this message by mistake, please notify the sender by reply e-mail and delete the message and attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: What's a well defined Struts Project Structure?
For documentation - I'd create a docs folder at the basedir level. Maven is a very slick tool, and I like their directory structure, I just haven't migrated my AppFuse project to use it yet. Matt -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 12:06 PM To: 'Struts Users Mailing List' Subject: RE: What's a well defined Struts Project Structure? How about documentation folder and jsp files, where would you put them? BTW, I was studying a tool called Maven on Apache. I think it's more relevant to project structure than Ant. Ant is more related to building a project, isn't it? Is there a standard project model/pattern out there we can just follow? -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: September 8, 2003 11:06 AM To: 'Struts Users Mailing List' Subject: RE: What's a well defined Struts Project Structure? Here's what I do - based on Erik Hatcher's recommendations in his Java Development with Ant book: MyProject | - lib (third party jars, etc.) | src (.java files) | test (junit, cactus, webtest tests) | web | images | styles | scripts | WEB-INF | classes | .properties and .xml files web.xml struts-config.xml build.xml For a working example, checkout my appfuse project at: http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse HTH, Matt -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:37 AM To: 'Struts Users Mailing List' Subject: What's a well defined Struts Project Structure? What a well defined struts project structure would look like? I am always a bit hesitant with where to put things Right now, I have: MyProject |- documentation |- images |- jsps |- styles |- javascript |- WEB-INF |- classes |- bin struts-config.xml *.tld project.xml ... But I always run into problems with too many files in one folder or too few files in one folder. I searched the apache CVS tree, and found that it's a mess there too. Just compare Tomcat and Struts, you will know what I am talking about. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to pass urlparameters to findForward?
Hi, I need to pass parameters depending on user action to my findForward. I have tried the following but does not seem to be working. String urlQueryString = getURLParameters(nextURL); if ( urlQueryString != null urlQueryString.length() 0 ) { ActionForward forward = aMapping.findForward(nextURL); StringBuffer path = new StringBuffer(forward.getPath()); path.append(? + urlQueryString); forward = new RedirectingActionForward(path.toString()); return forward; } else { return aMapping.findForward(nextURL); } I have also tried setting my parameters on request using request.setAttribute This also did not work. I have also searched on net for 2 hours and no luck. Please help! TIA Sriniavs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Create new nested bean instance
Sorry Nate, I can't help you with updating your structures using the nested taglib. I haven't done it before. Maybe someone else can provide you some guidance there so that you don't have to jump through the indexed properties hoops. On the other hand, using indexed properties: Your form must have getPhoneNumbers(int index) and setPhoneNumbers(int index) methods. Ultimately you want the HTML syntax to be something like: input type=text name=phoneNumbers[2].countryCode / input type=text name=phoneNumbers[2].areaCode / input type=text name=phoneNumbers[2].number / input type=text name=phoneNumbers[2].description / Where the index of 2 is the nth location for your new phone number. You could pass 'n' as a request parameter when the user clicks on the Add New Phone Number link. Since the nth location doesn't exist, the lazy list will create an empty PhoneNumberBean object and add it to the list in the nth location anytime when a get() or set() is invoked on a location that does not exist. This is all in the documentation which I'm sure you've read by now. So one way to achieve the HTML syntax listed above, is something like the following where 'n' is a request parameter named 'topLevelIndex': %String prefix = phoneNumbers[ + request.getParameter(topLevelIndex) + ];% html:text property=%=prefix + .countryCode%/ html:text property=%=prefix + .areaCode%/ html:text property=%=prefix + .number%/ html:text property=%=prefix + .description%/ There are more slick ways to do this using JTSL or Struts-el but if you just want to get it working first, you can try the above. What should happen when your form is displayed is that the html:text .../ tag will look up (finally delegating to PropertyUtils) the indexed properties and attempt to get any existing value by invoking the getPhoneNumbers{index). The List implementation provided by the lazy list will determine that no object exists at the specified location and it will create an empty PhoneNumberBean object and populate the list and then delegate to the get(index) which will retrieve the empty bean property. This prevents the dreaded ArrayIndexOutOfBoundsException. When your form is submitted, Struts sets the appropriate PhoneNumberBean and then you can procede with your business logic. Nate, I hope this makes sense. Sorry I couldn' help you with using nested taglib to accomplish this. I assume you have already looked here: http://www.keyboardmonkey.com/next/index.jsp robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 1:14 PM To: [EMAIL PROTECTED] Subject: RE: Create new nested bean instance Ok, the thing I don't understand now is how to setup the AddNewPhoneNumber jsp so that is uses the lazy list to create a new PhoneNumber instance bean. I'm trying to use the nested taglib, but I don't really understand how to set the top level object to be a new instance out of the list. I've tried something like this: nested:nest property=phoneNumbers nested:text property=countryCode / nested:text property=areadCode / nested:text property=number / nested:text property=description / /nested:nest The thing I can't figure out is how you set the top-level object to be a new instance of the PhoneNumber bean (which should be created from the lazy list). I tried using nested:nest property=phoneNumbers, but that gives me an error stating No getter for property phoneNumbers.countryCode of bean customerForm. I figure that is because the nested:nest sets the top-level object to be the List, and doesn't actually attempt to get an item out of the list (which would cause the lazy list factory to create a new PhoneNumber instance). How is this supposed to work? Am I on the right track at all? Anyone have a link to an example like what I'm trying to do? Thanks. Nate On Mon, 2003-09-08 at 11:41, Robert Taylor wrote: Yep. You could create the new lazy list in the form reset(). robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 9:29 AM To: Struts Users Mailing List Subject: RE: Create new nested bean instance Robert, Thanks for the links. I already read the Indexed Property FAQ (and I just re-read it again), but I didn't really see anything in it that relates to my problem. The lazyList stuff looks more promising. I have a question about it, though. Where do I create the new LazyList? In the ActionForms reset() method? Thanks again. Nate On Mon, 2003-09-08 at 06:18, Robert Taylor wrote: Nate, you may want to look into indexed properties: http://jakarta.apache.org/struts/faqs/indexedprops.html and ListUtils.lazyList(): http://jakarta.apache.org/commons/collections/api/org/apache/commo ns/collect ions/ListUtils.html robert -Original Message- From: Nate Drake
Re: How to pass urlparameters to findForward?
Try this, ActionForward fwd = null; StringBuffer path = new StringBuffer(forward.getPath()); path.append(? + urlQueryString); fwd = new ActionForward( mapping.findForward(success).getPath() + path.toString); return fwd ; Vangos... - Original Message - From: Srinivas Gunturu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 08, 2003 9:00 PM Subject: How to pass urlparameters to findForward? Hi, I need to pass parameters depending on user action to my findForward. I have tried the following but does not seem to be working. String urlQueryString = getURLParameters(nextURL); if ( urlQueryString != null urlQueryString.length() 0 ) { ActionForward forward = aMapping.findForward(nextURL); StringBuffer path = new StringBuffer(forward.getPath()); path.append(? + urlQueryString); forward = new RedirectingActionForward(path.toString()); return forward; } else { return aMapping.findForward(nextURL); } I have also tried setting my parameters on request using request.setAttribute This also did not work. I have also searched on net for 2 hours and no luck. Please help! TIA Sriniavs - 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: [Validator] E-Mail Verification
David Graham wrote: --- Jerry Jalenak [EMAIL PROTECTED] wrote: Is there a published specification on e-mail addresses? I believe it's RFC 822. The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes I believe that the name part needs to be quoted. However, I believe currently validator will still count this as a valid email. I haven't gotten around to tweaking the regexp. To handle these cases the user name pattern/expression will need to increase in complexity by a factor of 3 or so. How about an option that would allow only struct user names checking, ie [a-z][A-Z] and '.'. The clunky part is both the client and server versions of the regexp need to change. I believe I would actually like to make the client side checking more course, ie allow any email in the form of [EMAIL PROTECTED], then let the java take care of full validation, what do you think ? Unfortunately, I think that's a valid email address as defined in the RFC. David Comments? Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.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]
[ANN] Internet IDE - Carrier 2.0 b2
A solid release of Netspread Carrier 2.0 b2 is available today. The Carrier client, a visual design environment on Internet, is tested with JRE 1.4.2 with performance surprising my VB friends. There are two new things I am very proud of: 1) A Form Token Facility is introduced to automatically protect every web form and every hyper link in application modules with no-cache turned on. The facility is completely hidden from the views of designers and can be turned on/off programmatically. 2) The Carrier Developer's Guide is near completed in which the LocalizedDate class is examined in details. The four key attributes, input format, output format, format pattern (or a key to the localized pattern), and error key, are completely encapsulated in the class. Therefore designers only need to register this class in a form bean property descriptor with desired format pattern or its key in ONE place. I see other methodologies make the designers to register input format here, output format there, pattern in another configuration file... causing endless troubles just for a simple Date property. Now the problem is solved in the cleanest way. It is a complete i18n java.sql.Date property to my knowledge and it tells us almost any other complex properties could be designed this way. See it with composing screen shots at http://www.netspread.com/developer.html#FormBeanValidations Carrier is designed to be used by sloppy users like many of us in this list. It doesn't tell you How easy to write codes to do it, instead, it tells you How easy to compose web forms to do it with the capability of CRUD operations for hierarchical and/or tabular data entries. It also tells you Where you put wrong things in case configuration errors occur. It is a solid commercial grade product for you to enjoy, no suffering. If you complain any parts of it, tell us. User experience is on top of the priority list. Do not forget to follow the 24 tips on Wheels and Struts when you play it http://www.netspread.com/help.html Jing Netspread Carrier http://www.netspread.com
RE: Converting a ResultSet to a List of POJOs
+1. Simplest method I've seen to go from a ResultSet to a Collection of JavaBeans Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Saturday, September 06, 2003 10:34 AM To: Struts Users Mailing List Subject: Re: Converting a ResultSet to a List of POJOs I'm about to try iBATIS www.ibatis.com for a new phase of a project we started in Hibernate. Hibernate is cool, but I think something simpler might be a better fit. (Not sure if we really need that finely grained object layer after all :) It will let you remove the SQL to a simple XML file and give that statement a name. You can then call the named statement from your Java code and get a POJO result. Like what I was doing in Scaffold, only better =:0) -Ted. Matt Raible wrote: Dear Struts Experts, I recently started a new project where most of the backend code is already written with JDBC and ResultSets. The ResultSets are iterated through and a POJOs values are set using pojo.setName(rs.getString(...)), etc. - you get the point. I'm wondering if there's an easier way - so I could do something like this: ResultSet rs = stmt.executeQuery(SELECT ...); List objects = FancyUtilitity.convertResultSetToListOfObjects(rs, object.class); Hibernate let me do this very simply - and I miss the fact that I could type a line or two to get a List of POJOs. List users = ses.createQuery(from u in class + User.class + order by u.name).list(); I've looked at the RowSetDynaClass (http://tinyurl.com/mekh), which has an interesting way of doing this - is this the recommended approach in the JDBC world? Here's an example using it: ResultSet rs = stmt.executeQuery(SELECT ...); RowSetDynaClass rsdc = new RowSetDynaClass(rs); rs.close(); stmt.close(); ...;// Return connection to pool List rows = rsdc.getRows(); ...; // Process the rows as desired Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts 1.0 problem
We recently ported the weblogic server from SP1 to SP4 and came accross the following problem while displaying the JSP pages. This was working fine on SP1. Can anyone tell me the possible reason. The line of code in the jsp is : bean:write name=%=formBean% property=name[53] scope=request/ where 53 is an input parameter of getName(int size) method of FormBean. And that's the problem. The syntax above says that name is an array, and that you want element number 53 of that array. That's exactly what the error message is saying (Property 'name' is not indexed). You could get around this with some more Java code : % String name = formBean.name(53); % c:out value=${name} / - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Validator] E-Mail Verification
--- Robert Leland [EMAIL PROTECTED] wrote: David Graham wrote: --- Jerry Jalenak [EMAIL PROTECTED] wrote: Is there a published specification on e-mail addresses? I believe it's RFC 822. The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes I believe that the name part needs to be quoted. However, I believe currently validator will still count this as a valid email. I haven't gotten around to tweaking the regexp. To handle these cases the user name pattern/expression will need to increase in complexity by a factor of 3 or so. How about an option that would allow only struct user names checking, ie [a-z][A-Z] and '.'. +1 on the new option but I think the allowed characters should be a-zA-Z0-9_.- The clunky part is both the client and server versions of the regexp need to change. I believe I would actually like to make the client side checking more course, ie allow any email in the form of [EMAIL PROTECTED], then let the java take care of full validation, what do you think ? +1. Javascript is merely a convenience for the user and it's a pain to maintain this complex logic in 2 places. David Unfortunately, I think that's a valid email address as defined in the RFC. David Comments? Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.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!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Validator] E-Mail Verification
+1 on the new option but I think the allowed characters should be a-zA-Z0-9_.- -999 That's missing several perfectly valid characters in Email addresses, like a space, +, single quote, etc. The RFC defines the valid characters for a reason. -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exception running Tomcat
clear enought, is not it? -- El siguiente carßcter debe ser cerrando comentario . There is a tag in your struts-config that is not closed. Or maybe a comment is not properly closed. Check for wellformedness in struts-config. Adolfo. From: Mariano García [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Exception running Tomcat Date: Mon, 8 Sep 2003 16:16:33 +0200 Hi all, I am a newbie in struts, and I am having some problems with them. I am trying to execute tomcat, but I get this exception: INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true 08-sep-2003 16:11:24 org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true 08-sep-2003 16:11:24 org.apache.commons.digester.Digester fatalError GRAVE: Parse Fatal Error at line 69 column -1: El siguiente carßcter debe ser cerrando comentario . org.xml.sax.SAXParseException: El siguiente carßcter debe ser cerrando comentario . at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182) at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3176) at org.apache.crimson.parser.Parser2.nextChar(Parser2.java:3098) I have struts.jar and all commons-*.jar on my classpath. Someone can help me, please? _ Mariano García Ingeniero de Sistemas Optiva Media Viriato,25 - 28010 Madrid - España t. +34 91 445 96 95 m. +34 651 03 33 86 © This message is printed on 100% recycled electrons. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Validator] E-Mail Verification
just-remembered-this Some time ago I needed an e-mail regular expression, and found this in a book on JavaScript. Seemed to work OK at the time. /^\w(\.?[\w-])[EMAIL PROTECTED](\.?[-\w])*\.([a-z]{3}(\.[a-z]{2})?|[a-z]{2}(\.[a-z]{2})?) $/i /just-remembered-this Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 3:45 PM To: Struts Users Mailing List Subject: Re: [Validator] E-Mail Verification --- Robert Leland [EMAIL PROTECTED] wrote: David Graham wrote: --- Jerry Jalenak [EMAIL PROTECTED] wrote: Is there a published specification on e-mail addresses? I believe it's RFC 822. The reason I ask is that we are using the 'email' validator, and it's accepting as valid e-mail addresses such as 'u-+-+%^_/[EMAIL PROTECTED]'. I didn't think Validator would accept these, but apparently is it. If there's not an established spec for e-mail addresses, then I would assume that anything goes I believe that the name part needs to be quoted. However, I believe currently validator will still count this as a valid email. I haven't gotten around to tweaking the regexp. To handle these cases the user name pattern/expression will need to increase in complexity by a factor of 3 or so. How about an option that would allow only struct user names checking, ie [a-z][A-Z] and '.'. +1 on the new option but I think the allowed characters should be a-zA-Z0-9_.- The clunky part is both the client and server versions of the regexp need to change. I believe I would actually like to make the client side checking more course, ie allow any email in the form of [EMAIL PROTECTED], then let the java take care of full validation, what do you think ? +1. Javascript is merely a convenience for the user and it's a pain to maintain this complex logic in 2 places. David Unfortunately, I think that's a valid email address as defined in the RFC. David Comments? Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.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!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Validator] E-Mail Verification
--- Paananen, Tero [EMAIL PROTECTED] wrote: +1 on the new option but I think the allowed characters should be a-zA-Z0-9_.- -999 That's missing several perfectly valid characters in Email addresses, like a space, +, single quote, etc. The RFC defines the valid characters for a reason. This would be a new option for people who want to limit email addresses to more reasonable characters than the RFC defines. It would not be enabled by default. David -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts 1.0 problem
In my case name is not an array... 53 is an int passed to the method getName(int size) from my JSP through bean:write tag. Input exactly means that i want 53 chars of the String. -Original Message- From: Slattery.Tim [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 2:13 PM To: struts-user Subject: RE: Struts 1.0 problem We recently ported the weblogic server from SP1 to SP4 and came accross the following problem while displaying the JSP pages. This was working fine on SP1. Can anyone tell me the possible reason. The line of code in the jsp is : bean:write name=%=formBean% property=name[53] scope=request/ where 53 is an input parameter of getName(int size) method of FormBean. And that's the problem. The syntax above says that name is an array, and that you want element number 53 of that array. That's exactly what the error message is saying (Property 'name' is not indexed). You could get around this with some more Java code : % String name = formBean.name(53); % c:out value=${name} / - 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: Create new nested bean instance
Sorry if this gets posted twice. Not sure if it sent properly earlier. Thanks a million, Robert! I got it 99% working the way you described. The object in the list (PhoneNumber) has an org.apache.struts.upload.FormFile property. When I go to the AddNewPhoneNumber.jsp I get: java.lang.NoClassDefFoundError: org/apache/struts/upload/FormFile I tried adding a @page import% to include org.apache.struts.upload.FormFile in the jsp, but that didn't help. If I remove the FormFile property from the bean/jsp everything works great. I don't understand how it can't find this class. It seems to find the Struts taglib classes fine, but not FormFile. The taglib classes and org.apache.struts.upload.FormFile are in the same jar. I really hate Classloader related problems. Any ideas? Thanks again for all your help. Nate Here is the stack trace: java.lang.NoClassDefFoundError: org/apache/struts/upload/FormFile at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:1647) at java.lang.Class.getDeclaredMethods(Class.java:1131) at java.beans.Introspector$1.run(Introspector.java:1126) at java.security.AccessController.doPrivileged(Native Method) at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1124) at java.beans.Introspector.getTargetMethodInfo(Introspector.java:989) at java.beans.Introspector.getBeanInfo(Introspector.java:370) at java.beans.Introspector.getBeanInfo(Introspector.java:144) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUtils.java:949) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUtils.java:979) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:887) at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1172) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801) at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:952) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:176) at org.apache.jsp.addimporteddlist_jsp._jspx_meth_html_text_0(addimporteddlist_jsp.java:690) at org.apache.jsp.addimporteddlist_jsp._jspService(addimporteddlist_jsp.java:279) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:192) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:129) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558) at org.mortbay.http.HttpContext.handle(HttpContext.java:1714) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507) at org.mortbay.http.HttpContext.handle(HttpContext.java:1664) at org.mortbay.http.HttpServer.service(HttpServer.java:863) at org.jboss.jetty.Jetty.service(Jetty.java:460) at org.mortbay.http.HttpConnection.service(HttpConnection.java:775) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939) On Mon, 2003-09-08 at 15:09, Robert Taylor wrote: Sorry Nate, I can't help you with updating your structures using the nested taglib. I haven't done it before. Maybe someone else can provide you some guidance there so that you don't have to jump through the indexed properties hoops. On the other hand, using
RE: Create new nested bean instance
Thanks a million, Robert! I got it 99% working the way you described. The object in the list (PhoneNumber) has an org.apache.struts.upload.FormFile property. When I go to the AddNewPhoneNumber.jsp I get: java.lang.NoClassDefFoundError: org/apache/struts/upload/FormFile I tried adding a @page import% to include org.apache.struts.upload.FormFile in the jsp, but that didn't help. If I remove the FormFile property from the bean/jsp everything works great. I don't understand how it can't find this class. It seems to find the Struts taglib classes fine, but not FormFile. The taglib classes and org.apache.struts.upload.FormFile are in the same jar. I really hate Classloader related problems. Any ideas? Thanks again for all your help. Nate Here is the stack trace: java.lang.NoClassDefFoundError: org/apache/struts/upload/FormFile at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:1647) at java.lang.Class.getDeclaredMethods(Class.java:1131) at java.beans.Introspector$1.run(Introspector.java:1126) at java.security.AccessController.doPrivileged(Native Method) at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1124) at java.beans.Introspector.getTargetMethodInfo(Introspector.java:989) at java.beans.Introspector.getBeanInfo(Introspector.java:370) at java.beans.Introspector.getBeanInfo(Introspector.java:144) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUtils.java:949) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUtils.java:979) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:887) at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1172) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801) at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:952) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:176) at org.apache.jsp.addimporteddlist_jsp._jspx_meth_html_text_0(addimporteddlist_jsp.java:690) at org.apache.jsp.addimporteddlist_jsp._jspService(addimporteddlist_jsp.java:279) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:192) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:129) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558) at org.mortbay.http.HttpContext.handle(HttpContext.java:1714) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507) at org.mortbay.http.HttpContext.handle(HttpContext.java:1664) at org.mortbay.http.HttpServer.service(HttpServer.java:863) at org.jboss.jetty.Jetty.service(Jetty.java:460) at org.mortbay.http.HttpConnection.service(HttpConnection.java:775) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939) On Mon, 2003-09-08 at 15:09, Robert Taylor wrote: Sorry Nate, I can't help you with updating your structures using the nested taglib. I haven't done it before. Maybe someone else can provide you some guidance there so that you don't have to jump through the indexed properties hoops. On the other hand, using indexed properties: Your form must have getPhoneNumbers(int index) and
RE: Converting a ResultSet to a List of POJOs
Thanks to all for your suggestions. I did some number comparisons b/w the standard way (rs.next() ... set, set, set), ibatis, and ResultSetUtils.getCollection() from scaffold. Here's what I found: 1. Standard way - 0.24 seconds 2. ibatis - 5+ seconds (ugh! - maybe I'm doing something wrong, more info here: http://tinyurl.com/mod4) 3. ResultSetUtils.getCollection - 0.27 seconds So I'm going with #3 as it'll speed up dev time and doesn't have much of a performance hit. Thanks, Matt -Original Message- From: Jerry Jalenak [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 7:09 AM To: 'Struts Users Mailing List' Subject: RE: Converting a ResultSet to a List of POJOs +1. Simplest method I've seen to go from a ResultSet to a Collection of JavaBeans Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Saturday, September 06, 2003 10:34 AM To: Struts Users Mailing List Subject: Re: Converting a ResultSet to a List of POJOs I'm about to try iBATIS www.ibatis.com for a new phase of a project we started in Hibernate. Hibernate is cool, but I think something simpler might be a better fit. (Not sure if we really need that finely grained object layer after all :) It will let you remove the SQL to a simple XML file and give that statement a name. You can then call the named statement from your Java code and get a POJO result. Like what I was doing in Scaffold, only better =:0) -Ted. Matt Raible wrote: Dear Struts Experts, I recently started a new project where most of the backend code is already written with JDBC and ResultSets. The ResultSets are iterated through and a POJOs values are set using pojo.setName(rs.getString(...)), etc. - you get the point. I'm wondering if there's an easier way - so I could do something like this: ResultSet rs = stmt.executeQuery(SELECT ...); List objects = FancyUtilitity.convertResultSetToListOfObjects(rs, object.class); Hibernate let me do this very simply - and I miss the fact that I could type a line or two to get a List of POJOs. List users = ses.createQuery(from u in class + User.class + order by u.name).list(); I've looked at the RowSetDynaClass (http://tinyurl.com/mekh), which has an interesting way of doing this - is this the recommended approach in the JDBC world? Here's an example using it: ResultSet rs = stmt.executeQuery(SELECT ...); RowSetDynaClass rsdc = new RowSetDynaClass(rs); rs.close(); stmt.close(); ...;// Return connection to pool List rows = rsdc.getRows(); ...; // Process the rows as desired Thanks, Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [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: iterator tag
Hmmm I am putting it in copse like this Request.setAttribute(blah , new LinkedList()); When I iterate over this it causes the page to crash H I will chack the code for simple mistakes but htats why I was wondering What the correct behavior in this instance is??? -Original Message- From: Yansheng Lin [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 10:14 AM To: 'Struts Users Mailing List' Subject: RE: iterator tag You sure? 'cause normally what I got is just nothing if the list is empty. If the collection you are iterating over contain null values, the loop will still be performed but no page scope attribute (named by the id attribute) will be created for that loop iteration. You can use the logic:present and logic:notPresent tags to test for this case. However, the *brand new* collection has to be defined somehow, i.e., itself cannot be null. Hope this helps. -Original Message- From: LUCERO,DENNIS (HP-Boise,ex1) [mailto:[EMAIL PROTECTED] Sent: September 6, 2003 2:34 PM To: ' ([EMAIL PROTECTED])' Subject: iterator tag What is the correct behavior of the logic:iterator tag when given a collection of size zero (when the named collection is a brand new linkedList this tag causes a page to crash??) We come from the land of the ice and snow With the midnight sun, where the hot springs glow The hammer of the gods, will drive our ships to new lands Fight the horde, Sing and cry Valhalla I am coming - 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: Combining struts and JSTL tags...
i don't think that's it because it works fine when i import just the bean taglib %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % or just the c taglib %@ taglib uri=/WEB-INF/c.tld prefix=c % but not both thanks for the lead though, Loren -Original Message- From: Paul McCulloch [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 1:48 AM To: 'Struts Users Mailing List' Subject: RE: Combining struts and JSTL tags... This can happen if you have included the bean taglib twice. Is the page with which you get an error included via an %@ include statement? Paul -Original Message- From: Loren Hall [mailto:[EMAIL PROTECTED] Sent: 06 September 2003 00:13 To: Struts Users Mailing List Subject: RE: Combining struts and JSTL tags... i haven't found a resolution to a problem previously posted under another subject, since it fits this topic I thought i'd put it out there again. I started my app using struts tags, and recently incorporated jstl. Unfortunately I get an error when I import both struts-bean.tld and c.tld c.tld: urihttp://java.sun.com/jstl/core/uri) struts-bean.tld: urihttp://jakarta.apache.org/struts/tags-bean-1.0.2/uri) i.e. when these 2 taglib directives appear on a single .jsp %@ taglib uri=/WEB-INF/c.tld prefix=c % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % i get the following exception: jsp.error.tlv.invalid.page null: org.xml.sax.SAXParseException: Attribute xmlns:bean was already specified for element jsp:root. FULL ERROR MESSAGE ``` HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: jsp.error.tlv.invalid.page null: org.xml.sax.SAXParseException: Attribute xmlns:bean was already specified for element jsp:root. at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler. java:105) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430 ) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:112 ) at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:661) at org.apache.jasper.compiler.Validator.validate(Validator.java:613) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:230) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:4 73) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:1 90) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
RE: Why is No getter method for property happening... damn.
Try extending ur bean to ActionBean class Regards Rohit -Original Message- From: Fumitada Hattori [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 3:16 PM To: Struts Users Mailing List Subject: Why is No getter method for property happening... damn. Hi gurus, I got a simple bean below. public class Company { private static ArrayList list; private int id; private String name; static{ list = new ArrayList(); list.add(new Company(0,)); list.add(new Company(1,MS)); list.add(new Company(2,SUN)); list.add(new Company(3,IBM)); list.add(new Company(4,SYBASE)); } public Company(){} public Company(int id, String name){ this.id = id; this.name = name; } public int getId(){ return id; } public String getName(){ return name; } public static ArrayList getList(){ return list; } } --- This bean is set into the application scope at tomcat starts. sc.getServletContext().setAttribute(company,new Company()); In jsp, I try to get the bean like this. logic:iterate id=id name=company property=list scope=application bean:write name=id property=name/BR /logic:iterate It's supposed to be showen like MS SUN IBM SYBASE but I get the following error. org.apache.jasper.JasperException: No getter method for property list of bean company why ?? I cannot figure out...damn. Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *-- This message and any attachment(s) is intended only for the use of the addressee(s) and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended addressee(s), you are hereby notified that any use, distribution, disclosure or copying of this communication is strictly prohibited. If you have received this communication in error, please erase all copies of the message and its attachment(s) and notify the sender or Kanbay postmaster immediately. Any views expressed in this message are those of the individual sender and not of Kanbay. Although we have taken steps to ensure that this e-mail and any attachment(s) are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Why is No getter method for property happening... damn.
Addition ...Extends to ActionForm .. Regards Rohit Aeron -Original Message- From: Fumitada Hattori [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2003 3:16 PM To: Struts Users Mailing List Subject: Why is No getter method for property happening... damn. Hi gurus, I got a simple bean below. public class Company { private static ArrayList list; private int id; private String name; static{ list = new ArrayList(); list.add(new Company(0,)); list.add(new Company(1,MS)); list.add(new Company(2,SUN)); list.add(new Company(3,IBM)); list.add(new Company(4,SYBASE)); } public Company(){} public Company(int id, String name){ this.id = id; this.name = name; } public int getId(){ return id; } public String getName(){ return name; } public static ArrayList getList(){ return list; } } --- This bean is set into the application scope at tomcat starts. sc.getServletContext().setAttribute(company,new Company()); In jsp, I try to get the bean like this. logic:iterate id=id name=company property=list scope=application bean:write name=id property=name/BR /logic:iterate It's supposed to be showen like MS SUN IBM SYBASE but I get the following error. org.apache.jasper.JasperException: No getter method for property list of bean company why ?? I cannot figure out...damn. Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *-- This message and any attachment(s) is intended only for the use of the addressee(s) and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended addressee(s), you are hereby notified that any use, distribution, disclosure or copying of this communication is strictly prohibited. If you have received this communication in error, please erase all copies of the message and its attachment(s) and notify the sender or Kanbay postmaster immediately. Any views expressed in this message are those of the individual sender and not of Kanbay. Although we have taken steps to ensure that this e-mail and any attachment(s) are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
indexed properties
The following article seems to differ in approach from how the posters to this forum implement indexed properties in struts: http://www.developer.com/java/other/article.php/2233591 In this article, the author uses a DynaActionForm which automatically builds an array of normal beans. By normal, I mean that the beans have methods like this: String getFoo() void setFoo(String foo) rather than this, as is often advocated in this forum: String getFoo(int index) void setFoo(String foo, int index) I prefer the former approach except for one minor factor: it doesn't seem to work. :( Struts seems to be creating me a valid form. I say this becuase I have an iterator on my form that displays the right number of rows of text boxes, and they all have names like mybean[0].foo. Furthermore, if I change the property attribute of my html:text tag to bar, I get an exception when I render the page that there is no bar property. So things seem to be working well, up to this point, but in the implementation of the action, my form bean doesn't have any values set. They're not even blank; they're null. I stuck a println in a setter method -- it's not even being called. I can, however, see the values in the request parameters if I print them out in the implementation of the action. Help! Actual code follows. Thanks in advance, -- Mike STRUTS-CONFIG.XML form-bean name=shipmentFormBean type=org.apache.struts.action.DynaActionForm form-property name=action type=java.lang.String / form-property name=shipments type=com.interactivate.cachandler.ShipmentFormBean[] size=12 / /form-bean action path=/data-upload/Shipments name=shipmentFormBean forward=shipments.page scope=request validate=false roles=data-upl / action path=/data-upload/SubmitShipments type=com.interactivate.cachandler.SubmitShipmentsAction name=shipmentFormBean scope=request validate=true input=shipments.page roles=data-upl / SHIPMENTFORMBEAN.JAVA -- public class ShipmentFormBean { private String mDestination; private String mSize; private String mVariety; private String mQuantity; private String mPrice; private String mZipCode; // YANKED A BUNCH OF GETTERS/SETTERS public String getSize() { return mSize; } public void setSize(String size) { System.out.println(### setting size to + size); mSize = size; } } SHIPMENTS.JSP html:form action=/data-upload/SubmitShipments.do logic:iterate id=shipment name=shipmentFormBean property=shipments %-- lots of jsp code and html yanked --% html:select name=shipment property=size indexed=true option value=70 70 /option option value=84 84 /option /html:select html:select name=shipment property=destination indexed=true option value= selectedSelect a city/option option value=- /option jsp:include page=destinations.jsp / /html:select html:text name=shipment property=zipCode indexed=true size=10 maxlength=5 / /logic:iterate /html:form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Redisplaying of entered form fields
Hi Andrew, All of my struts actions have the redirect flag as false. Here is more of my configurtion code which is used to run the application I am running. Would be most appreciative if you could have a look. Cheers Rodney CODE: Below the code you see is part of an application I am building. The problem here lies in the fact that in all cases, field data does not get redisplayed within the form the user has entered data in. eg. if you enter a invalid data within a numeric data field (this instance ACN) then the ActionForm issues a error message gets issued (works) but the ACN previously entered does not get redisplayed in the form. eg. if you enter a valid ACN or Organisation Name within the fields to do searches, and no data is applicable to the search criteria entered a error message gets issued (works) but no ACN/Organisation Name gets redisplayed in the form where the data was entered. Part 1: Sample Configuration (struts-config.xml) form-bean name=company.OrganisationNameSearchActionForm type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActionForm / global-forwards forward name=error path=/Error.jsp / /global-forwards action path=/company/OrganisationNameSearch type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchAction name=company.OrganisationNameSearchActionForm input=/company/OrganisationNameSearch.jsp scope=request validate=true parameter=method forward name=nextpath=/company/OrganisationBrowse.jsp redirect=false / forward name=failure path=/company/OrganisationNameSearch.jsp redirect=false / /action action path=/company/OrganisationBrowse type=net.natdata.application.itf.insolvency.company.OrganisationBrowseAction name=company.OrganisationBrowseActionForm input=/company/OrganisationBrowse.jsp scope=request validate=true parameter=method forward name=previouspath=/company/OrganisationNameSearch.jsp redirect=false / forward name=nextpath=/company/OrganisationDetails.jsp redirect=false / forward name=billpath=/BillingAction.do redirect=false / forward name=failure path=/company/OrganisationBrowse.jsp redirect=false / /action controller nocache=true processorClass=net.natdata.application.itf.framework.NDCRequestProcessor / message-resources parameter=resources.application / PART 2: Application form code (validation and reset methods) public class OrganisationNameSearchActionForm extends ActionForm { // Get and Set methods public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { ActionErrors errors = new ActionErrors(); if(method.equals(Next)) { if((organisationName == null) || (organisationName.trim().equals())) { errors.add(organisationName, new ActionError(error.organisationName.required)); } if((ACN != null) (!ACN.trim().equals())) { try { Integer.parseInt(ACN); } catch(NumberFormatException e) { errors.add(ACN, new ActionError(error.ACN.format)); } } } return errors; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.method = null; this.organisationName = null; this.ACN = null; } } Part 3: Action Code (Sample) public class OrganisationNameSearchAction extends LookupDispatchAction { protected java.util.Map getKeyMethodMap() { Map map = new HashMap(); map.put(button.next, next); return map; } public ActionForward next(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { boolean error = false; boolean failure = false; String target = next; ActionErrors actionErrors = new ActionErrors(); try { HttpSession session = request.getSession(false); if(session != null) { OrganisationNameSearchMessageDTO organisationNameSearchResult = performOrganisationNameSearch(form, session); if(organisationNameSearchResult == null) { error = true; } else if(organisationNameSearchResult.getRequestRejectionGroup() != null) { if(organisationNameSearchResult.getRequestRejectionGroup().getRejectionDetailsSegment() != null) { failure = true; } } if(!error !failure) {
RE: Create new nested bean instance
What's in addimporteddlist.jsp? Are you using a static include anywhere? robert -Original Message- From: Nate Drake [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 5:19 PM To: Struts Users Mailing List Subject: RE: Create new nested bean instance Thanks a million, Robert! I got it 99% working the way you described. The object in the list (PhoneNumber) has an org.apache.struts.upload.FormFile property. When I go to the AddNewPhoneNumber.jsp I get: java.lang.NoClassDefFoundError: org/apache/struts/upload/FormFile I tried adding a @page import% to include org.apache.struts.upload.FormFile in the jsp, but that didn't help. If I remove the FormFile property from the bean/jsp everything works great. I don't understand how it can't find this class. It seems to find the Struts taglib classes fine, but not FormFile. The taglib classes and org.apache.struts.upload.FormFile are in the same jar. I really hate Classloader related problems. Any ideas? Thanks again for all your help. Nate Here is the stack trace: java.lang.NoClassDefFoundError: org/apache/struts/upload/FormFile at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:1647) at java.lang.Class.getDeclaredMethods(Class.java:1131) at java.beans.Introspector$1.run(Introspector.java:1126) at java.security.AccessController.doPrivileged(Native Method) at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1124) at java.beans.Introspector.getTargetMethodInfo(Introspector.java:989) at java.beans.Introspector.getBeanInfo(Introspector.java:370) at java.beans.Introspector.getBeanInfo(Introspector.java:144) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors( PropertyUtils.java:949) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors( PropertyUtils.java:979) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(P ropertyUtils.java:887) at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(Prope rtyUtils.java:1172) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(Prope rtyUtils.java:772) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUti ls.java:801) at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:952) at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag .java:176) at org.apache.jsp.addimporteddlist_jsp._jspx_meth_html_text_0(addimpo rteddlist_jsp.java:690) at org.apache.jsp.addimporteddlist_jsp._jspService(addimporteddlist_j sp.java:279) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrap per.java:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplic ationHandler.java:294) at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:192) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:129) at org.apache.struts.action.RequestProcessor.doForward(RequestProcess or.java:1069) at org.apache.struts.action.RequestProcessor.processForwardConfig(Req uestProcessor.java:455) at org.apache.struts.action.RequestProcessor.process(RequestProcessor .java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplic ationHandler.java:294) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558) at org.mortbay.http.HttpContext.handle(HttpContext.java:1714) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicat ionContext.java:507) at org.mortbay.http.HttpContext.handle(HttpContext.java:1664) at org.mortbay.http.HttpServer.service(HttpServer.java:863) at org.jboss.jetty.Jetty.service(Jetty.java:460) at org.mortbay.http.HttpConnection.service(HttpConnection.java:775) at
why servlet as controller in MVC
Dear All, I have a simple doubt, Why servlet is considered as controller in in MVC framework, Can any one please answer.. Regards, viru
RE: Any potential drawbacks with this design
+1 Regards Sreekant G @ 98404-65630 Andrew Hill [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] idnode.com cc: Subject: RE: Any potential drawbacks with this design 09/08/2003 07:32 PM Please respond to Struts Users Mailing List Jing sums up the situation well. One point to add :- if it (the functionality) is applicable to all the actions today and you decide to go with the RP approach, that doesnt mean that tomorrow you wont suddenly need to add an action to which it should NOT be applied - at which point you will then either have to factor it out of the RP into some base action anyway - or do it conditional on checking some flag - at which point you run the risk of introducing action logics into the RP... My votes with the Action approach :-) -Original Message- From: Jing Zhou [mailto:[EMAIL PROTECTED] Sent: Monday, 8 September 2003 21:20 To: Struts Users Mailing List Subject: Re: Any potential drawbacks with this design There is no *drawbacks* or *advantage* design in regard to extending Action or RequestProcessor. It depends. The key is how you actually interpret the word common: -If the *common* functionality is applicable to *all* action mappings in a given application module, you do it by extending RequestProcessor. For example, a custom security checking facility in RequestProcessor. -If the *common* functionality is required to happen before certain logic you do it by extending RequestProcessor. For example, a custom form token checking facility before the form bean population. -If the *common* functionality is applicable to a sub set of Action classes in the application module, then you do it by extending Action. For example, a CRUD operation for a set of business entities. And you also give other developers a way to interpret the CRUD operation differently when they see fit. I could see you have good reasons to extend Action. Jing Netspread Carrier http://www.netspread.com - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, September 08, 2003 5:43 AM Subject: RE: Any potential drawbacks with this design I did look into the subclassing the RequestProcessor class as well. I am not sure if it can do the following -- throw Exceptions. -- NOT call the corresponding action class (instead return to a default page) depending on some conditions. Is there any advantage subclassing the RequestProcessor class as opposed to the implementation I wrote below. Regards Sreekant G @ 98404-65630 Viral_Thakkar [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] fosys.com cc: Subject: RE: Any potential drawbacks with this design 09/08/2003 02:36 PM Please respond to Struts Users Mailing List Better extend the RequestProcessor class. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 2:24 PM To: [EMAIL PROTECTED] Subject: Any potential drawbacks with this design Hi All, Please give me your comments/suggestions on the below design. I need to perform some common functionality across all the application action classes, so I have written an abstract MyOwnAction class inheriting from STRUTS Action class. All application action classes will be extending MyOwnAction class. I have overridden the
Re: why servlet as controller in MVC
That is kind of an open-ended question, but here are two alternatives and some problems associated with them: 1. Filter -- some containers require that a request really does map to a resource, so even if the Filter mapping matched the request you could end up with 404 errors in the case where the resource doesn't exist. One way to avoid this would be to have each request map to a JSP directly, but that would be pretty confusing if the controller decided to map the request to some other JSP (or some other, similar view resource) instead of passing it down the chain to the indicated JSP. Some Actions have some kind of switching behavior to route the request to one of a number of view resources. 2. JSP -- the controller normally passes the request to a view resource (like a JSP) but doesn't produce the response directly. JSPs are best suited to producing a response (usually HTML) directly, where a servlet better matches the needs of writing a controller. Other view-oriented technologies are similar to JSPs, and many use their own servlet to process the requests anyway. Since those don't work so well, a Servlet turns out to be a good match for the needs of the controller component in comparison. It sounds like you might have something else in mind -- what alternative implementation strategy are you thinking of? -Max On Mon, 2003-09-08 at 19:24, virupaksha wrote: Dear All, I have a simple doubt, Why servlet is considered as controller in in MVC framework, Can any one please answer.. Regards, viru - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with focusing the textbox
Hi All, I have a problem in focusing the cursor into text box. I can focus if i have the property in particular formbean. like this nested:form action=AccountAction.do method=post focus=name But My bean contains another instance of a another bean and that contains groups Vector . I want to focus the cursor into group name??? my bean is in session-- that contains orgData Bean -- that contains groups Vector() it isa collection of groupbean it has a name. nested:form action=AccountAction.do method=post focus=orgData.groups.name But the above line is giving problem that focus controll.type is null. regards Yogs. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Redisplaying of entered form fields
Hi All, I have a problem redisplaying form fields a user enters within a html form. I use the validate method to validate form entry fields through ActionForms. and validate business logic in LookupDispatchAction classes. Has anyone experienced this problem, and is there any solution to this matter. Cheers Rodney CODE: Below the code you see is part of an application I am building. The problem here lies in the fact that in all cases, field data does not get redisplayed within the form the user has entered data in. eg. if you enter a invalid data within a numeric data field (this instance ACN) then the ActionForm issues a error message gets issued (works) but the ACN previously entered does not get redisplayed in the form. eg. if you enter a valid ACN or Organisation Name within the fields to do searches, and no data is applicable to the search criteria entered a error message gets issued (works) but no ACN/Organisation Name gets redisplayed in the form where the data was entered. Part 1: Sample Configuration (struts-config.xml) form-bean name=company.OrganisationNameSearchActionForm type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchActionForm / global-forwards forward name=error path=/Error.jsp / /global-forwards action path=/company/OrganisationNameSearch type=net.natdata.application.itf.insolvency.company.OrganisationNameSearchAction name=company.OrganisationNameSearchActionForm input=/company/OrganisationNameSearch.jsp scope=request validate=true parameter=method forward name=nextpath=/company/OrganisationBrowse.jsp redirect=false / forward name=failure path=/company/OrganisationNameSearch.jsp redirect=false / /action action path=/company/OrganisationBrowse type=net.natdata.application.itf.insolvency.company.OrganisationBrowseAction name=company.OrganisationBrowseActionForm input=/company/OrganisationBrowse.jsp scope=request validate=true parameter=method forward name=previouspath=/company/OrganisationNameSearch.jsp redirect=false / forward name=nextpath=/company/OrganisationDetails.jsp redirect=false / forward name=billpath=/BillingAction.do redirect=false / forward name=failure path=/company/OrganisationBrowse.jsp redirect=false / /action controller nocache=true processorClass=net.natdata.application.itf.framework.NDCRequestProcessor / message-resources parameter=resources.application / PART 2: Application form code (validation and reset methods) public class OrganisationNameSearchActionForm extends ActionForm { // Get and Set methods public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { ActionErrors errors = new ActionErrors(); if(method.equals(Next)) { if((organisationName == null) || (organisationName.trim().equals())) { errors.add(organisationName, new ActionError(error.organisationName.required)); } if((ACN != null) (!ACN.trim().equals())) { try { Integer.parseInt(ACN); } catch(NumberFormatException e) { errors.add(ACN, new ActionError(error.ACN.format)); } } } return errors; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.method = null; this.organisationName = null; this.ACN = null; } } Part 3: Action Code (Sample) public class OrganisationNameSearchAction extends LookupDispatchAction { protected java.util.Map getKeyMethodMap() { Map map = new HashMap(); map.put(button.next, next); return map; } public ActionForward next(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { boolean error = false; boolean failure = false; String target = next; ActionErrors actionErrors = new ActionErrors(); try { HttpSession session = request.getSession(false); if(session != null) { OrganisationNameSearchMessageDTO organisationNameSearchResult = performOrganisationNameSearch(form, session); if(organisationNameSearchResult == null) { error = true; } else if(organisationNameSearchResult.getRequestRejectionGroup() != null) { if(organisationNameSearchResult.getRequestRejectionGroup().getRejectionDetailsSegment() != null) { failure = true; } }
RE: Searching facility questions
Well Mike, my problem is not to avoid user from accessing JSP directly, but to show her a list of links with a meaning as a result of a search action. The problem is even worst, if you think that I'm using Tiles, with the actual web content in JSPs which are never accessed directly neither by a Struts action, but imported as defined in the Tiles definition file. Did anyone realize a search facility which runs on a Struts application running Tiles? How did you solve the problem: content-linkable mappings? I'm thinking to create a configuration file with a mapping between the content JSP pages and meaningful Struts action links. The search facility will return a list of meaningless paths to JSPs containing the actual website content, and a class will search for the Struts mapping between those links and linkable actions. Does it make sense? (here he was looking around with a very interrogative expression...) Marco !-- ORIGINAL MESSAGE -- From: Mainguy, Mike [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: Searching facility questions Hide your .jsp files in /WEB-INF/foo (I use /WEB-INF/pages) so that the user cannot navigate directly to them. Alternatively hide them ANYWHERE so they cannot directly link to them. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]