Connection to Oracle 8i datasource
Hello, We at Tufan Infotech are evaluating Struts for using in our web application development. I am not able to connect to a Oracle 8i database and retrieve or update data. The datasource configuration in struts-config.xml is given below. !-- == Data Source Configuration === -- data-sources data-source autoCommit="false" description="Oracle Data Source Configuration" driverClass="oracle.jdbc.driver.OracleDriver" maxCount="4" minCount="2" password="pisdba123" url="jdbc:oracle:thin:@pavan:1521:navin" user="pisdba" / /data-sources !--== -- The code snippet which tried to connect is given below Connection con = null; PreparedStatement ps = null; ResultSet rst = null; javax.sql.DataSource dataSource = null; String str = "insert into metadata values (?,?,?,?,?)"; String type=((MetadataForm)form).getType(); String code=((MetadataForm)form).getCode(); String description=((MetadataForm)form).getDescription(); String sequence=((MetadataForm)form).getSequence(); String isDefault=((MetadataForm)form).getIsDefault(); ActionErrors errors = new ActionErrors(); try { dataSource = servlet.findDataSource(null); con = dataSource.getConnection(); ps = con.prepareStatement(str); ps.setString(1,type); ps.setString(2,code); ps.setString(3,description); ps.setString(4,sequence); ps.setString(5,isDefault); ps.executeUpdate(); } catch(Exception e) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError ("error.database.missing")); } finally { try { con.close(); } catch(Exception e) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError ("error.database.missing")); } } The above code is not updating the database. It thows an exception and shows the message in 'errors'. One of the statements below seems to be failing and gives a nullPointerException. Would appreciate some inputs to solve the problem. Also would appreciate code snippets used to connect to datasources (example Oracle). Best regards Suresh
Re: Iterate
Craig, I was wondering how your idea would work if I'm setting some properties in a Class and then adding the object to the vector. Something like, Vector v = new Vector(); while(resultset.next()) { MyClass cls = new MyClass(); cls.setName(resultSet.getString("nameColumn")); v.addElement(cls); } I'd be using v.elementAt(0).getName() in my sql statement again to perform a query. I got this running fine but i was hoping i would make the best use of the iterate tag which required direction from a person like you. Thanks, Raghu.. _ Get your FREE download of MSN Explorer at http://explorer.msn.com
RE: development issues
That's the exact intention I had while putting in regex validation i.e., to provide basic validation. btw, I havn't seen any comment regarding automatic properties. For us, its saving a lot of time as we are not worried about prepopulating the input fields if some validation fails. Another scenario is for dynamic html forms. Like we have an input form where user can input any number of email addresses. Default is 1 and he can click "Add Email" and the same form will be displayed with an additional text box and all the already entered values intact. And all this is done by framework without any custom coding in JSP or beans. Any idea how to wake up committers for struts-dev? Tahir Awan -Original Message- From: Cook, Levi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 10:46 AM To: '[EMAIL PROTECTED]' Subject: RE: development issues Surely I'm reiterating the obvious here, but Javascript alone cannot/should not be relied upon for validation. It does play a useful and important role, however its scope should normally be limited to improving the users experience with supplying input that our system understands. If the framework provides a facility for sending Javascript to the browser, I would propose including a mechanism that allows the developer to specify which browsers their script can safely run in. Its just a quick observation, but the role of validation within Struts (a web app. framework) should be limited validating user input. This is closely related to the role an ActionForm plays by representing user input as Strings. Therefore, IMHO, the goal of Struts validation should simply be to ensure user supplied input can safely be converted into the objects primitives our domain objects expect. Within this context, validating user input, regular expressions are very valuable and powerful and should be made available. As someone else stated earlier, domain specific validations can, and normally do, require more sophisticated mechanisms than regular expressions alone provide. In general, I would not advise that anyone make their domain validations dependant on the validation facilities that Struts or JavaScript provide. Anyway, that my 2 cents, Levi Cook Greenbrier Russel Madison, Wisconsin www.gr.com [EMAIL PROTECTED] -Original Message- From: Jim Richards [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, March 27, 2001 9:04 AM To: [EMAIL PROTECTED] Subject: RE: development issues But its not bad either for basic form validation (null, range checks like) and much better than using Javascript. I dont think any backend will rely upon JSP validation and wont perform its own tests prior to saving the data. Well, one of the 1.1 discussions is client side validation using JavaScript, which as of JavaScript1.2 has regext facilties built in, so I'd expect they'd be used. But that stops older browsers from working. But as you point out, server side validation should be done as well to correctly check the data against a greater number of tests. -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html http://www.cyber4.org/kumera/index.html
Are we in Beta ?
I am not sure we are in Beta mode with a feature freeze, at least with the set of criteria that was put forth in Feburary. For instance, it seems like DispatchAction(), while a good idea, is a new feature as opposed to a bug fix, and it didn't compile when it was checked in. Also the proposed multiple action servlets per web app is also a new feature, that I am not sure which version 1.0 / 1.1 it will be in. Is there any reason these items couldn't make it into version 1.1 is it ? I just don't want us to get in a prolonged cycle where we start adding new features that can wait, until after we branch the CVS tree for version 1.0 beta 2/ and 1.1 . Once we do that the development of new features can begin again. Note I am not asking when the final version will be ready. We are all volunteer, with full time jobs. -Rob
Re: development issues
I'm sure you could find all the addresses in the archives, but I agree that that is not too convenient. The original intent was that the names on the TODO list have mailto: links. In fact, the addresses are in the XML file, but there seems to be a problem with the XSL that generates the web page. Anyway, to get to the point... I don't think the idea is to come up with final code as the first step. Personally, I would rather see something like a spec first. Nothing formal or elaborate, but a detailed description of the functionality you would propose. You might think of this as writing a first cut at the documentation, so that people can see how they would use the features you are proposing. An example or two would be good. So long as it's not very long, a message to this list would be fine. Otherwise, a web page might be a good idea. Once this has been discussed and accepted, we can move on to discussing the "best" way of implementing the functionality. At that point, you can introduce us to the way you have done it, and we can talk about changes or potential improvements. Then it's up to the committers. :-) (By the way, I should point out that I'm not a committer, just an "interested party".) -- Martin Cooper - Original Message - From: "Tahir Awan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 11:55 AM Subject: RE: development issues Sorry Martin but I could not find any way to contact those volunteers (though I can see their names). Actually I was expecting that some committer will either accept or reject the idea. And if the idea is accepted then I can discuss the changes on one-on-one basis. The reason being those changes are just causing only a couple of new java class and effecting about 4 existing classes in struts/taglibs struts/utils. So, I thought to first get the idea approved before putting in more efforts in formatting those changes to be posted on some website. Thanks, Tahir Awan -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 1:22 PM To: [EMAIL PROTECTED] Subject: Re: development issues Any idea how to wake up committers for struts-dev? What makes you think they are asleep? A few points: 1) Rob Leland made some good suggestions on how to proceed, in an earlier message on this thread. You might try taking his advice, although I would recommend his option (1) over his option (2). 2) The Struts 1.1 TODO list contains two items relevant to this discussion. One is titled "Standard Validations", and has two volunteers signed up. The other is titled "Client Side Validation", and has four volunteers signed up. I would suggest you contact those people, and share your ideas with them. 3) There is at least one other implementation of Struts form validation using regular expressions that I am aware of, which was written by David Winterfeldt, and is based on the Jakarta Regexp package. -- Martin Cooper - Original Message - From: "Tahir Awan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 7:13 AM Subject: RE: development issues That's the exact intention I had while putting in regex validation i.e., to provide basic validation. btw, I havn't seen any comment regarding automatic properties. For us, its saving a lot of time as we are not worried about prepopulating the input fields if some validation fails. Another scenario is for dynamic html forms. Like we have an input form where user can input any number of email addresses. Default is 1 and he can click "Add Email" and the same form will be displayed with an additional text box and all the already entered values intact. And all this is done by framework without any custom coding in JSP or beans. Any idea how to wake up committers for struts-dev? Tahir Awan -Original Message- From: Cook, Levi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 10:46 AM To: '[EMAIL PROTECTED]' Subject: RE: development issues Surely I'm reiterating the obvious here, but Javascript alone cannot/should not be relied upon for validation. It does play a useful and important role, however its scope should normally be limited to improving the users experience with supplying input that our system understands. If the framework provides a facility for sending Javascript to the browser, I would propose including a mechanism that allows the developer to specify which browsers their script can safely run in. Its just a quick observation, but the role of validation within Struts (a web app. framework) should be limited validating user input. This is closely related to the role an ActionForm plays by representing user input as Strings. Therefore, IMHO, the goal of Struts validation
RE: development issues
I actually gave reference of the original article by "Thor Kristmundsson" in my first posting regarding this. It contains the details of the idea and implementation proposal. Anyway, here its again. Article: Strut your stuff with JSP tags by "Thor Kristmundsson" (in Dec-2000 JavaWorld). http://www.javaworld.com/jw-12-2000/jw-1201-struts.html The only little problem with this articles is that its outdated with the current struts code. So, I had to make some more changes in RequestUtils PropertyUtils in order to implement the idea. If anybody needs more info. about this, please let me know. As you might have guessed, I want to merge those changes in order to remain compatible with new Struts releases. Even if there's some better implementation, I wont mind throwing away my code and adopting to the better world. Tahir Awan -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 3:31 PM To: [EMAIL PROTECTED] Subject: Re: development issues I'm sure you could find all the addresses in the archives, but I agree that that is not too convenient. The original intent was that the names on the TODO list have mailto: links. In fact, the addresses are in the XML file, but there seems to be a problem with the XSL that generates the web page. Anyway, to get to the point... I don't think the idea is to come up with final code as the first step. Personally, I would rather see something like a spec first. Nothing formal or elaborate, but a detailed description of the functionality you would propose. You might think of this as writing a first cut at the documentation, so that people can see how they would use the features you are proposing. An example or two would be good. So long as it's not very long, a message to this list would be fine. Otherwise, a web page might be a good idea. Once this has been discussed and accepted, we can move on to discussing the "best" way of implementing the functionality. At that point, you can introduce us to the way you have done it, and we can talk about changes or potential improvements. Then it's up to the committers. :-) (By the way, I should point out that I'm not a committer, just an "interested party".) -- Martin Cooper - Original Message - From: "Tahir Awan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 11:55 AM Subject: RE: development issues Sorry Martin but I could not find any way to contact those volunteers (though I can see their names). Actually I was expecting that some committer will either accept or reject the idea. And if the idea is accepted then I can discuss the changes on one-on-one basis. The reason being those changes are just causing only a couple of new java class and effecting about 4 existing classes in struts/taglibs struts/utils. So, I thought to first get the idea approved before putting in more efforts in formatting those changes to be posted on some website. Thanks, Tahir Awan -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 1:22 PM To: [EMAIL PROTECTED] Subject: Re: development issues Any idea how to wake up committers for struts-dev? What makes you think they are asleep? A few points: 1) Rob Leland made some good suggestions on how to proceed, in an earlier message on this thread. You might try taking his advice, although I would recommend his option (1) over his option (2). 2) The Struts 1.1 TODO list contains two items relevant to this discussion. One is titled "Standard Validations", and has two volunteers signed up. The other is titled "Client Side Validation", and has four volunteers signed up. I would suggest you contact those people, and share your ideas with them. 3) There is at least one other implementation of Struts form validation using regular expressions that I am aware of, which was written by David Winterfeldt, and is based on the Jakarta Regexp package. -- Martin Cooper - Original Message - From: "Tahir Awan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 7:13 AM Subject: RE: development issues That's the exact intention I had while putting in regex validation i.e., to provide basic validation. btw, I havn't seen any comment regarding automatic properties. For us, its saving a lot of time as we are not worried about prepopulating the input fields if some validation fails. Another scenario is for dynamic html forms. Like we have an input form where user can input any number of email addresses. Default is 1 and he can click "Add Email" and the same form will be displayed with an additional text box and all the already entered values intact.
RE: development issues
On Wed, 28 Mar 2001, Tahir Awan wrote: Sorry Martin but I could not find any way to contact those volunteers (though I can see their names). STRUTS-DEV is the best way. Actually I was expecting that some committer will either accept or reject the idea. And if the idea is accepted then I can discuss the changes on one-on-one basis. The reason being those changes are just causing only a couple of new java class and effecting about 4 existing classes in struts/taglibs struts/utils. So, I thought to first get the idea approved before putting in more efforts in formatting those changes to be posted on some website. Thanks, Tahir Awan There are a couple of issues: * I'm trying to hold the line on major feature enhancements for 1.0 so that we can move to an actual release. Therefore, discussion for major feature improvements can happen now, but implementation cannot really start (in the CVS repository) until after 1.0-beta-2 (when the repository will be branched so we can finish up 1.0 bugfixes). * I'm on the road again this week (speaking at O'Reilly Enterprise Java Conference) and next week (ApacheCon). Remote connectivity is a much more painful way to do commits than my nice DSL link at home. I intend to bring 1.0 to a close as fast as humanly possible so that we can start working on all the fun new stuff, along with (I hope) increasing the number of committers. But there are only so many hours in the day at this point ... Craig -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 1:22 PM To: [EMAIL PROTECTED] Subject: Re: development issues Any idea how to wake up committers for struts-dev? What makes you think they are asleep? A few points: 1) Rob Leland made some good suggestions on how to proceed, in an earlier message on this thread. You might try taking his advice, although I would recommend his option (1) over his option (2). 2) The Struts 1.1 TODO list contains two items relevant to this discussion. One is titled "Standard Validations", and has two volunteers signed up. The other is titled "Client Side Validation", and has four volunteers signed up. I would suggest you contact those people, and share your ideas with them. 3) There is at least one other implementation of Struts form validation using regular expressions that I am aware of, which was written by David Winterfeldt, and is based on the Jakarta Regexp package. -- Martin Cooper - Original Message - From: "Tahir Awan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 7:13 AM Subject: RE: development issues That's the exact intention I had while putting in regex validation i.e., to provide basic validation. btw, I havn't seen any comment regarding automatic properties. For us, its saving a lot of time as we are not worried about prepopulating the input fields if some validation fails. Another scenario is for dynamic html forms. Like we have an input form where user can input any number of email addresses. Default is 1 and he can click "Add Email" and the same form will be displayed with an additional text box and all the already entered values intact. And all this is done by framework without any custom coding in JSP or beans. Any idea how to wake up committers for struts-dev? Tahir Awan -Original Message- From: Cook, Levi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 10:46 AM To: '[EMAIL PROTECTED]' Subject: RE: development issues Surely I'm reiterating the obvious here, but Javascript alone cannot/should not be relied upon for validation. It does play a useful and important role, however its scope should normally be limited to improving the users experience with supplying input that our system understands. If the framework provides a facility for sending Javascript to the browser, I would propose including a mechanism that allows the developer to specify which browsers their script can safely run in. Its just a quick observation, but the role of validation within Struts (a web app. framework) should be limited validating user input. This is closely related to the role an ActionForm plays by representing user input as Strings. Therefore, IMHO, the goal of Struts validation should simply be to ensure user supplied input can safely be converted into the objects primitives our domain objects expect. Within this context, validating user input, regular expressions are very valuable and powerful and should be made available. As someone else stated earlier, domain specific validations can, and normally do, require more sophisticated mechanisms than regular expressions alone provide. In
Re: Are we in Beta ?
On Wed, 28 Mar 2001, Rob Leland wrote: I am not sure we are in Beta mode with a feature freeze, at least with the set of criteria that was put forth in Feburary. For instance, it seems like DispatchAction(), while a good idea, is a new feature as opposed to a bug fix, and it didn't compile when it was checked in. Also the proposed multiple action servlets per web app is also a new feature, that I am not sure which version 1.0 / 1.1 it will be in. Is there any reason these items couldn't make it into version 1.1 is it ? I just don't want us to get in a prolonged cycle where we start adding new features that can wait, until after we branch the CVS tree for version 1.0 beta 2/ and 1.1 . Once we do that the development of new features can begin again. Me neither. DispatchAction came up over the last few weeks, coincidentally when I needed it for a Struts-based app, so I violated this policy ... sorry about that. Note I am not asking when the final version will be ready. We are all volunteer, with full time jobs. -Rob Craig
Re: development issues
Martin Cooper wrote: 3) There is at least one other implementation of Struts form validation using regular expressions that I am aware of, which was written by David Winterfeldt, and is based on the Jakarta Regexp package. I'm getting very good use out of this in my current project. http://home.earthlink.net/~dwinterfeldt/ -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/
Re: development issues
Tahir, David Winterfeldt has a very nice approach to regex validation that just plugs into the framework, without modifying the code. Check it out at http://home.earthlink.net/~dwinterfeldt/ This extends the current Struts validation, and works on both the client and server side. This gets the basic validations out of the way, and also lets you perform more extensive validations in the usual way. The validation expressions are loaded from a XML configuration file, and can be changed without recompiling. Automatic properties were discussed when the article came out, but it was tabled for the 1.1 timeframe. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg00927.html I believe the "XML -- ActionForm Code Generator" on the 1.1 todo list may provide the same functionality when developed. Currently, the only procedure for submitting tags is to post them to the list, either as an attachment or with a link to a Web site. Diffs are the traditional format for other types of patches. We (meaning I) also hope to create a user contribution area soon, but this seems to be a busy time for everyone. Tahir Awan wrote: Hi, In Dec-2000 issue of Javaworld, there was an article by "Thor Kristmundsson" about enhancing Struts framework with regex validation and automatic properties. Though the article is outdated due to recent development in Struts but I liked the idea and spent some time implementing it. In order to be compatible with future releases of Struts, is it possible to post those changes for check-in? I suppose its only possible if the committers like the ideas presented in that article. As I am also working on some more userinterface related tags. What's the process of submitting those tags to be part of the struts framework. Thanks, Tahir Awan
RE: development issues
Thanks, I will look into David's validator approach. Is there any other implementation of automatic properties which can be used with struts till 1.1. I suppose its THE basic requirement for any web-interface to populate values for update actions and in case of validation fails. Writing custom logic per page is out of question and it has to be part of the framework somehow. Thanks, Tahir Awan -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 5:01 PM To: [EMAIL PROTECTED] Subject: Re: development issues Tahir, David Winterfeldt has a very nice approach to regex validation that just plugs into the framework, without modifying the code. Check it out at http://home.earthlink.net/~dwinterfeldt/ This extends the current Struts validation, and works on both the client and server side. This gets the basic validations out of the way, and also lets you perform more extensive validations in the usual way. The validation expressions are loaded from a XML configuration file, and can be changed without recompiling. Automatic properties were discussed when the article came out, but it was tabled for the 1.1 timeframe. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg 00927.html I believe the "XML -- ActionForm Code Generator" on the 1.1 todo list may provide the same functionality when developed. Currently, the only procedure for submitting tags is to post them to the list, either as an attachment or with a link to a Web site. Diffs are the traditional format for other types of patches. We (meaning I) also hope to create a user contribution area soon, but this seems to be a busy time for everyone. Tahir Awan wrote: Hi, In Dec-2000 issue of Javaworld, there was an article by "Thor Kristmundsson" about enhancing Struts framework with regex validation and automatic properties. Though the article is outdated due to recent development in Struts but I liked the idea and spent some time implementing it. In order to be compatible with future releases of Struts, is it possible to post those changes for check-in? I suppose its only possible if the committers like the ideas presented in that article. As I am also working on some more userinterface related tags. What's the process of submitting those tags to be part of the struts framework. Thanks, Tahir Awan
RE: development issues
Just looked into David's validator framework and it looks like a javascript solution. Can someone confirm this? Tahir -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 5:01 PM To: [EMAIL PROTECTED] Subject: Re: development issues Tahir, David Winterfeldt has a very nice approach to regex validation that just plugs into the framework, without modifying the code. Check it out at http://home.earthlink.net/~dwinterfeldt/ This extends the current Struts validation, and works on both the client and server side. This gets the basic validations out of the way, and also lets you perform more extensive validations in the usual way. The validation expressions are loaded from a XML configuration file, and can be changed without recompiling. Automatic properties were discussed when the article came out, but it was tabled for the 1.1 timeframe. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg 00927.html I believe the "XML -- ActionForm Code Generator" on the 1.1 todo list may provide the same functionality when developed. Currently, the only procedure for submitting tags is to post them to the list, either as an attachment or with a link to a Web site. Diffs are the traditional format for other types of patches. We (meaning I) also hope to create a user contribution area soon, but this seems to be a busy time for everyone. Tahir Awan wrote: Hi, In Dec-2000 issue of Javaworld, there was an article by "Thor Kristmundsson" about enhancing Struts framework with regex validation and automatic properties. Though the article is outdated due to recent development in Struts but I liked the idea and spent some time implementing it. In order to be compatible with future releases of Struts, is it possible to post those changes for check-in? I suppose its only possible if the committers like the ideas presented in that article. As I am also working on some more userinterface related tags. What's the process of submitting those tags to be part of the struts framework. Thanks, Tahir Awan
Re: development issues
It can handle both client-side and server-side validations. The client-side validations are done using JavaScript. The server-side validations are done using the validate() method on an ActionForm. -- Martin Cooper - Original Message - From: "Tahir Awan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 2:40 PM Subject: RE: development issues Just looked into David's validator framework and it looks like a javascript solution. Can someone confirm this? Tahir -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 5:01 PM To: [EMAIL PROTECTED] Subject: Re: development issues Tahir, David Winterfeldt has a very nice approach to regex validation that just plugs into the framework, without modifying the code. Check it out at http://home.earthlink.net/~dwinterfeldt/ This extends the current Struts validation, and works on both the client and server side. This gets the basic validations out of the way, and also lets you perform more extensive validations in the usual way. The validation expressions are loaded from a XML configuration file, and can be changed without recompiling. Automatic properties were discussed when the article came out, but it was tabled for the 1.1 timeframe. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg 00927.html I believe the "XML -- ActionForm Code Generator" on the 1.1 todo list may provide the same functionality when developed. Currently, the only procedure for submitting tags is to post them to the list, either as an attachment or with a link to a Web site. Diffs are the traditional format for other types of patches. We (meaning I) also hope to create a user contribution area soon, but this seems to be a busy time for everyone. Tahir Awan wrote: Hi, In Dec-2000 issue of Javaworld, there was an article by "Thor Kristmundsson" about enhancing Struts framework with regex validation and automatic properties. Though the article is outdated due to recent development in Struts but I liked the idea and spent some time implementing it. In order to be compatible with future releases of Struts, is it possible to post those changes for check-in? I suppose its only possible if the committers like the ideas presented in that article. As I am also working on some more userinterface related tags. What's the process of submitting those tags to be part of the struts framework. Thanks, Tahir Awan
cvs commit: jakarta-struts/doc installation-was352-x.xml installation.xml
husted 01/03/28 16:08:16 Modified:doc installation.xml Added: doc installation-was352-x.xml Log: Add installation notes for Example application and WebSphere. Submitted by Chris Assenza. Revision ChangesPath 1.3 +2 -2 jakarta-struts/doc/installation.xml Index: installation.xml === RCS file: /home/cvs/jakarta-struts/doc/installation.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- installation.xml 2001/03/24 00:05:36 1.2 +++ installation.xml 2001/03/29 00:08:15 1.3 @@ -273,8 +273,8 @@ required./a/li liWeblogic - a href="installation-wls.html"Additional steps required./a/li liWebLogic 6.0+ - No additional steps required./li - liWebSphere - a href="installation-was.html"Additional steps required./a/li -/ul + liWebSphere - a href="installation-was352.html"Additional steps required./a/li + liWebSphere - a href="installation-was352-x.html"Steps for the Example Application./a/li/ul /section /body /document 1.1 jakarta-struts/doc/installation-was352-x.xml Index: installation-was352-x.xml === ?xml version="1.0"? document url="./installation-was352-x.xml" properties authorChris Assenza/author titleThe Struts Framework Project - Installation - WebSphere 3.5.2/title /properties body section name="Installing Struts with your servlet container" href="Containers" h3a name="was352"WebSphere Application Server 3.5 and the Example Application/a/h3 pServer: Windows 2000 Server with WebSphere 3.5.3 Advanced/p ol liStart up the adminserver. /li liStart up Admin Console. /li liUse the Convert War file task to convert the struts-example.war from the struts-b1 distrib as-is. /li liConvert to the default_server, default servlet engine and standard install directory (c:\websphere\appserver\hosts\default_host). /li liCreate a WEB-INF directory in the servlets dir and copy struts-config.xml, database.xml AND web.xml into it (Keep WEB-INF with all the TLD's under web - both WEB-INF directories must be present). /li liCopy jaxp 1.0.1's (NOT 1.1.1's) jaxp.jar and parser.jar to the servlets directory of the strut-example webapp. /li liIn the servlets directory, open struts.jar with WinZip. Extract the three DTD's (struts-config_1_0.dtd, web-app_2_2.dtd and web-app_2_3.dtd) into the servlets directory making sure you use folder names (so the files extract to servlets/org/apache/struts/resources). /li liClick on struts-example in the Admin Console under Default Server/Default Servlet Engine and click the advanced tab on the right hand side of the screen. /li liDown where it says Default Error Page, enter /ErrorReporter and then click Apply. /li liStart the Default Server via the Admin Console. You should see a whole bunch of ActionServlet messages in the default_host_stdout.log file with no exceptions. /li liVia a browser accessed the app using http://localhost/struts-example/index.jsp. /li liIf it returns "Application not Available" then go back to the Admin Console, right-click on struts-example and select Restart WebApp. /li liOnce it reports success, go back to the URL above and try again - it should work flawlessly. /li /ol p For whatever reason, some installations do not like XML files that reference PUBLIC DTD's - if in looking at the default_host_stdout.log file you see errors about invalid public URL references during DTD registrations, or if your pages say "cannot find //logon or //saveRegistration (ie. action mappings) then do the following:/p ol liStop Default Server/li liGo to servlets\WEB-INF\ and edit web.xml and struts_config.xml./li liIn the DOCTYPE declaration, change the word PUBLIC to SYSTEM and completely remove the line that reads "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" from web.xml and remove "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" from struts-config.xml. /li liSave these changes and go back to step 10 above./li /ol pJust as a troubleshooting guide - /p pIf you are getting errors like "Cannot find ActionMappings, etc..." or "Cannot find key org.apache.struts.MESSAGE" then your application is most likely still bombing on the struts-config issue that Richard discovered. The above steps SHOULD correct that leaving nothing out. If you are getting 404 errors about //logon or something not found, then you are still having XML config troubles and it is not initializing the Action servlet properly. Follow the steps above in regards to DTD's and it should work./p pAs a final thought, I obviously haven't gotten to test too much but I don't believe that there are ANY coding changes that need to be made to
Re: development issues
As I understand it, the automatic properties feature is a way to avoid the menial work of writing assessors and mutators for your form beans. There really isn't any "logic" involved. The ActionForm bean has a standard reset method that you can use to populate your beans with default values. Tahir Awan wrote: Thanks, I will look into David's validator approach. Is there any other implementation of automatic properties which can be used with struts till 1.1. I suppose its THE basic requirement for any web-interface to populate values for update actions and in case of validation fails. Writing custom logic per page is out of question and it has to be part of the framework somehow.
REQUEST: Iterating Input Forms
Hi, I proposed a change to Struts form tags (e.g. html:text, html:hidden, html:checkbox etc) a few days ago so that they would generate appropriate name attributes to automatically populate collections when embedded in the logic:iterate tag. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05231.html What I proposed was that tags such as the above would check if they are embeded in an logic:iterate tag and generate a name attribute appropriately. I changed the html:text, html:hidden, html:checkbox tags so that instead of setting the name property to this.property they used the following method to determine the name (and it worked OK). private String decideName() { // Check if this Tag is embedded in an Iterator Tag Tag tag = findAncestorWithClass(this, IterateTag.class); // No iterator, use the property as the name if (tag == null) return this.property; IterateTag iterator = (IterateTag)tag; int index = iterator.getLengthCount()-1; return iterator.getProperty()+"["+index+"]."+this.property; } (Addtionally the logic:iterate tag needs to be changed to have a getLengthCount() method included). Perhaps this is not a good idea causing too many problems with, for example, compatibility or scope but I would appreciate some feed back. I'm sure if this change is not suitable as it stands there are alternatives which would make it work such as an new attribute which would cause this to be generated or alternatively if you could provide a default method which sets the name to this.property, but could be overriden so that the tags could be sub-classed. Any feed back would be appreciated. Niall This proposal would take Struts jsp such as: logic:iterate id="list" name="formExample" property="beanArray" trtdhtml:hidden name="list" property="code"//td tdhtml:checkbox name="list" property="select"//td tdhtml:text name="list" property="desc"//td /tr /logic:iterate Would generate fields such as: input type="hidden" name="beanArray[0].code" value=".."/ input type="checkbox" name="beanArray[0].select"/ input type="text" name="beanArray[0].desc" value=".."/ Causing Struts to automatically populate a collection of beans using: formExample.getBeanArray(0).setCode(x); formExample.getBeanArray(0).setDesc(x); formExample.getBeanArray(0).setSelect(x); Previous Related Threads: form question http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05210.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05216.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05231.html logic:iterate and form controls, revisited http://www.mail-archive.com/struts-user@jakarta.apache.org/msg02128.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg04316.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg02145.html logic:iterate and form input fields http://www.mail-archive.com/struts-user@jakarta.apache.org/msg01662.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg01646.html http://www.mail-archive.com/struts-user@jakarta.apache.org/msg01417.html winmail.dat
Re: development issues
Any idea how to wake up committers for struts-dev? What makes you think they are asleep? A few points: 1) Rob Leland made some good suggestions on how to proceed, in an earlier message on this thread. You might try taking his advice, although I would recommend his option (1) over his option (2). 2) The Struts 1.1 TODO list contains two items relevant to this discussion. One is titled Standard Validations, and has two volunteers signed up. The other is titled Client Side Validation, and has four volunteers signed up. I would suggest you contact those people, and share your ideas with them. 3) There is at least one other implementation of Struts form validation using regular expressions that I am aware of, which was written by David Winterfeldt, and is based on the Jakarta Regexp package. -- Martin Cooper - Original Message - From: Tahir Awan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 28, 2001 7:13 AM Subject: RE: development issues That's the exact intention I had while putting in regex validation i.e., to provide basic validation. btw, I havn't seen any comment regarding automatic properties. For us, its saving a lot of time as we are not worried about prepopulating the input fields if some validation fails. Another scenario is for dynamic html forms. Like we have an input form where user can input any number of email addresses. Default is 1 and he can click Add Email and the same form will be displayed with an additional text box and all the already entered values intact. And all this is done by framework without any custom coding in JSP or beans. Any idea how to wake up committers for struts-dev? Tahir Awan -Original Message- From: Cook, Levi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 10:46 AM To: '[EMAIL PROTECTED]' Subject: RE: development issues Surely I'm reiterating the obvious here, but Javascript alone cannot/should not be relied upon for validation. It does play a useful and important role, however its scope should normally be limited to improving the users experience with supplying input that our system understands. If the framework provides a facility for sending Javascript to the browser, I would propose including a mechanism that allows the developer to specify which browsers their script can safely run in. Its just a quick observation, but the role of validation within Struts (a web app. framework) should be limited validating user input. This is closely related to the role an ActionForm plays by representing user input as Strings. Therefore, IMHO, the goal of Struts validation should simply be to ensure user supplied input can safely be converted into the objects primitives our domain objects expect. Within this context, validating user input, regular expressions are very valuable and powerful and should be made available. As someone else stated earlier, domain specific validations can, and normally do, require more sophisticated mechanisms than regular expressions alone provide. In general, I would not advise that anyone make their domain validations dependant on the validation facilities that Struts or JavaScript provide. Anyway, that my 2 cents, Levi Cook Greenbrier Russel Madison, Wisconsin www.gr.com [EMAIL PROTECTED] -Original Message- From: Jim Richards [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, March 27, 2001 9:04 AM To: [EMAIL PROTECTED] Subject: RE: development issues But its not bad either for basic form validation (null, range checks like) and much better than using Javascript. I dont think any backend will rely upon JSP validation and wont perform its own tests prior to saving the data. Well, one of the 1.1 discussions is client side validation using JavaScript, which as of JavaScript1.2 has regext facilties built in, so I'd expect they'd be used. But that stops older browsers from working. But as you point out, server side validation should be done as well to correctly check the data against a greater number of tests. -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html http://www.cyber4.org/kumera/index.html