Author: husted Date: Sat Nov 12 05:14:24 2005 New Revision: 332770 URL: http://svn.apache.org/viewcvs?rev=332770&view=rev Log: Taglib - Add FAQ page with questions ported from the Core FAQs. Site - Add "Why two frameworks" section. Distinguish between "Core Extensions" and other Subprojects. App, Core, Faces, Extras (Plugins), Tiles - Conform page titles and navigation.
Added: struts/taglib/trunk/xdocs/faq.xml Modified: struts/apps/trunk/xdocs/navigation.xml struts/core/trunk/src/java/org/apache/struts/action/ActionForm.java struts/core/trunk/xdocs/faqs/kickstart.xml struts/core/trunk/xdocs/userGuide/navigation.xml struts/faces/trunk/xdocs/index.xml struts/faces/trunk/xdocs/navigation.xml struts/flow/trunk/xdocs/navigation.xml struts/plugins/trunk/xdocs/navigation.xml struts/site/trunk/xdocs/index.xml struts/site/trunk/xdocs/navigation.xml struts/taglib/trunk/xdocs/navigation.xml struts/tiles/trunk/xdocs/examples.xml struts/tiles/trunk/xdocs/index.xml struts/tiles/trunk/xdocs/installation.xml struts/tiles/trunk/xdocs/navigation.xml struts/tiles/trunk/xdocs/userGuide.xml Modified: struts/apps/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/apps/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/apps/trunk/xdocs/navigation.xml (original) +++ struts/apps/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<project name="Struts Apps"> +<project name="Struts Applications"> <body> <menu name="Quick Links"> <item Modified: struts/core/trunk/src/java/org/apache/struts/action/ActionForm.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/action/ActionForm.java?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/core/trunk/src/java/org/apache/struts/action/ActionForm.java (original) +++ struts/core/trunk/src/java/org/apache/struts/action/ActionForm.java Sat Nov 12 05:14:24 2005 @@ -126,8 +126,7 @@ /** * <p>Set the servlet instance to which we are attached (if - * <code>servlet</code> is non-null), or release any allocated resources - * (if <code>servlet</code> is null).</p> + * <code>servlet</code> is non-null).</p> * * @param servlet The new controller servlet, if any */ @@ -155,7 +154,7 @@ /** - * <p>Reset all bean properties to their default state. This method is + * <p>>Can be used to reset all bean properties to their default state. This method is * called before the properties are repopulated by the controller.</p> * * <p>The default implementation attempts to forward to the HTTP @@ -176,7 +175,7 @@ /** - * <p>Reset bean properties to their default state, as needed. This method + * <p>Can be used to reset bean properties to their default state, as needed. This method * is called before the properties are repopulated by the controller.</p> * * <p>The default implementation does nothing. In practice, the only @@ -209,7 +208,7 @@ /** - * <p>Validate the properties that have been set for this non-HTTP request, + * <p>Can be used to validate the properties that have been set for this non-HTTP request, * and return an <code>ActionErrors</code> object that encapsulates any * validation errors that have been found. If no errors are found, return * <code>null</code> or an <code>ActionErrors</code> object with no @@ -236,7 +235,7 @@ /** - * <p>Validate the properties that have been set for this HTTP request, + * <p>Can be used to validate the properties that have been set for this HTTP request, * and return an <code>ActionErrors</code> object that encapsulates any * validation errors that have been found. If no errors are found, * return <code>null</code> or an <code>ActionErrors</code> object with Modified: struts/core/trunk/xdocs/faqs/kickstart.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/xdocs/faqs/kickstart.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/core/trunk/xdocs/faqs/kickstart.xml (original) +++ struts/core/trunk/xdocs/faqs/kickstart.xml Sat Nov 12 05:14:24 2005 @@ -1,6 +1,22 @@ <?xml version="1.0"?> -<document url="./kickstart.xml"> -<properties> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document><properties> <title>Kickstart FAQ - Struts Core FAQs and Howtos - Apache Struts</title> </properties> <body> Modified: struts/core/trunk/xdocs/userGuide/navigation.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/xdocs/userGuide/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/core/trunk/xdocs/userGuide/navigation.xml (original) +++ struts/core/trunk/xdocs/userGuide/navigation.xml Sat Nov 12 05:14:24 2005 @@ -45,6 +45,9 @@ <item name="FAQs and HOWTOs" href="faqs/index.html"/> + <item + name="FormDef" + href="https://formdef.dev.java.net/"/> <item name="JavaDocs" href="apidocs/index.html"/> Modified: struts/faces/trunk/xdocs/index.xml URL: http://svn.apache.org/viewcvs/struts/faces/trunk/xdocs/index.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/faces/trunk/xdocs/index.xml (original) +++ struts/faces/trunk/xdocs/index.xml Sat Nov 12 05:14:24 2005 @@ -1,16 +1,33 @@ <?xml version="1.0"?> -<document url="index.html"> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document> <properties> - <title>Struts and JavaServer Faces Integration Library</title> + <title>Welcome</title> </properties> <body> - <section name="Struts-Faces Welcome"> + <section name="Struts and JavaServer Faces Integration Library"> <a name="welcome"/> - <p>This package contains an add-on library that supports the use of + <p>The "Struts-Faces" package contains an add-on library that supports the use of JavaServer Faces (JSF) user interface technology in a Struts based web application, in place of the Struts custom tag libraries. As a proof of concept, it also includes the canonical "struts-example" example Modified: struts/faces/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/faces/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/faces/trunk/xdocs/navigation.xml (original) +++ struts/faces/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<project name="Struts Framework" +<project name="Struts Faces" href="http://struts.apache.org/faces" image="images/struts.gif"> - <title>Struts and JavaServer Faces Integration Library</title> + <title>Apache Struts - Struts-Faces</title> <body> <menu name="Struts-Faces"> <item name="Welcome" href="index.html#Struts-Faces_Welcome"/> @@ -12,9 +12,9 @@ </menu> <menu name="Quick Links"> - <item name="Struts" href="../index.html"/> <item name="JavaServer Faces" href="http://java.sun.com/j2ee/javaserverfaces"/> <item name="Shale Framework" href="../shale/index.html"/> + <item name="Apache Struts Home" href="../index.html"/> </menu> </body> </project> Modified: struts/flow/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/flow/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/flow/trunk/xdocs/navigation.xml (original) +++ struts/flow/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<project name="Struts Framework" +<project name="Struts Flow" href="http://struts.apache.org/flow" image="images/struts.gif"> - <title>Struts Flow - Apache Struts Framework</title> + <title>Apache Struts - Struts Flow</title> <body> - <menu name="Flow"> + <menu name="Struts Flow"> <item name="Welcome" href="index.html"/> <item name="What's New" href="index.html#What_s_New"/> <item name="Requirements" href="index.html#Requirements"/> @@ -30,14 +30,8 @@ <menu name="Quick Links"> <item - name="Struts" + name="Apache Struts Home" href="../index.html"/> - <item - name="User and Developer Guides *" - href="../userGuide/index.html"/> - <item - name="FAQs and HowTos" - href="../faqs/index.html"/> </menu> </body> Modified: struts/plugins/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/plugins/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/plugins/trunk/xdocs/navigation.xml (original) +++ struts/plugins/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<project name="Struts Plugins"> +<project name="Struts Extras"> +<title>Apache Struts - Struts Extras/title> <body> <menu name="Quick Links"> <item - name="Struts" + name="Apache Struts Home" href="../index.html"/> </menu> </body> Modified: struts/site/trunk/xdocs/index.xml URL: http://svn.apache.org/viewcvs/struts/site/trunk/xdocs/index.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/site/trunk/xdocs/index.xml (original) +++ struts/site/trunk/xdocs/index.xml Sat Nov 12 05:14:24 2005 @@ -104,8 +104,8 @@ </section> -<section name="Welcome to Apache Struts!"> <a name="Welcome"/> +<section name="Welcome to Apache Struts!"> <p> The goal of the Apache Struts project is to encourage application architectures based on the "Model 2" approach, a variation of the @@ -127,14 +127,47 @@ <p> Originally, the Apache Struts software was distributed as one monolithic bundle. - Today, the Struts project is comprised of several subprojects. - Each subproject has its own website, documentation, and release cycle, - and may be downloaded separately. - The six original Apache Struts subprojects -- - Core, Taglibs, Tiles, Extras, Applications, and EL -- - are also being bundled into a distribution known as "Struts Classic". + Today, the Apache Struts project is comprised of two distinct frameworks + and several other subprojects. + The two frameworks are <strong>Struts Core</strong> and <strong>Struts Shale</strong>. + Struts Core is the original action/page framework. + Struts Shale is an event/component framework based on JavaServer Faces. + Both frameworks are first-class citizens of the Apache Struts project. + </p> + + <a name="frameworks"/> + <subsection name="Why two frameworks?"> + <p> + When <a href="http://java.sun.com/j2ee/javaserverfaces/">JavaServer Faces arrived</a>, + our development community chose to "make new friends but keep the old". + Some of us want (or need) to stick with the original action/page framework. + Others are ready to switch to an event/component framework based on JavaServer Faces. + We offer both frameworks because we have volunteers to create and maintain both frameworks. + </p> + + <p> + If you are starting a new project, you might want to consider Struts Shale. + Some people feel that JSF and Shale is the quickest way to write new Java web applications. + </p> + + <p> + If you have mature Struts Core applications in production, don't worry, + we are still here, same as ever. + After all, we have our share of mature application in production too. </p> + <p> + To make the Struts Core framework easier to maintain, + we've subdivided the original monolithic distribution into several subprojects. + Each subproject has its own website, documentation, and release cycle, + and may be downloaded separately. + The JARs and external dependencies for our extensions to Struts Core are being + bundled into a convenient distribution known as the "Struts Core Library". + </p> + </subsection> + + <a name="about"/> + <subsection name="About Apache Struts"> <p> Apache Struts is a volunteer project and all support for the framework is provided by unpaid volunteers. @@ -157,7 +190,7 @@ <a href="http://struts.apache.org/"> http://struts.apache.org/</a>. </li> </ul> - + </subsection> </section> <section> Modified: struts/site/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/site/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/site/trunk/xdocs/navigation.xml (original) +++ struts/site/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -66,16 +66,20 @@ <item name="Shale Framework" href="shale/index.html" /> </menu> - <menu name="Extensions"> - <item name="Applications" href="/struts-apps/index.html"/> + <menu name="Core Extensions"> <item name="BSF Scripting" href="/struts-bsf/index.html"/> <item name="EL" href="/struts-el/index.html"/> <item name="Extras" href="/struts-plugins/index.html"/> <item name="Flow" href="/struts-flow/index.html"/> <item name="JSF Integration" href="/struts-faces/index.html"/> <item name="JSP Taglib" href="/struts-taglib/index.html"/> - <item name="Sandbox" href="/struts-sandbox/index.html"/> <item name="Tiles" href="/struts-tiles/index.html"/> + <item name="Other Extensions" href="http://wiki.apache.org/struts/StrutsExtensions"/> + </menu> + + <menu name="Subprojects"> + <item name="Applications" href="/struts-apps/index.html"/> + <item name="Sandbox" href="/struts-sandbox/index.html"/> </menu> <menu name="Development"> Added: struts/taglib/trunk/xdocs/faq.xml URL: http://svn.apache.org/viewcvs/struts/taglib/trunk/xdocs/faq.xml?rev=332770&view=auto ============================================================================== --- struts/taglib/trunk/xdocs/faq.xml (added) +++ struts/taglib/trunk/xdocs/faq.xml Sat Nov 12 05:14:24 2005 @@ -0,0 +1,463 @@ +<?xml version="1.0"?> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document> +<properties> +<title>Taglib FAQ</title> +</properties> +<body> +<a name="faq"/> +<section name="Struts Taglib FAQ"> + +<a name="contents"/> +<subsection name="Index"> + +<ul> + + <li> + <a href="#jsf">What about JSTL and JavaServer Faces?</a> + </li> + + <li> + <a href="#xhtml">Are the Struts tags XHTML compliant?</a> + </li> + + <li> + <a href="#wml">Will the Struts tags support other markup languages such as WML</a> + </li> + + <li> + <a href="#multiple">Can I use multiple HTML form elements with the same + name?</a> + </li> + + <li> + <a href="#multipleSubmits">Can I have multiple submit buttons on the same + form?</a> + </li> + + <li><a href="#focus">Why doesn't the focus feature on the <html:form> + tag work in every circumstance?</a> + </li> + + <li><a href="#checkbox">Why are my checkboxes not being set from ON to + OFF?</a> + </li> + + <li> + <a href="#javascript.submit">How do I use JavaScript to submit a form? </a> + </li> + + <li> + <a href="#javascript">How do I use JavaScript to ... </a> + </li> + + <li> + <a href="#reset">Do I need to implement reset and set all my form + properties to their initial values?</a> + </li> + + <li> + <a href="#scriptlets">Can't I just create some of my JavaBeans in the JSP + using a scriptlet?</a> + </li> + + <li> + <a href="#link">Why does the <html:link> tag URL-encode javascript and + mailto links?"</a> + </li> + + <li> + <a href="#pager">How can I scroll through list of pages like the search + results in google?</a> + </li> + + <li> + <a href="#minimization">Why does the option tag render selected="selected" + instead of just "selected"? + </a></li> + + <li> + <a href="#tags">Why does Struts Taglib provide for so little + formatting?</a> + </li> + + <li> + <a href="#layout">Why doesn't Struts Taglib offer more layout options?</a> + </li> + +</ul> + +</subsection> + +<a name="jsf"/> +<subsection name="What about JSTL and JavaServer Faces?"> + <p> + Struts Core works well with the <a href="http://java.sun.com/products/jsp/jstl/"> + JavaServer Standard Tag Library</a>. + For a JSTL rendition of the original Struts JSP tags, + see the <a href="http://struts.apache.org/struts-el/index.html">Struts EL subproject</a>. + </p> + + <p> + If you'd like to start using + <a href="http://java.sun.com/j2ee/javaserverfaces/">JavaServer Faces</a> + components in your Struts Core application, + please see the <a href="http://struts.apache.org/struts-faces/index.html">Struts Faces</a> subproject. + If you'd like to get a fresh start in a pure JSF environment, + please see the <a href="http://struts.apache.org/shale/index.html">Struts Shale</a> framework. + </p> +</subsection> + +<a name="xhtml"/> +<subsection name="Are the Struts tags XHTML compliant?"> +<p>If you use an <html:html xhtml="true> or <html:xhtml/> element on your page, the tags +will render as XHTML (since Struts 1.1). </p> +</subsection> + +<a name="wml"/> +<subsection name="Will the Struts tags support other markup languages such as WML"> +<p> +Struts itself is markup neutral. The original Struts taglibs are only one example of how +presentation layer components can access the framework. The framework objects are exposed +through the standard application, session, and request contexts, where any Java component in +the application can make use of them. +</p> + +<p>Markup extensions that use Struts are available for +<a href="http://jakarta.apache.org/velocity">Velocity</a> and +<a href="http://www.openroad.ca/opencode/">XLST</a>, among others. +A new Struts tag library for +<a href="#jsf">Java Server Faces</a> is also in development. +</p> + +<p>For more about using WAP/WML with Struts see the article +<a href="http://www.sys-con.com/pbdj/archives2/0904/hamboeck/"> +WAP up your EAserver</a>. +</p> +</subsection> + +<a name="multiple"/> +<subsection name="Can I use multiple HTML form elements with the same name?"> +<p> +Yes. Define the element as an array and Struts will autopopulate it like any other. +</p> +<pre> +<code> +private String[] id= {}; +public String[] getId() { return this.id; } +public void setItem(String id[]) {this.id = id;} +</code> +</pre> +<p> +And so forth +</p> +</subsection> + +<a name="multipleSubmits"/> +<subsection name="Can I have multiple submit buttons on the same form?"> +<p> +<strong>Yes</strong>. The issue is that only one action class can be +associated with a single form. So the real issue is how do I decode +multiple submit types to a single <code>Action</code> class. +There is more than one way to achieve this functionality.</p> +<p> +The way that is suggested by struts is right out of the javadoc for +<a href="../api/org/apache/struts/actions/LookupDispatchAction.html"> +<code>LookupDispatchAction</code></a>. +Basically, <code>LookupDispatchAction</code> is using the keys from +<code>ApplicationProperties.resources</code> as keys to a map of actions +available to your <code>Action</code> class. It uses +<a href="http://java.sun.com/j2se/1.3/docs/guide/reflection/">reflection</a> to +decode the request and invoke the proper action. It also takes advantage of +the struts <a href="../userGuide/struts-html.html#submit"> +<code><html:submit></code></a> tags and is straight forward to implement.</p> +<p> +You can roll your own with JavaScript events and <code>javascript:void +(document.forms["myform"].submit)</code> on any html element. This gives you +control of how you want your page to look. Again you +will have to decode the expected action in the <code>execute</code> method of +your action form if you choose this route.</p> +</subsection> + +<a name="focus"/> +<subsection name="Why doesn't the focus feature on the <html:form> tag work in every circumstance?"> +<p> +Unfortunately, there is some disagreement between the various browsers, and different versions of the same browser, as to how the focus can be set. +The <html:form> tag provides a quick and easy JavaScript that will set the focus on a form +for most versions of most browsers. +If this feature doesn't work for you, then you should set the focus using your own JavaScript. +The focus feature is a convenient "value-add" -- not a core requirement of the tag. +If you do come up with a JavaScript that provides the final solution to this project, +please post your patch to this <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=13454">Bugzilla ticket</a>. +</p> +</subsection> + +<a name="checkbox"/> +<subsection name="Why are my checkboxes not being set from ON to OFF?"> +<p> +A problem with a checkbox is that the browser will only include it in the request +when it is checked. If it is not checked, the HTML specification suggests that it +not be sent (i.e. omitted from the request). If the value of the checkbox is being +persisted, either in a session bean or in the model, a checked box can never +unchecked by a HTML form -- because the form can never send a signal to uncheck +the box. The application must somehow ascertain that since the element was not +sent that the corresponding value is unchecked. +</p> +<p> +The recommended approach for Struts applications is to use the reset method in the +ActionForm to set all properties represented by checkboxes to null or false. The +checked boxes submitted by the form will then set those properties to true. The +omitted properties will remain false. Another solution is to use radio buttons +instead, which always submit a value. +</p> +<p> +It is important to note that the HTML specification recommends this same +behavior whenever a control is not "successful". Any blank element in a HTML +form is not guaranteed to submitted. It is therefor very important to set the +default values for an ActionForm correctly, and to implement the reset method +when the ActionForm might kept in session scope. +</p> +</subsection> + +<a name="javascript.submit"/> +<subsection name="Can I use JavaScript to submit a form?"> +<p> + You can submit a form with a link as below. + BTW, the examples below assume you are in an <html:form> block and 'myForm' + is picked up from the struts-config.xml name field of the action. +</p> +<source> + <a href='javascript:void(document.forms["myForm"].submit()>My Link</a> +</source> +<p> + Now the trick in the action is to decode what action you intend to perform. + Since you are using JavaScript, you could set a field value and look for it in + the request or in the form. +</p> +<p> + ... html/javascript part ... +</p> +<source> + <input type='hidden' value='myAction' /> + <input type='button' value='Save Meeeee' + onclick='document.forms["myForm"].myAction.value="save"; + document.forms["myForm"].submit();' /> + <input type='button' value='Delete Meeeee' + onclick='document.forms["myForm"].myAction.value="delete"; + document.forms["myForm"].submit();' /> +</source> +<p> + ... the java part ... +</p> +<source> + class MyAction extends ActionForm implements Serializable { + + public ActionForward execute (ActionMapping map, ActionForm form, + HttpServletRequest req, HttpServletResponse) { + + String myAction = req.getParameter("myAction"); + + if (myAction.equals("save") { + // ... save action ... + } else if (myAction.equals("delete") { + // ... delete action ... + } + } + } + } +</source> +<p> + This is just one of many ways to achieve submitting a form and decoding the + intended action. Once you get used to the framework you will find other ways + that make more sense for your coding style and requirements. Just remember + this example is completely non-functional without JavaScript. +</p> +<p> + Here is a link + which utilizes the LookupDispatch action to submit forms with multiple actions + without javascript: <a href="http://husted.com/struts/tips/003.html">http://husted.com/struts/tips/003.html</a> +</p> + +</subsection> + +<a name="javascript"/> +<subsection name="How do I use JavaScript to ..."> + + <p> + Struts is mainly a server-side technology. + We bundled in some JSP tags to expose the framework components to your + presentation page, but past that, the usual development process applies. + </p> + + <p> + Interactive pages require the use of JavaScript. + (That's why it was invented.) + If you want things popping up or doing this when they click that, + you are outside the scope of Struts and back into the web + development mainstream. + </p> + + <p> + You use JavaScript with Struts the same way you use with any presentation + page. + Since JavaScript is a client-side technology, you can use simple relative + references to your scripts. + If you need to fire a JavaScript from a HTML control, the Struts HTML tags + have properties for the JavaScript events. + </p> + + <p> + A very good JavaScript resource is Matt Kruse's site at + <a href="http://www.mattkruse.com/javascript/"> + http://www.mattkruse.com/javascript/</a> + </p> + +</subsection> + +<a name="reset"/> +<subsection name="Do I need to implement reset and set all my form properties to their initial values?"> +<p> +No. +You need to set checkbox properties to false if the ActionForm is being retained in session scope. +This is because an unchecked box does not submit an attribute. +Only checked boxes submit attributes. +If the form is in session scope, and the checkbox was checked, there is no way to turn it back off without the reset method. +Resetting the properties for other controls, or for a request scope form, is pointless. +If the form is in request scope, everything already just started at the initial value. +</p> +</subsection> + +<a name="scriptlets"/> +<subsection name="Can't I just create some of my JavaBeans in the JSP using a scriptlet?"> +<p> +Struts is designed to encourage a +<a href="http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html"> +Model 2/MVC architecture</a>. But there is nothing that prevents you from using Model 1 +techniques in your JavaServer Pages, so the answer to the question is "Yes, you can". +</p> +<p> +Though, using Model 1 techniques in a Struts application does go against the grain. +The approach recommended by most Struts developers is to create and populate whatever +objects the view may need in the Action, and then forward these through the request. +Some objects may also be created and stored in the session or context, +depending on how they are used. +</p> +<p> +Likewise, there is nothing to prevent you from using scriptlets along with JSP +tags in your pages. Though, many Struts developers report writing very complex +scriplet-free applications and recommend the JSP tag approach to others. +</p> +<p> +For help with Model 1 techniques and scriptlets, you might consider joining the +<a href="http://archives.java.sun.com/jsp-interest.html">Javasoft JSP-interest +mailing list</a>, where there are more people still using these approaches. +</p> +</subsection> + +<a name="link"/> +<subsection name="Why does the <html:link> tag URL-encode javascript and mailto links?"> +<p> +The <html:link> tag is not intended for use with client-side references like those used to launch Javascripts or email clients. +The purpose of link tag is to interject the context (or module) path into the URI so that your server-side links are not dependent on your context (or module) name. +It also encodes the link, as needed, to maintain the client's session on the server. +Neither feature applies to client-side links, so there is no reason to use the <html:link> tag. +Simply markup the client-side links using the standard <a/> tag. +</p> +</subsection> + +<a name="pager"/> +<subsection name="How can I scroll through list of pages like the search results in google?"> +<p>Many Struts developers use the Pager from the JSPTags site.</p> +<p><a href="http://jsptags.com/tags/navigation/pager/">http://jsptags.com/tags/navigation/pager/</a></p> +</subsection> + +<a name="minimization"/> +<subsection name="Why does the option tag render selected=selected instead of just selected?"> +<p> +Attribute minimization (that is, specifying an attribute with no value) is +a place where HTML violates standard XML syntax rules. This matters a lot +for people writing to browsers that support XHTML, where doing so makes +the page invalid.It's much better for Struts to use the expanded syntax, +which works the same on existing browsers interpreting HTML, and newer +browsers that expect XHTML-compliant syntax. Struts is following the +behavior recommended by the <a href="http://www.w3.org/TR/xhtml1/#h-4.5"> +XHTML specification</a></p> +</subsection> + +<a name="tags"/> +<subsection name="Why does Struts Taglib provide for so little formatting?"> +<p> +<em>The Struts tags seem to provide only the most rudimentary functionality. +Why is there not better support for date formatting and advanced string handling?</em> +</p> +<p> +Three reasons: +</p> +<p> +First, work started on the JSTL and we didn't want to duplicate the effort. +</p> +<p> +Second, work started on Java Server Faces, and we didn't want to duplicate that effort either. +</p> +<p> +Third, in a Model 2 application, most of the formatting can be handled in the ActionForms (or in the business tier), +so all the tag has to do is spit out a string. +This leads to better reuse since the same "how to format" code does not need to be repeated in every instance. +You can "say it once" in a JavaBean and be done with it. +</p> +</subsection> + +<a name="layout"/> +<subsection name="Why doesn't Struts Taglib offer more layout options?"> +<p> +For more flexible placement of error messages, +try the <a href="http://www.rabago.net/struts/html2/"><html2></a> Tag Library for Struts. +</p> +<p> +Since the Struts tags are open source, you can extend them to provide whatever additional formatting you may need. +If you are interested in a pre-written taglib that offers more layout options, see the +<a href="http://struts.application-servers.com">struts-layout taglib</a>. +</p> +<p> +In the same arena, there is a well regarded contributor taglib that can help you create +<a href="http://sourceforge.net/projects/struts-menu/">Menus for your Struts applications</a>. +</p> +<p> +Another very popular tag library is <a href="http://displaytag.sourceforge.net">DisplayTag</a>. +DisplayTag is an excellent choice when you have tabular data to present. +</p> +</subsection> + +<a name="undocumented"/> +<subsection + name="If you would like to contribute, here is a list of + popular but undocumented questions"> + + <ul> + + + <li>Why do my option lists disappear when validation fails?</li> + + <li>Why can't I disable URL-encoding in the Struts taglibs?</li> + + </ul> +</subsection> + + +</section></body></document> Modified: struts/taglib/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/taglib/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/taglib/trunk/xdocs/navigation.xml (original) +++ struts/taglib/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -9,6 +9,7 @@ <item name="Nested" href="dev_nested.html"/> </menu> <menu name="FAQs and HOWTOs"> + <item name="Taglib FAQ" href="faq.html"/> <item name="Building View Components" href="building_view.html"/> <item name="Indexed Properties" href="indexedprops.html"/> <item name="Secure Socket Layer and Web Applications " href="ssl.html"/> @@ -19,10 +20,34 @@ <item name="Logic" href="tagreference-struts-logic.html"/> <item name="Nested" href="tagreference-struts-nested.html"/> </menu> + <menu name="Quick Links"> - <item - name="Apache Struts Home" - href="../index.html"/> + <item name="Display Tag" + href="http://displaytag.sourceforge.net/"/> + + <item name="<html2>" + href="http://www.rabago.net/struts/html2/"/> + + <item name="JSTL" + href="http://java.sun.com/products/jsp/jstl/"/> + + <item name="JSF" + href="http://java.sun.com/j2ee/javaserverfaces/"/> + + <item name="Struts Faces" + href="../struts-faces/index.html"/> + + <item name="Struts Layout" + href="http://struts.application-servers.com"/> + + <item name="Struts Menu" + href="http://struts-menu.sourceforge.net/"/> + + <item name="Struts Shale" + href="../shale/index.html"/> + + <item name="Apache Struts Home" + href="../index.html"/> </menu> </body> </project> Modified: struts/tiles/trunk/xdocs/examples.xml URL: http://svn.apache.org/viewcvs/struts/tiles/trunk/xdocs/examples.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/tiles/trunk/xdocs/examples.xml (original) +++ struts/tiles/trunk/xdocs/examples.xml Sat Nov 12 05:14:24 2005 @@ -1,7 +1,24 @@ <?xml version="1.0"?> -<document url="./examples.xml"> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document> <properties> - <title>The Tiles Framework Project - Examples</title> + <title>Examples</title> </properties> <body> Modified: struts/tiles/trunk/xdocs/index.xml URL: http://svn.apache.org/viewcvs/struts/tiles/trunk/xdocs/index.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/tiles/trunk/xdocs/index.xml (original) +++ struts/tiles/trunk/xdocs/index.xml Sat Nov 12 05:14:24 2005 @@ -1,7 +1,24 @@ <?xml version="1.0"?> -<document url="./index.xml"> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document> <properties> - <title>The Tiles Framework Project</title> + <title>Welcome</title> </properties> <body> Modified: struts/tiles/trunk/xdocs/installation.xml URL: http://svn.apache.org/viewcvs/struts/tiles/trunk/xdocs/installation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/tiles/trunk/xdocs/installation.xml (original) +++ struts/tiles/trunk/xdocs/installation.xml Sat Nov 12 05:14:24 2005 @@ -1,7 +1,24 @@ <?xml version="1.0"?> -<document url="./installation.xml"> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document> <properties> - <title>The Tiles Framework Project - Installation (1.1)</title> + <title>Installation (1.1)</title> </properties> <body> Modified: struts/tiles/trunk/xdocs/navigation.xml URL: http://svn.apache.org/viewcvs/struts/tiles/trunk/xdocs/navigation.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/tiles/trunk/xdocs/navigation.xml (original) +++ struts/tiles/trunk/xdocs/navigation.xml Sat Nov 12 05:14:24 2005 @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<project name="Apache Struts Web Application Framework" +<project name="Struts Tiles" href="http://struts.apache.org/" image="images/struts.gif"> - <title>The Tiles Framework Project</title> + <title>Apache Struts - Struts Tiles</title> <body> - <menu name="Tiles"> + <menu name="Struts Tiles"> <item href="index.html" name="Tiles Home"/> <item href="installation.html" name="Installation"/> <item href="userGuide.html" name="User Guide"/> @@ -30,7 +30,7 @@ --> <menu name="Quick Links"> <item - name="Struts" + name="Apache Struts Home" href="../index.html"/> </menu> Modified: struts/tiles/trunk/xdocs/userGuide.xml URL: http://svn.apache.org/viewcvs/struts/tiles/trunk/xdocs/userGuide.xml?rev=332770&r1=332769&r2=332770&view=diff ============================================================================== --- struts/tiles/trunk/xdocs/userGuide.xml (original) +++ struts/tiles/trunk/xdocs/userGuide.xml Sat Nov 12 05:14:24 2005 @@ -1,7 +1,24 @@ <?xml version="1.0"?> -<document url="./usersGuide.xml"> +<!-- +Copyright 1999-2005 The Apache Software Foundation +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<!-- +// ======================================================================== 78 +--> +<document> <properties> - <title>The Tiles Framework Project - User Guide</title> + <title>User Guide</title> </properties> <body> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]