missing onmousexxx attributes of img tag in struts-html.tld
the onmouseover, onmousedown, etc. attributes of the tag img, class org.apache.struts.taglib.html.ImgTag, seem to be missing from the struts-html.tld file. am I correct or am I missing something ?
struts-html:image tag and cancel functionality
I am now using in my application the struts-html:image tag to produce graphical buttons. This tag writes a HTML tag input type="image" name="aaa". the problem with the input type="image" tag is that it submits "aaa.x" and "aaa.y" parameters rather than the usual "aaa" parameter. Thus I cannot use the struts-html:image for a cancel function because the ActionServlet tests for Constants.CANCEL_PROPERTY, in a request that include only Constants.CANCEL_PROPERTY.x and Constants.CANCEL_PROPERTY.y parameters. would it be feasible to change slightly this test ? For example, in place of: (ActionServlet.java:1851) if (request.getParameter(Constants.CANCEL_PROPERTY) != null) { ... to have : if (request.getParameter(Constants.CANCEL_PROPERTY) != null || request.getParameter(Constants.CANCEL_PROPERTY+".x") != null) { ... thanks Christophe
Re: missing onmousexxx attributes of img tag in struts-html.tld
At 10:38 AM 19/02/01 +0100, Christophe Thibaud wrote: the onmouseover, onmousedown, etc. attributes of the tag img, class org.apache.struts.taglib.html.ImgTag, seem to be missing from the struts-html.tld file. Those particular events are generally handed with an anchor tag around the img tag. Thanks for the answer. The anchor will be fine for me. Internet explorer handles those events for almost any element within a page. Netscape Navigator haowever does not. So, yes wrap it with an anchor tag. -- 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
Problem re-populating List property from a form to a FormBean - BUG/ENHANCEMENT in ConvertUtils/BeanUtils?
There appears to by an problem populating properties which are generic collections (as opposed to arrays) from FormBeans. If the underlying property is an array of strings, then it is straight forward to populate multiform boxes via the multiform tag, to and from the corresponding property in the FormBeans via the usual struts mechanism. However, if the property is a Collection of Strings, though the automatic filling of the multiboxes works fine when reading data from the FormBean, but the exception below occurs when trying to re-populate the data in the form back to the FormBean. The MultiTag has the smarts to check if the property class is a collection or an array of Strings when reading the data, however the ConvertUtils.convert(String[], Class) method called by BeanUtils.populate method defaults to returning an array of Strings when it doesn't recognise the class type, and hence java.lang.IllegalArgumentException: argument type mismatch when trying to push the returned array into a Collection. This could be fixed by adding some Collections (in particular a List) to the types recognised by ConvertUtils.convert, or less preferably, modifying the BeanUtils.populate method. /alix Error: 500 Location: /projectxxx/testBriefing.do Internal Servlet Error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java, Compiled Code) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:18 18) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1429) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:490) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code) at java.lang.Thread.run(Thread.java, Compiled Code) Root cause: java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java, Compiled Code) at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java, Compiled Code) at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java, Compiled Code) at org.apache.struts.util.BeanUtils.populate(BeanUtils.java, Compiled Code) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java, Compiled Code) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:18 18) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1429) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:490) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java, Compiled Code) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java, Compiled Code) at java.lang.Thread.run(Thread.java, Compiled Code)
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html package.html
husted 01/02/19 09:20:47 Added: src/share/org/apache/struts/taglib/html package.html Log: (Submitted by Ted Husted.) Add package.html as source to generate HTML Tag Developer's Guide. Revision ChangesPath 1.1 jakarta-struts/src/share/org/apache/struts/taglib/html/package.html Index: package.html === html head titlePackage Documentation for org.apache.struts.taglib.html Package/title /head body bgcolor="white" pa name="doc.Description"The "struts-html" tag library/a contains JSP custom tags useful in creating dynamic HTML user interfaces, including input forms./p div align="center" p a href="#doc.Intro"[Introduction]/a a href="#doc.Form"[HTML Form Tags]/a a href="#doc.Form"[Other HTML Tags]/a /p /div hr h3a name="doc.Intro"Introduction/a/h3 pThe tags in the Struts HTML library form a bridge between a JSP view and the other components of a Web application. Since a dynamic Web application often depends on gathering data from a user, input forms play an important role in the Struts framework. Consequently, the majority of the HTML tags involve a href="#doc.Form"HTML/a forms. Other important issues addressed by the Struts-HTML tags are a href="#doc.Other.errors"error messages/a, a href="#doc.Other.hyperlinking"hyperlinking/a and a href="#doc.Other.i18n"internationalization/a./p hr h3a name="doc.Form"HTML "form" tags/a/h3 ul lia href="../../../../../../struts-html.html#button"button/a/li lia href="../../../../../../struts-html.html#cancel"cancel/a/li lia href="../../../../../../struts-html.html#checkbox"checkboxes/a/li lia href="../../../../../../struts-html.html#file"file/a/li lia href="../../../../../../struts-html.html#hidden"hidden/a/li lia href="../../../../../../struts-html.html#image"image/a/li lia href="../../../../../../struts-html.html#multibox"multibox/a/li lia href="../../../../../../struts-html.html#password"password/a input fields/li lia href="../../../../../../struts-html.html#radio"radio/a buttons/li lia href="../../../../../../struts-html.html#reset"reset/a buttons/li lia href="../../../../../../struts-html.html#select"select/a lists with embedded/li lia href="../../../../../../struts-html.html#option"option/a/li lia href="../../../../../../struts-html.html#options"options/a/li lia href="../../../../../../struts-html.html#submit"submit/a buttons/li lia href="../../../../../../struts-html.html#text"text/a input fields/li lia href="../../../../../../struts-html.html#textarea"textareas/a/li /ul pEach of these tags must be nested within a lt;html:formgt; tag./p h4a name="doc.Form.formTag"About the form tag/a/h4 pThe Struts codeform/code tag outputs a standard HTML form tag, and also links the input form with a JavaBean subclassed from the Struts ActionForm object (see a href="../../../../../../api/index.html"Javadoc/a). Each field in the form should correspond to a property of the form's bean. When a field and property correspond, the bean is first used to populate the form, and then to store the user's input when the form is submitted to the controller servlet./p pThe name of the bean and its class can be specified as a property to the form tag, but may also be omitted. If omitted, the codeActionMappings/code database (loaded from the codestruts-config.xml/code file) is consulted. If the current page is specified as the codeinput/code property for an codeaction/code, the name of the codeaction/code is used. The codetype/code property for the bean is also then taken from the configuration, via a Form Bean definition./p pHere's a clip from the Struts Example configuration:/p pre lt;action-mappingsgt; lt;!-- Process a user logon --gt; lt;action path=quot;/logonquot; type=quot;org.apache.struts.example.LogonActionquot; name=quot;logonFormquot; scope=quot;requestquot; input=quot;/logon.jspquot;gt; lt;/actiongt; lt; ... /gt; lt;/action-mappingsgt; lt;form-beansgt; lt;!-- Logon form bean --gt; lt;form-bean name=quot;logonFormquot; type=quot;org.apache.struts.example.LogonFormquot;/gt; lt; ... /gt; lt;/form-beansgt; lt;/pregt; /pre pGiven this configuration, the HTML form tag for codeinput.jsp/code will default to using "codelogonForm/code" as its name property and "codeorg.apache.struts.example.LogonForm/code" as the attribute's type. This way you can manage the namespace for your framework components from the configuration file./p pIf the form tag does not find the form bean in any of the scopes (page, request, session, application), it creates one using the specified type./p pThe Struts codeActionForm/code class is equipped
PROPOSAL - Testing Framework
I would like to add some additional Unit tests to the struts framework. These would be tests for struts itself, not end user code. My thoughts are that as struts evolves and new functionality is added we want to verify that other functionality is not broken, as code is changed and refactored. I am proposing using JUnit 3.5 (http://junit.sourceforge.net/) and J2EEUnit (J2eeunit.sourceforge.org). I am going to force myself to do this in an upcoming project at work, and believe it makes sense to do it in struts also. I am targeting the 1.1 release time period. If Unit testing is approved, some small set of tests may make it into the struts 1.0 release, again assuming people here vote for its inclusion. My initial thoughts for providing testing is to start with the private methods of struts starting with the struts.action package, then later develop tests for the public methods of struts.action. I didn't want to start another package until I finished the majority of the private methods, only because I would need to debug my unit tests, and only by developing tests for some of the private methods the public could I do this. Then other packages would follow : struts.upload, struts.util, struts.digester, struts.actions, struts.taglib.X In about that order, only because that would be a usefull order for me in the project I am working on. Infact, I only have plans to do struts.upload, and struts.util, and doubt I would have the time to produce tests for the other packages. Thoughts ? -Rob
RE: PROPOSAL - Testing Framework
+1 We are already using the ant 'junit' task in some of our project, and it works really well. One thing we have found is that our tests really end up being split into two kinds: unit, and integration. We classify as 'unit' those tests which can run on the code as compiled in place in the build directory. These tests typically stress some smaller piece of code, often simulating some of the interfaces the code normally interacts with. We classify as integration those tests which require something to be deployed into a running server somewhere. While this can and should be automated, it is a different level of testing... Both kinds of tests are very useful... -Original Message- From: Rob Leland [mailto:[EMAIL PROTECTED]] Sent: February 19, 2001 1:37 PM To: [EMAIL PROTECTED] Subject: PROPOSAL - Testing Framework I would like to add some additional Unit tests to the struts framework. These would be tests for struts itself, not end user code. My thoughts are that as struts evolves and new functionality is added we want to verify that other functionality is not broken, as code is changed and refactored. I am proposing using JUnit 3.5 (http://junit.sourceforge.net/) and J2EEUnit (J2eeunit.sourceforge.org). I am going to force myself to do this in an upcoming project at work, and believe it makes sense to do it in struts also. I am targeting the 1.1 release time period. If Unit testing is approved, some small set of tests may make it into the struts 1.0 release, again assuming people here vote for its inclusion. My initial thoughts for providing testing is to start with the private methods of struts starting with the struts.action package, then later develop tests for the public methods of struts.action. I didn't want to start another package until I finished the majority of the private methods, only because I would need to debug my unit tests, and only by developing tests for some of the private methods the public could I do this. Then other packages would follow : struts.upload, struts.util, struts.digester, struts.actions, struts.taglib.X In about that order, only because that would be a usefull order for me in the project I am working on. Infact, I only have plans to do struts.upload, and struts.util, and doubt I would have the time to produce tests for the other packages. Thoughts ? -Rob
RE: As promised (Struts Presentation)
Title: RE: As promised (Struts Presentation) Hi Craig. First, excellent presentation. You seem to hit the main points needed to understand and implement a Struts framework. Do you know where/what the original source for the Model 2 architecture is? Can't find a whitepaper on Sun's website. No hurry, reply if/when you get a chance. Thanks. gp -Original Message- From: Craig Tataryn [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 13, 2001 3:37 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: As promised (Struts Presentation) Craig M.: Can you add the link to the presentation (if you deem it suitable) to the resources section of the Struts User Guide? URL forwarding sucks. Given that, I will have to give you the link to the presentation as it exists on the server space I am borrowing until I get my own server box. The URL may change in the future to my computer-programmer.org domain. The Struts presentation I did can be found (at least for the time being) at: http://www.us-eh.com/craiger/articles/struts/ Let me know of any problems or suggestions you may have about the presentation! Thanks, Craig. -- I've been trying to change the world for years, but they just won't give me the source code
cvs commit: jakarta-struts/src/doc installation-wls.xml installation-jrun.xml installation-sas.xml installation-tc.xml installation-ubs.xml installation-was.xml installation.xml
husted 01/02/19 12:39:27 Modified:src/doc installation.xml Added: src/doc installation-wls.xml installation-jrun.xml installation-sas.xml installation-tc.xml installation-ubs.xml installation-was.xml Log: (Submitted by Ted Husted). Per Craig's suggestions: * Make the page names include just the server name, and not the version number. That way, you can have separate sections on the page for each individual version of the same server. New sections can be conveniently added to the bottom as new versions of the servers come out. Maybe include a hyperlink index at the top of each page for all the documented version numbers? * On the Tomcat page, I've seen so many problems with bugs in Tomcat 3.1 that I do not recommend it as a platform for Struts based apps. I'd like to have the install documents recommend that people upgrade to at least Tomcat 3.2.1. * The Tomcat instructions related to integration with Apache apply only to 3.1 and 3.2 -- the instructions for 4.0 will be different. Right now, the 4.0 section should just talk about running stand alone, though -- the 4.0 web connector is not ready for prime time. Revision ChangesPath 1.15 +8 -7 jakarta-struts/src/doc/installation.xml Index: installation.xml === RCS file: /home/cvs/jakarta-struts/src/doc/installation.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- installation.xml 2001/02/19 19:52:51 1.14 +++ installation.xml 2001/02/19 20:39:25 1.15 @@ -230,19 +230,20 @@ h3Status of various containers/h3 ul - liTomcat 3.1+ "standalone" - No additonal steps required./li + liTomcat 3.1 and prior - Not recommended. Use Tomcat 3.2.1 or later./li + liTomcat 3.2.1+ "standalone" - No additional steps required./li liResin 2.1+ "standalone" - No additional steps required./li liWebLogic 6.0+ - No additional steps required./li /ul ul - liBluestone Universal Business Server - a href="installation-ubs72.html"Additional steps required./a/li - liJRUN - a href="installation-jr30.html"Additional steps required./a/li + liBluestone Universal Business Server - a href="installation-ubs.html"Additional steps required./a/li + liJRUN - a href="installation-jrun.html"Additional steps required./a/li liOrion Application Server - a href="installation-oas.html"Additional steps required./a/li - liSilverstream - - a href="installation-sas371.html"Additional steps required./a/li - liTomcat 3.1+ with Apache - a href="installation-tc31.html"Additional steps required./a/li - liWeblogic 5.1 (sp8) - a href="installation-wls5.html"Additional steps required./a/li - liWebSphere - a href="installation-was352.html"Additional steps required./a/li + liSilverstream - - a href="installation-sas.html"Additional steps required./a/li + liTomcat 3.2.1 with Apache - a href="installation-tc.html"Additional steps required./a/li + liWeblogic 5.1 (sp8) - a href="installation-wls.html"Additional steps required./a/li + liWebSphere - a href="installation-was.html"Additional steps required./a/li /ul 1.1 jakarta-struts/src/doc/installation-wls.xml Index: installation-wls.xml === ?xml version="1.0"? document url="./installation-wls.xml" properties authorRobert Hayden/author authorWong Kok Kai/author titleThe Struts Framework Project - Installation - Weblogic/title /properties body section name="Installing Struts with your servlet container" href="Containers" h3a name="wls5"Weblogic 5.1 (service pack 8)/a/h3 ul liObtain and install the Xerces XML parser (problems have been reported with the Sun reference implementation). Put xerces.jar in your WebLogic system path./li liObtain and unpack the Struts binary distribution (this procedure assumes it was extracted to codec:\jakarta-struts/code)./li liAdd an entry to weblogic.properties for each of the Struts web applications that you would like to configure. For example, to make the struts-example application available, add the following line to weblogic.properties:br/ codeweblogic.httpd.webApp.strutsexample=br/ c:/jakarta-struts/webapps/struts-example.war/code/li liYou do not need to include struts.jar or any of the application specific classes in the WebLogic classpath, since this will be done automatically (unless deploying an unpacked web archive- see below)./li liStart WebLogic server and point your web browser to the struts application. For example, to connect to the example application added in step 3:br/
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html package.html
craigmcc01/02/19 12:48:18 Modified:src/share/org/apache/struts/taglib/html package.html Log: Clean up a few stray hyperlinks. Revision ChangesPath 1.2 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/html/package.html Index: package.html === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- package.html 2001/02/19 17:20:47 1.1 +++ package.html 2001/02/19 20:48:16 1.2 @@ -94,7 +94,7 @@ pThe Struts codeActionForm/code class is equipped with standard codereset()/code and codevalidate()/code methods, that can be used by the controller to enable - automatic data validation. See the a href="/../../../../../../userGuide/building_view.html#form_validation" + automatic data validation. See the a href="../../../../../../userGuide/building_view.html#form_validation" Users Guide/a for more about Form Validation. An important aspect of validation is reporting errors to the user. This can be handled by the Struts codeerrors/code tag, which is discussed a href="#doc.Other.errors"later in this document/a./p @@ -106,9 +106,9 @@ tag attributes that have the same meaning, no matter what field tag they are used with. These properties also accept Runtime Expressions, meaning you can set them with a scriptlet. The common attributes fall into four categories: - a href="doc.Form.attributes.struts"Struts Common,/a a href="doc.Form.attributes.navigation"HTML - Navigation/a, a href="doc.Form.attributes.javascript"Javascript/a, and - a href="doc.Form.attrbutes.css"CSS/a./p + a href="#doc.Form.attributes.struts"Struts Common,/a a href="#doc.Form.attributes.navigation"HTML + Navigation/a, a href="#doc.Form.attributes.javascript"Javascript/a, and + a href="#doc.Form.attributes.css"CSS/a./p h5a name="doc.Form.attributes.struts"Struts Common/a/h5 div align="center" center @@ -228,7 +228,7 @@ /center /div h5nbsp;/h5 -h5a name="doc.Form.navigation"HTML Navigation Attributes/a/h5 +h5a name="doc.Form.attributes.navigation"HTML Navigation Attributes/a/h5 div align="center" center table width=90% border="1" cellpadding="4" @@ -245,7 +245,7 @@ /center /div h5nbsp;/h5 -h5a name="doc.Form.css"CSS Attributes/a/h5 +h5a name="doc.Form.attributes.css"CSS Attributes/a/h5 div align="center" center table width=90% border="1" cellpadding="4"
Digester docs...
In the Digester user guide: http://jakarta.apache.org/struts/api/org/apache/struts/digester/package-summary.html#package_description There is an example of how to use the addObjectCreate method: digester.addObjectCreate("struts-config/global-forwards/forward", forwardClass, "className"); Perhaps it would be less confusing if the description that reads: A new object instance is created -- the ActionForward instance that will represent this definition. The Java class name defaults to that specified as an initialization parameter, but can be overridden by using the "className" attribute. The new forward instance is pushed onto the stack. Read like this: A new object instance is created -- the ActionForward instance that will represent this definition. The Java class name defaults to that specified as an initialization parameter which we have stored in the String variable forwardClass, but can be overridden by using the "className" attribute found in the the node we are currently parsing. The new forward instance is pushed onto the stack. Either that, or just change the example to read like this: digester.addObjectCreate("struts-config/global-forwards/forward", "org.apache.struts.action.ActionForward", "className"); Is that fair? Craig T. -- I've been trying to change the world for years, but they just won't give me the source code begin:vcard n:Tataryn;Craig tel;home:952-884-6752 tel;work:952-842-5576 x-mozilla-html:TRUE url:http://www.computer-programmer.org org:Compuware;Professional Division adr:;;3600 West 80th St. Suite 400;Bloomington;MN;55431;United States of America version:2.1 email;internet:[EMAIL PROTECTED] title:Senior Staff Analyst fn:Craig Tataryn end:vcard
i18n and Resources
Hi, I'm attempting to develop a fuller form of internationalization for Struts, which includes retrieving content from more than something such as a ResourceBundle. The basic idea is that you have a Resource, which is an interface that represents anything that has internationalized content. It has a method that looks basically like this: public byte[] getData(String key, Locale locale, TimeZone timeZone); Of course, time zone is optional, it would depend on the implementation whether or not to use it. You would define these resources in some xml file, like so: resource type="org.apache.struts.i18n.FileSystemResource" name="STATIC_CONTENT" property name="fileBase"/usr/local/content/static/property /resource resource type="org.apache.struts.i18n.DatabaseResource" name="DB_CONTENT" !-- possibly specify a bunch of database related properties such as username and password, or tie it into data sources specified in struts-config.xml. There would also be something specified to where exactly in the data source to pull the content from, this is way up in the air right now -- /resource Then, you would use a taglib inside of your jsp page to retrieve the content: %@ page langauge="java" % %@ taglib uri="/WEB-INF/struts-i18n.tld" prefix="i18n" % h3This is static internationalized content:/h3 i18n:resource key="my.content" name="STATIC_CONTENT" / h3This is internationalized content pulled from a database:/h3 i18n:resource key="my.article" name="DB_CONTENT" / Taking this further, you could create a resource implementation that plugs into some kind of commercial content managment system, and so on. Is there any interest in something like this? I'm currently in the process of developing this idea, and I'd like as much input as possible, not only with this, but with internationalization in general. I attached the Resources class, just to illustrate a bit. Resource.java Resource.java
Re: i18n and Resources
I'm definitely interested but one question: why not use java.util.ResourceBundle as the base class? It helps as existing ListResourceBundle and PropertyResourceBundle can still be used. "Schachter, Michael" wrote: Hi, I'm attempting to develop a fuller form of internationalization for Struts, which includes retrieving content from more than something such as a ResourceBundle. The basic idea is that you have a Resource, which is an interface that represents anything that has internationalized content. It has a method that looks basically like this: public byte[] getData(String key, Locale locale, TimeZone timeZone); Of course, time zone is optional, it would depend on the implementation whether or not to use it. You would define these resources in some xml file, like so: resource type="org.apache.struts.i18n.FileSystemResource" name="STATIC_CONTENT" property name="fileBase"/usr/local/content/static/property /resource resource type="org.apache.struts.i18n.DatabaseResource" name="DB_CONTENT" !-- possibly specify a bunch of database related properties such as username and password, or tie it into data sources specified in struts-config.xml. There would also be something specified to where exactly in the data source to pull the content from, this is way up in the air right now -- /resource Then, you would use a taglib inside of your jsp page to retrieve the content: %@ page langauge="java" % %@ taglib uri="/WEB-INF/struts-i18n.tld" prefix="i18n" % h3This is static internationalized content:/h3 i18n:resource key="my.content" name="STATIC_CONTENT" / h3This is internationalized content pulled from a database:/h3 i18n:resource key="my.article" name="DB_CONTENT" / Taking this further, you could create a resource implementation that plugs into some kind of commercial content managment system, and so on. Is there any interest in something like this? I'm currently in the process of developing this idea, and I'd like as much input as possible, not only with this, but with internationalization in general. I attached the Resources class, just to illustrate a bit. Resource.java Name: Resource.java Resource.javaType: JAVA File (application/x-unknown-content-type-java_auto_file) Encoding: quoted-printable
Re: i18n and Resources
Wong Kok Wai wrote: I'm definitely interested but one question: why not use java.util.ResourceBundle as the base class? It helps as existing ListResourceBundle and PropertyResourceBundle can still be used. Among other things, ResourceBundle and PropertyResourceBundle are not Serializable. This causes problems on several application servers that like their servlet context attributes, and not just session attributes, to be Serializable. Craig
Re: i18n and Resources
"Schachter, Michael" wrote: Hi, I'm attempting to develop a fuller form of internationalization for Struts, which includes retrieving content from more than something such as a ResourceBundle. The basic idea is that you have a Resource, which is an interface that represents anything that has internationalized content. It has a method that looks basically like this: public byte[] getData(String key, Locale locale, TimeZone timeZone); Of course, time zone is optional, it would depend on the implementation whether or not to use it. It would be interesting if the existing MessageResources mechanisms (and the bean:message tag) could be layered on top of this abstraction in some convenient way -- either by creating an implementation of MessageResources or by extending your Resource abstraction to include a getString() method. Craig
Re: i18n and Resources
Jason van Zyl wrote: I hate the fact that the word "service" is so overused, but in this context it would be an implementation of an interface residing at the request scope of an application. I'm still pushing for a lightweight, application level service framework within Struts, I'm just working on a proof of concept and some real code before I go and introduce anything, probably not a great move community-wise on my part. For people unfamiliar with the service framework I'm talking about, basically it's a set of standard interfaces for common application functionality such as localization, device detection, object pooling, etc. The most common functionality would be included with implementations with Struts, more time-intensive implementations could hopefully be represented as a set of plugins/adapters for commercial vendor products that provide that functionality. There is already a functional services framework in Turbine, is there anyway we could work together on this? Ted Husted (a Struts commtter) and several others are trying to put together a proposal for a code sharing subproject/repository/something on the GENERAL list right now -- this sounds like another candidate for code that could be shared once the infrastructure of the sharing is set up. Jason, does this also relate to the DbResources discussion recently on VELOCITY-DEV, or is that something different? jvz. Craig
Re: i18n and Resources
Ted Husted (a Struts commtter) and several others are trying to put together a proposal for a code sharing subproject/repository/something on the GENERAL list right now -- this sounds like another candidate for code that could be shared once the infrastructure of the sharing is set up. I've been following it, I've just been quiet :-) Jason, does this also relate to the DbResources discussion recently on VELOCITY-DEV, or is that something different? A little different I think: that was more about velocity related tools, or even webapp related tools, versus general tools like a services framework or db connection pool. I guess it's time for me to jump into the discussion of sharing tools :-) If I can I would like to share an introspector between struts and velocity. I have a feeling that the structs introspector is more complete so I would be all for using the struts introspector and it can probably be done :-) jvz.
RE: i18n and Resources
On Mon, 19 Feb 2001, Schachter, Michael wrote: Jason, I don't see why not, the general idea is the same. Maybe there should be an org.apache.services package and a separate repository for this sort of thing? The kind of thing where Turbine and Struts committers can both participate? There's a discussion on the general list about general tools and frameworks. I guess we should jump in there as there is a discussion in progress! If there was collaboration, I'd prefer it not to be Struts or Turbine based. A framework where the community at large decides on how the interface methods are declared would be a powerful thing, and shouldn't be interfered with because different design methodologies for web applications cause different projects to exist. I mean, this is open source. There's a services framework in Avalon and there is one in Turbine. I'm all for melding them into a single framework. There's probably good things about both of them, I am only familiar with the Turbine service framework, but I will be looking at the Avalon way soon! jvz.
Re: i18n and Resources
Jason van Zyl wrote: Ted Husted (a Struts commtter) and several others are trying to put together a proposal for a code sharing subproject/repository/something on the GENERAL list right now -- this sounds like another candidate for code that could be shared once the infrastructure of the sharing is set up. I've been following it, I've just been quiet :-) I've been following some of it, and probably spoke a little rashly in some circumstances :-). Jason, does this also relate to the DbResources discussion recently on VELOCITY-DEV, or is that something different? A little different I think: that was more about velocity related tools, or even webapp related tools, versus general tools like a services framework or db connection pool. OK ... just wanted to make sure we weren't missing a useful use case. I guess it's time for me to jump into the discussion of sharing tools :-) If I can I would like to share an introspector between struts and velocity. I have a feeling that the structs introspector is more complete so I would be all for using the struts introspector and it can probably be done :-) It should be feasible to share this. The needs look to be reasonably similar. I recently refactored this family of classes to have no dependencies on other Struts APIs (or even on servlet APIs for that matter). Future enhancement plans include support for PropertyEditor classes (to let apps customize the property--String translations necessary when going to and from an HTML page) and bean properties that are Collections (treating them sort of like indexed or array-based properties), which would also benefit both Velocity and Struts. jvz. Craig
Re: i18n and Resources
I guess it's time for me to jump into the discussion of sharing tools :-) If I can I would like to share an introspector between struts and velocity. I have a feeling that the structs introspector is more complete so I would be all for using the struts introspector and it can probably be done :-) It should be feasible to share this. The needs look to be reasonably similar. I recently refactored this family of classes to have no dependencies on other Struts APIs (or even on servlet APIs for that matter). Future enhancement plans include support for PropertyEditor classes (to let apps customize the property--String translations necessary when going to and from an HTML page) and bean properties that are Collections (treating them sort of like indexed or array-based properties), which would also benefit both Velocity and Struts. I think it's totally feasible. The idea of a pluggable introspector came up on the vel-dev list a couple weeks ago and that's probably a good idea and if that were done then we could probably share the introspector that's in struts. Velocity has some non-standard behavior like picking values out of Maps, but the introspector proper could probably be shared without much work. If I could get the struts introspector working in velocity maybe we could make that the first tool placed in the org.apache.util package! :-) We'll show them we can play nice ;-) jvz.
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html ErrorsTag.java
craigmcc01/02/19 19:11:20 Modified:src/share/org/apache/struts/taglib/html ErrorsTag.java Log: Throw a runtime exception if we cannot identify the format in which error messages were transmitted to this tag. Among other things, this should catch the case where class loader problems in WebLogic 5.1 cause the "instanceof" test for ActionErrors to fail, resulting in no messages at all being rendered. Submitted by: Jason Songhurst [EMAIL PROTECTED] PR: Bugzilla #467 Revision ChangesPath 1.7 +17 -4 jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java Index: ErrorsTag.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ErrorsTag.java2001/02/20 01:48:46 1.6 +++ ErrorsTag.java2001/02/20 03:11:20 1.7 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v 1.6 2001/02/20 01:48:46 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2001/02/20 01:48:46 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v 1.7 2001/02/20 03:11:20 craigmcc Exp $ + * $Revision: 1.7 $ + * $Date: 2001/02/20 03:11:20 $ * * * @@ -98,7 +98,7 @@ * /ul * * @author Craig R. McClanahan - * @version $Revision: 1.6 $ $Date: 2001/02/20 01:48:46 $ + * @version $Revision: 1.7 $ $Date: 2001/02/20 03:11:20 $ */ public class ErrorsTag extends TagSupport { @@ -142,6 +142,13 @@ /** + * The message resources for this package. + */ +protected static MessageResources messages = + MessageResources.getMessageResources(Constants.Package + ".LocalStrings"); + + +/** * The request attribute key for our error messages (if any). */ protected String name = Action.ERROR_KEY; @@ -205,6 +212,12 @@ new ActionError(keys[i])); } else if (value instanceof ActionErrors) { errors = (ActionErrors) value; +} else { +JspException e = new JspException +(messages.getMessage("errorsTag.errors", + value.getClass().getName())); +RequestUtils.saveException(pageContext, e); +throw e; } } catch (Exception e) { ;
cvs commit: jakarta-struts/web/example logon.jsp registration.jsp subscription.jsp
craigmcc01/02/19 21:20:13 Modified:src/doc struts-html.xml src/share/org/apache/struts/action Action.java ActionServlet.java src/share/org/apache/struts/taglib/html FormTag.java LocalStrings.properties web/example logon.jsp registration.jsp subscription.jsp Log: Fix the html:form action="xxx" attribute to correctly work for both extension mapping and path mapping of the controller servlet -- at least as long as your servlet container correctly allows the following to work: InputStream is = getServletContext().getResourceAsStream("/WEB-INF/web.xml"); like it is supposed to. The new recommended approach is to set the action attribute of html:form to exactly the path of the Action to which you wish the form to be submitted. The html:form tag will understand how the action servlet is being mapped, and will construct an appropriate URL accordingly. For backwards compatibility, the existence of the extension-mapping extension on an action attribute still works, so either of the following tags would work in the Struts example application: html:form action="/logon.do" ... html:form action="/logon" ... The latter path will also work if the controller servlet is path-mapped, but you will need to adjust the paths for several of the forward elements in this case. Submitted by: Marcus Ahnve [EMAIL PROTECTED] PR: Bugzilla #587 Revision ChangesPath 1.15 +2 -2 jakarta-struts/src/doc/struts-html.xml Index: struts-html.xml === RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- struts-html.xml 2001/02/20 02:58:59 1.14 +++ struts-html.xml 2001/02/20 05:20:05 1.15 @@ -1018,8 +1018,8 @@ pIf you are using extension mapping for selecting the controller servlet, this value should be equal to the codepath/code attribute of the corresponding -codelt;actiongt;/code element, plus the correct -file extension suffix./p +codelt;actiongt;/code element, optionally +followed by the correct extension suffix./p pIf you are using path mapping to select the controller servlet, this value should be exactly equal 1.17 +14 -4 jakarta-struts/src/share/org/apache/struts/action/Action.java Index: Action.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Action.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- Action.java 2001/01/11 00:16:56 1.16 +++ Action.java 2001/02/20 05:20:07 1.17 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Action.java,v 1.16 2001/01/11 00:16:56 craigmcc Exp $ - * $Revision: 1.16 $ - * $Date: 2001/01/11 00:16:56 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Action.java,v 1.17 2001/02/20 05:20:07 craigmcc Exp $ + * $Revision: 1.17 $ + * $Date: 2001/02/20 05:20:07 $ * * * @@ -106,7 +106,7 @@ * by this Action. * * @author Craig R. McClanahan - * @version $Revision: 1.16 $ $Date: 2001/01/11 00:16:56 $ + * @version $Revision: 1.17 $ $Date: 2001/02/20 05:20:07 $ */ public class Action { @@ -207,6 +207,16 @@ */ public static final String MULTIPART_KEY = "org.apache.struts.action.mapping.multipartclass"; + + +/** + * The context attributes key under which we store the mapping defined + * for our controller serlet, which will be either a path-mapped pattern + * (code/action/*/code) or an extension mapped pattern + * (code*.do/code). + */ +public static final String SERVLET_KEY = +"org.apache.struts.action.SERVLET_MAPPING"; /** 1.59 +83 -4 jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java Index: ActionServlet.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- ActionServlet.java2001/02/14 00:19:46 1.58 +++ ActionServlet.java2001/02/20 05:20:07 1.59 @@ -1,7 +1,7 @@ /* - * $Header:
[VOTE] Struts 1.0-beta-1 Release Plan
Now that the TODO list for 1.0 (and the bug reports in Bugzilla) are dwindling away, it's time for a 1.0-beta-1 release of Struts! I just checked in an initial draft of a release plan that talks about what will happen, and the criteria for release. Please take a moment to review this document: http://jakarta.apache.org/struts/release-plan-1.0b1.html and vote on your acceptance of this plan. Release plans must pass by a majority vote of committers on the project, but all other interested parties are welcome to cast their votes (and/or make comments or suggestions on the plan) as well. Craig McClanahan
Re: [VOTE] Struts 1.0-beta-1 Release Plan
+1 -- Martin Cooper Tumbleweed Communications - Original Message - From: "Craig R. McClanahan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 10:18 PM Subject: [VOTE] Struts 1.0-beta-1 Release Plan Now that the TODO list for 1.0 (and the bug reports in Bugzilla) are dwindling away, it's time for a 1.0-beta-1 release of Struts! I just checked in an initial draft of a release plan that talks about what will happen, and the criteria for release. Please take a moment to review this document: http://jakarta.apache.org/struts/release-plan-1.0b1.html and vote on your acceptance of this plan. Release plans must pass by a majority vote of committers on the project, but all other interested parties are welcome to cast their votes (and/or make comments or suggestions on the plan) as well. Craig McClanahan
Re: [VOTE] Struts 1.0-beta-1 Release Plan
I still have an outstanding issue with database connection with PostgreSQL that effective cripples the system. I've posted about it to the users mailing list, and didn't put it into the bug system (silly me). I won't have time before the vote closes to log the bug. Any suggestions? "Craig R. McClanahan" wrote: Now that the TODO list for 1.0 (and the bug reports in Bugzilla) are dwindling away, it's time for a 1.0-beta-1 release of Struts! I just checked in an initial draft of a release plan that talks about what will happen, and the criteria for release. Please take a moment to review this document: http://jakarta.apache.org/struts/release-plan-1.0b1.html and vote on your acceptance of this plan. Release plans must pass by a majority vote of committers on the project, but all other interested parties are welcome to cast their votes (and/or make comments or suggestions on the plan) as well. Craig McClanahan