Re: Niall's if/then/else tags and switch/case/default?
It's my personal belief that Struts is best positioned as a lightweight framework that fills in the gaps between other technologies. If we continue to work on general-purpose tags here, I believe it sends the wrong message. Since we have already moved the bean-utils and digester to the commons, do we want to propose the Struts-Logic and Struts-Bean libraries to Jakata Taglibs? I do not personally feel a need for advanced logic constructs, but have no qualm with people who do. If we moved the Struts-logic tags to Jakarta Taglibs, and Niall wanted to work on them there, then everyone would be happy. We would just have to decide what to do about the three tags here that are Struts reliant: logic:forward, logic:redirect, and bean:struts. The simplest thing might be to just move them into Struts-HTML. We might also think about packaging the tags in a separate JAR, so that there would be a struts.jar and struts-tags.jar. We could then offer a struts-tags10.jar to people who didn't want to change over to the Jakarta Taglibs versions right way. This would also give us more flexibility later as the taglibs undergo more drastic changes when JSPTL shakes out. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
cvs commit: jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles ActionComponentServlet.java
cedric 01/09/10 05:50:45 Modified:contrib/tiles/src/share/org/apache/struts/tiles ActionComponentServlet.java Log: Allow to use an action path as insert or definition target page. Revision ChangesPath 1.2 +52 -30 jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ActionComponentServlet.java Index: ActionComponentServlet.java === RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ActionComponentServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ActionComponentServlet.java 2001/08/01 14:36:41 1.1 +++ ActionComponentServlet.java 2001/09/10 12:50:45 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ActionComponentServlet.java,v 1.1 2001/08/01 14:36:41 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:41 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ActionComponentServlet.java,v 1.2 2001/09/10 12:50:45 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 12:50:45 $ * $Author: cedric $ * */ @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.FileNotFoundException; import org.apache.struts.taglib.html.Constants; +import org.apache.struts.upload.MultipartRequestWrapper; /** * This servlet extends struts one. It adds channels and screens dispatching @@ -29,7 +30,7 @@ * now call 'processForward()'. Rest of the method is unchanged. * This new method could now be overiden in order to dispatch request before * forwarding. - * Compliant to ActionServlet from struts 2001/03/13 22:31:50 + * Compliant to ActionServlet from struts 2001/06/25 00:02:27 */ public class ActionComponentServlet extends ActionServlet { @@ -143,14 +144,14 @@ log( No errors detected, accepting input); return (true); } - + //does our form have a multipart request? if (formInstance.getMultipartRequestHandler() != null) { //rollback the request if (debug 1) { log( Rolling back the multipart request); } - + formInstance.getMultipartRequestHandler().rollback(); } @@ -169,6 +170,10 @@ if (debug = 1) log( Validation error(s), redirecting to: + uri); request.setAttribute(Action.ERROR_KEY, errors); +//unwrap the multipart request if there is one +if (request instanceof MultipartRequestWrapper) { +request = ((MultipartRequestWrapper) request).getRequest(); +} processForward( uri, request, response); return (false); @@ -183,34 +188,51 @@ protected void processForward(String uri, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - // Do we do a forward (original) or an include. -boolean hasParentComponent = false; + // Do we do a forward (original behavior) or an include ? +boolean doInclude = false; try { - // Check if request comes from a parent component - // This will be used to do an include rather than a forward -Object parentContext = request.getAttribute( ComponentConstants.COMPONENT_CONTEXT ); -hasParentComponent = (parentContext!=null ); + // Get current tile context if any. + // If context exist, we will do an include +ComponentContext tileContext = ComponentContext.getContext( request ); +doInclude = (tileContext!=null ); +ComponentDefinition definition; + + // Process tiles definition names only if a definition factory exist. +if( definitionsFactory != null ) + { // Get definition of tiles/component corresponding to uri. + definition = definitionsFactory.getDefinition(uri, request, getServletContext()); + if( definition != null ) +{ // We have a definition. + // We use it to complete missing attribute in context. +uri = definition.getPath(); +if( tileContext == null ) + { + tileContext = new ComponentContext( definition.getAttributes() ); + ComponentContext.setContext( tileContext, request); + } + else + tileContext.addMissing( definition.getAttributes() ); +} // end if + } // end if + // Check if there is a definition set in jsp context. +definition = DefinitionsUtil.getActionDefinition(request); +if( definition != null ) + { // We have
cvs commit: jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles DefinitionsUtil.java
cedric 01/09/10 05:51:31 Modified:contrib/tiles/src/share/org/apache/struts/tiles DefinitionsUtil.java Log: Add convenience methods to allow Tile context access from a Struts action. Revision ChangesPath 1.2 +86 -13 jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/DefinitionsUtil.java Index: DefinitionsUtil.java === RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/DefinitionsUtil.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DefinitionsUtil.java 2001/08/01 14:36:42 1.1 +++ DefinitionsUtil.java 2001/09/10 12:51:31 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/DefinitionsUtil.java,v 1.1 2001/08/01 14:36:42 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:42 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/DefinitionsUtil.java,v 1.2 2001/09/10 12:51:31 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 12:51:31 $ * $Author: cedric $ * */ @@ -14,6 +14,7 @@ import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; +import javax.servlet.ServletRequest; import java.util.Map; import java.util.HashMap; @@ -49,6 +50,9 @@ public static final String DEFINITIONS_FACTORY_CLASSNAME = definitions-factory-class; /** Constant name used to store factory in context */ public static final String DEFINITIONS_FACTORY = org.apache.struts.tiles.DEFINITIONS_FACTORY; +/** Constant name used to store definition in jsp context. + * Used to pass definition from a Struts action to servlet forward */ + public static final String ACTION_DEFINITION = org.apache.struts.tiles.ACTION_DEFINITION; /** @@ -226,21 +230,24 @@ } /** - * Get a component / template definition by its name. - * First, retrieve instance factory, and then get requested instance. - * Throw appropriate exception if definition is not found. + * Get a definition by its name. + * First, retrieve definition factory, and then get requested definition. + * Throw appropriate exception if definition or definition factory is not found. + * @param name Name of requested definition. + * @param request Current servelet request + * @param servletContext current servlet context * @throw FactoryNotFoundException Can't find definition factory. - * @throw ComponentDefinitionsFactoryException General error in factory while getting definition. + * @throw DefinitionsFactoryException General error in factory while getting definition. * @throws NoSuchDefinitionException No definition found for specified name */ - static public ComponentDefinition getDefinition(String definitionName, PageContext pageContext) + static public ComponentDefinition getDefinition(String definitionName, ServletRequest request, ServletContext servletContext) throws FactoryNotFoundException, DefinitionsFactoryException { try { -return getDefinitionsFactory( pageContext).getDefinition(definitionName, - (HttpServletRequest)pageContext.getRequest(), - pageContext.getServletContext()); +return getDefinitionsFactory(servletContext).getDefinition(definitionName, + (HttpServletRequest)request, +servletContext); } catch( NullPointerException ex ) { // Factory not found in context @@ -249,12 +256,78 @@ } /** + * Get a component / template definition by its name. + * First, retrieve instance factory, and then get requested instance. + * Throw appropriate exception if definition is not found. + * @param name Name of requested definition. + * @param request Current servelet request + * @param servletContext current servlet context + * @throw FactoryNotFoundException Can't find definition factory. + * @throw DefinitionsFactoryException General error in factory while getting definition. + * @throws NoSuchDefinitionException No definition found for specified name + */ + static public ComponentDefinition getDefinition(String definitionName, PageContext pageContext) +throws FactoryNotFoundException, DefinitionsFactoryException + { + return getDefinition( definitionName, +(HttpServletRequest)pageContext.getRequest(), +pageContext.getServletContext()); + } + + /** + * Get instances factory from appropriate
cvs commit: jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles ComponentContext.java
cedric 01/09/10 05:52:11 Modified:contrib/tiles/src/share/org/apache/struts/tiles ComponentContext.java Log: Add convenience methods to allow Tile context access from a Struts action. Revision ChangesPath 1.2 +61 -8 jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java Index: ComponentContext.java === RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ComponentContext.java 2001/08/01 14:36:42 1.1 +++ ComponentContext.java 2001/09/10 12:52:11 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java,v 1.1 2001/08/01 14:36:42 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:42 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentContext.java,v 1.2 2001/09/10 12:52:11 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 12:52:11 $ * $Author: cedric $ * */ @@ -12,6 +12,7 @@ import java.util.Map; import java.util.HashMap; import java.util.Iterator; +import java.util.Set; import javax.servlet.ServletRequest; import javax.servlet.jsp.PageContext; @@ -22,7 +23,7 @@ */ public class ComponentContext { - + /** * Component attributes. */ @@ -68,10 +69,55 @@ } /** + * Add all attributes to this context. + * Copies all of the mappings from the specified attribute map to this context. + * New attribute mappings will replace any mappings that this context had for any of the keys + * currently in the specified attribute map. + * @param attributes to add. + */ + public void addAll(Map newAttributes) + { + if( attributes == null ) +{ +attributes = new HashMap(newAttributes); +return; +} + attributes.putAll( newAttributes ); + } + + /** + * Add all missing attributes to this context. + * Copies all of the mappings from the specified attributes map to this context. + * New attribute mappings will be added only if they don't already exist in + * this context. + * @param attributes to add. + */ + public void addMissing(Map defaultAttributes) + { + if( defaultAttributes == null ) +return; + if( attributes == null ) +{ +attributes = new HashMap(defaultAttributes); +return; +} + + Set entries = defaultAttributes.entrySet(); + Iterator iterator = entries.iterator(); + while( iterator.hasNext() ) +{ +Map.Entry entry = (Map.Entry)iterator.next(); +if( !attributes.containsKey( entry.getKey()) ) + { + attributes.put(entry.getKey(), entry.getValue()); + } // end if +} // end loop + } + + /** * Get an attribute from context * @param name * @return {Object} - * @roseuid 39AEBEC90228 */ public Object getAttribute(String name) { @@ -79,12 +125,11 @@ return null; return attributes.get( name ); } - + /** * Get names of all attributes * @param name * @return {Object} - * @roseuid 39AEBEC90228 */ public Iterator getAttributeNames() { @@ -92,7 +137,7 @@ return EMPTY_ITERATOR; return attributes.keySet().iterator(); } - + /** * Put a new attribute to context. * @param name @@ -168,6 +213,14 @@ static public ComponentContext getContext( ServletRequest request ) { return (ComponentContext)request.getAttribute(ComponentConstants.COMPONENT_CONTEXT); +} + +/** + * Store component context into request. + */ + static public void setContext( ComponentContext context, ServletRequest request ) +{ +request.setAttribute(ComponentConstants.COMPONENT_CONTEXT, context); } }
cvs commit: jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition XmlAttribute.java
cedric 01/09/10 05:57:26 Modified:contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition XmlAttribute.java Log: Create UntyppedAttribute if an attribute has no type but a role set. Revision ChangesPath 1.2 +15 -4 jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java Index: XmlAttribute.java === RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XmlAttribute.java 2001/08/01 14:36:42 1.1 +++ XmlAttribute.java 2001/09/10 12:57:26 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v 1.1 2001/08/01 14:36:42 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:42 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v 1.2 2001/09/10 12:57:26 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 12:57:26 $ * $Author: cedric $ * */ @@ -14,6 +14,7 @@ import org.apache.struts.tiles.PathAttribute; import org.apache.struts.tiles.DefinitionAttribute; import org.apache.struts.tiles.DefinitionNameAttribute; +import org.apache.struts.tiles.UntyppedAttribute; /** * A property key-value pair. @@ -200,7 +201,7 @@ else valueType = path; } // end if -if( value != null valueType!=null !(value instanceof AttributeDefinition) ) +if( value != null valueType!=null /* !(value instanceof AttributeDefinition) */ ) { String strValue = value.toString(); if( valueType.equalsIgnoreCase( string ) ) @@ -219,7 +220,17 @@ { realValue = new DefinitionNameAttribute( strValue ); } // end if +// Set realValue's role value if needed + if( role !=null ) +((UntyppedAttribute)realValue).setRole( role ); } // end if + + // Create attribute wrapper to hold role if role is set and no type specified +if( role!=null value != null valueType==null ) + { + realValue = new UntyppedAttribute( value.toString(), role ); + } // end if + return realValue; } }
cvs commit: jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles ComponentDefinitionsFactory.java
cedric 01/09/10 06:01:30 Modified:contrib/tiles/src/share/org/apache/struts/tiles ComponentDefinitionsFactory.java Log: Update documentation Revision ChangesPath 1.2 +15 -17 jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentDefinitionsFactory.java Index: ComponentDefinitionsFactory.java === RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentDefinitionsFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ComponentDefinitionsFactory.java 2001/08/01 14:36:42 1.1 +++ ComponentDefinitionsFactory.java 2001/09/10 13:01:30 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentDefinitionsFactory.java,v 1.1 2001/08/01 14:36:42 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:42 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/ComponentDefinitionsFactory.java,v 1.2 2001/09/10 13:01:30 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 13:01:30 $ * $Author: cedric $ * */ @@ -16,36 +16,34 @@ import javax.servlet.ServletContext; /** -* Component repository interface. - * This interface allows to retrieve an definition by its name, independently of the + * Component repository interface. + * This interface allows to retrieve an definition by its name, independently of the * factory implementation. * Implementation must be Serializable, in order to be compliant with web Container * having this constraint (Weblogic 6.x). */ -public interface ComponentDefinitionsFactory extends Serializable +public interface ComponentDefinitionsFactory extends Serializable { - + /** * Get a definition by its name. - * @throws DefinitionsFactoryException An error occur while getting -definition. + * @param name Name of requested definition. + * @param request Current servelet request + * @param servletContext current servlet context + * @throws DefinitionsFactoryException An error occur while getting definition. * @throws NoSuchDefinitionException No definition found for specified name - * Implementation can throw more accurate exception as a subclass of this -exception - @roseuid 3AF6F7E203DB + * Implementation can throw more accurate exception as a subclass of this exception */ public ComponentDefinition getDefinition(String name, ServletRequest request, ServletContext servletContext) throws NoSuchDefinitionException,DefinitionsFactoryException; - + /** * Init factory. * This method is called exactly once immediately after factory creation in * case of internal creation (by DefinitionUtil). * @param servletContext Servlet Context passed to newly created factory. - * @param properties Map of name/property passed to newly created factory. -Map can contains - * more properties than requested. + * @param properties Map of name/property passed to newly created factory. + * Map can contains more properties than requested. * @throws DefinitionsFactoryException An error occur during initialization. - @roseuid 3AF6F7E30080 */ public void initFactory(ServletContext servletContext, Map properties) throws DefinitionsFactoryException; }
cvs commit: jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles ComponentConstants.java
cedric 01/09/10 06:02:06 Modified:contrib/tiles/src/share/org/apache/struts/taglib/tiles ComponentConstants.java Log: Remove unused constants Revision ChangesPath 1.2 +8 -15 jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ComponentConstants.java Index: ComponentConstants.java === RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ComponentConstants.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ComponentConstants.java 2001/08/01 14:36:40 1.1 +++ ComponentConstants.java 2001/09/10 13:02:06 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ComponentConstants.java,v 1.1 2001/08/01 14:36:40 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:40 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/taglib/tiles/ComponentConstants.java,v 1.2 2001/09/10 13:02:06 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 13:02:06 $ * $Author: cedric $ * */ @@ -12,24 +12,17 @@ import javax.servlet.jsp.PageContext; import org.apache.struts.action.Action; + /** + * Constant used by Tiles/Components. + */ public interface ComponentConstants { - - public static final String COMPONENT_CONTEXT = CompContext; - public static final String COMPONENT_INSTANCES = ComponentInstances; - public static final String INSTANCES_MAPPING_FACTORY = instances.mapping.factory; - public static final intCOMPONENT_INSTANCES_SCOPE = PageContext.REQUEST_SCOPE; +/** Name used to store Tile/Component context */ + public static final String COMPONENT_CONTEXT = CompContext; public static final intCOMPONENT_SCOPE = 8; public static final String LOCALE_KEY = Action.LOCALE_KEY; public static final String EXCEPTION_KEY = Action.EXCEPTION_KEY; - public static final String SELECT_MATCHES_KEY = com.s1.excalibur.core.ui.taglib.SELECT_MATCHES_KEY; - public static final String TEMPLATE_KEY = com.s1.excalibur.core.ui.taglib.TEMPLATE_KEY; - public static final String TEMPLATE_SCREEN_KEY = com.s1.excalibur.core.ui.taglib.TEMPLATE_SCREEN_KEY; - public static final String DEFAULT_TEMPLATE_PAGE = /template.jsp; - public static final String TEMPLATE_SCREEN_SUFFIX = .screen; - public static final String TEMPLATE_PAGE_PARAMETER = TemplatePage; - }
cvs commit: jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/test - New directory
cedric 01/09/10 06:04:10 jakarta-struts/contrib/tiles/src/tutorial/org/apache/struts/example/tiles/test - New directory
cvs commit: jakarta-struts/contrib/tiles/doc/html tutorialBody.html
cedric 01/09/10 06:07:11 Modified:contrib/tiles/doc/html tutorialBody.html Log: Modify chapter about Including Twice The Same Tile Revision ChangesPath 1.2 +132 -129 jakarta-struts/contrib/tiles/doc/html/tutorialBody.html Index: tutorialBody.html === RCS file: /home/cvs/jakarta-struts/contrib/tiles/doc/html/tutorialBody.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- tutorialBody.html 2001/08/01 14:36:39 1.1 +++ tutorialBody.html 2001/09/10 13:07:11 1.2 @@ -3,7 +3,7 @@ head meta http-equiv=Content-Type content=text/html; charset=windows-1252 meta name=Generator content=Microsoft Word 10 (filtered) -titleTiles Framework/title +titleJSP Framework/title style !-- @@ -284,7 +284,7 @@ lang=EN-US14 Nov. 2000/span/p p class=MsoFooter align=center style='text-align:center'span lang=EN-USRev -: /spanspan lang=EN-US1 Aug. 2001/span/p +: /spanspan lang=EN-US9 Sep. 2001/span/p p class=MsoFooter align=center style='text-align:center'span lang=EN-USnbsp;/span/p @@ -3072,33 +3072,35 @@ h2a name=_Toc521292391/aa name=_Toc513222198span lang=EN-US7.3span style='font:7.0pt Times New Roman'nbsp;nbsp;nbsp;nbsp;nbsp; /span/spanspan -dir=LTRspan lang=EN-USBody Including Twice the Same Component/span/span/a/h2 +dir=LTRspan lang=EN-USBody Including Twice (or more) the Same /span/span/aspan +lang=EN-USTile/span/h2 -p class=MsoBodyTextspan lang=EN-USCovered topics : use of sub-component in -a component./span/p +p class=MsoBodyTextspan lang=EN-USCovered topics : use of sub-Tiles in a Tile./span/p p class=MsoNormalspan lang=EN-USnbsp;/span/p p class=MsoNormalspan lang=EN-USIn this chapter you will learn how to write -components that can be reused more than one time in a page. As example, we -develop an address component, included two times in an invoice. /span/p +Tiles that can be reused more than one time in a page. As example, we develop +an address Tile, included two times in an invoice. /span/p p class=MsoNormalspan lang=EN-USProblems come when you have input fields in -the iaddress/i component : how to have two different names while using one -component description ? As a solution, you will provide names prefixed with a -components name. This later is passed as a parameter of the component./span/p +the iaddress/i tile : how to have two different names for input while using +the same tile description ? As a solution, you will prefix input field names by +a prefix pass as parameter to the Tile./span/p p class=MsoNormalspan lang=EN-USSecond difficulty is how to retrieve data -to be shown in the iaddress/i component ? Here, you will pass a Java object -of class Address, and deal with it in the iaddress/i component./span/p +to be shown in the iaddress/i iTile/i ? Here, you will pass Java bean (Java +object), and deal with it in the iaddress/i component. Data to be edited +must be accessible from the bean using the prefix and the property name//span/p p class=MsoNormalspan lang=EN-USAll Java classes are already written and -compiled for you. You can check sources from the Component Library -distribution, under directory /spanspan class=codespan lang=EN-US -style='font-size:10.0pt'src/s1/example/invoice/span/spanspan lang=EN-US./span/p +compiled for you. You can check sources from the Tile Library distribution, +under directory /spanspan class=codespan lang=EN-US style='font-size:10.0pt'src/org/apache/struts/example/invoice/span/spanspan +lang=EN-US./span/p h3a name=_Toc513222199span lang=EN-US7.3.1span style='font:7.0pt Times New Roman'nbsp;nbsp;nbsp;nbsp; -/span/spanspan dir=LTRspan lang=EN-USAddress Component/span/span/a/h3 +/span/spanspan dir=LTRspan lang=EN-USAddress /span/span/aspan +lang=EN-USTile/span/h3 p class=MsoNormalspan lang=EN-USCreate a new file and save it under /spanspan class=codespan lang=EN-US style='font-size:10.0pt'invoice/editAddress.jsp/span/spanspan @@ -3108,18 +3110,15 @@ columns : one containing fields names, one containing html input fields. Use Struts tags text for the input fields./span/p -p class=MsoNormalspan lang=EN-USFollowing is the code for this component :/span/p +p class=MsoNormalspan lang=EN-USFollowing is the code for this tile :/span/p div style='border:solid windowtext 1.0pt;padding:1.0pt 1.0pt 1.0pt 1.0pt' p class=CodewithBorder style='border:none;padding:0cm'span lang=EN-USlt;%@ taglib uri=quot;/WEB-INF/tiles.tldquot; prefix=quot;tilesquot; %gt;/span/p -p class=CodewithBorder style='border:none;padding:0cm'span lang=EN-USlt;%@ -taglib uri=quot;/WEB-INF/extensions.tldquot; prefix=quot;extquot; %gt;/span/p - p class=CodewithBorder style='border:none;padding:0cm'span lang=EN-USlt;%@
cvs commit: jakarta-struts/contrib/tiles/doc tiles.xml
cedric 01/09/10 06:07:40 Modified:contrib/tiles/doc tiles.xml Log: Update documentation and descriptions Revision ChangesPath 1.2 +56 -54jakarta-struts/contrib/tiles/doc/tiles.xml Index: tiles.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/doc/tiles.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- tiles.xml 2001/08/01 14:36:36 1.1 +++ tiles.xml 2001/09/10 13:07:40 1.2 @@ -1,9 +1,9 @@ ?xml version=1.0? -document url=./components.xml +document url=./tiles.xml properties authorCedric Dumoulin/author - titleComponents Tag Library/title + titleTiles Tag Library/title /properties body @@ -15,16 +15,18 @@ tlibversion1.0/tlibversion jspversion1.1/jspversion - shortnameComponents Tag Library/shortname - display-nameComponents Tag Library/display-name - !--urihttp://jakarta.apache.org/struts/tags-bean-1.0/uri-- + shortnameTiles Tag Library/shortname + display-nameTiles Tag Library/display-name + !--urihttp://jakarta.apache.org/struts/tiles-1.0/uri-- info -This tag library provides templates / components tags. - br/brComponents and templates are the same - and are used indiferently (for historical reasons). Also, a lot of tags and attribute names are +This tag library provides tiles tags. + br/br + br/br + Tiles were previously called Components. For historical reasons, names pages, components and templates + are used indiferently to design a tile. Also, a lot of tags and attribute names are left for backward compatibility. br/brTo know more about tags defined in this library, check the associated documentation : - comps-doc. + tiles-doc. /info !-- = Include Tags == -- @@ -32,12 +34,12 @@ tag nameinsert/name summary -Insert a component/template. +Insert a tiles/component/template. /summary info - Insert a component/template with the possibility to pass parameters + Insert a tiles/component/template with the possibility to pass parameters (called attribute). - A component can be seen as a procedure that can take parameters or attributes. + A tile can be seen as a procedure that can take parameters or attributes. codelt;template:insertgt;/code allows to define these attributes and pass them to the inserted jsp page, called template. Attributes are defined using nested tag codelt;template:putgt;/code or @@ -45,30 +47,30 @@ br/br You must specify one of this tag attribute : ul - licodetemplate/code, for inserting a component/template page,/li - licodecomponent/code, for inserting a component/template page, (same as template)/li + licodetemplate/code, for inserting a tiles/component/template page,/li + licodecomponent/code, for inserting a tiles/component/template page, (same as template)/li licodepage/code for inserting a JSP page, (same as template)/li licodedefinition/code, for inserting a definition from definitons factory/li - licodeattribute/code, surrounding component's attribute name whose value is used. + licodeattribute/code, surrounding tiles's attribute name whose value is used. brIf attribute is associated to 'direct' flag (see put), and flag is true, write attribute value (no insertion). /br/li licodename/code, to let 'insert' determine the type of entities to insert. In this later - case, search is done in this order : definitions, components/templates, pages. + case, search is done in this order : definitions, tiles/components/templates, pages. /li /ul br/br - In fact, Page, component and template, are equivalent as a component or template are jsp page. + In fact, Page, component and template, are equivalent as a tile, component or template are jsp page. br/br STRONGExample : /STRONG precode - lt;comp:insert page=/basic/myLayout.jsp flush=truegt; -lt;comp:put name=title value=My first page /gt; -lt;comp:put name=header value=/common/header.jsp /gt; -lt;comp:put name=footer value=/common/footer.jsp /gt; -lt;comp:put name=menu value=/basic/menu.jsp /gt; -lt;comp:put name=body value=/basic/helloBody.jsp /gt; - lt;/comp:insertgt;/code/pre + lt;template:insert page=/basic/myLayout.jsp flush=truegt; +lt;template:put name=title value=My first page /gt; +lt;template:put name=header value=/common/header.jsp /gt; +
cvs commit: jakarta-struts/contrib/tiles/web/doc/WEB-INF tutorialDefinitions_fr.xml tutorialDefinitions.xml
cedric 01/09/10 06:11:17 Modified:contrib/tiles/web/doc/WEB-INF tutorialDefinitions_fr.xml tutorialDefinitions.xml Log: Add encoding tag Revision ChangesPath 1.2 +1 -1 jakarta-struts/contrib/tiles/web/doc/WEB-INF/tutorialDefinitions_fr.xml Index: tutorialDefinitions_fr.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/tutorialDefinitions_fr.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- tutorialDefinitions_fr.xml2001/08/01 14:36:48 1.1 +++ tutorialDefinitions_fr.xml2001/09/10 13:11:16 1.2 @@ -1,4 +1,4 @@ - +?xml version=1.0 encoding=ISO-8859-1 ? !-- html definition Mappings -- component-definitions 1.2 +1 -1 jakarta-struts/contrib/tiles/web/doc/WEB-INF/tutorialDefinitions.xml Index: tutorialDefinitions.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/tutorialDefinitions.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- tutorialDefinitions.xml 2001/08/01 14:36:48 1.1 +++ tutorialDefinitions.xml 2001/09/10 13:11:16 1.2 @@ -154,7 +154,7 @@ definition name=menu.lang path=/common/submenu.jsp put name=title value=Language / putList name=items -add value=Francais / +add value=Français / add value=English / add value=Deutch / /putList
cvs commit: jakarta-struts/contrib/tiles/web/doc/tutorial/invoice index.jsp editInvoice2.jsp editInvoice.jsp editAddress2.jsp editAddress.jsp
cedric 01/09/10 06:13:05 Modified:contrib/tiles/web/doc/WEB-INF tilesDefinitions.xml struts-config.xml contrib/tiles/web/doc/test index.jsp contrib/tiles/web/doc/doc/portal revisions.jsp download.jsp contrib/tiles/web/doc/doc installation.html contrib/tiles/web/doc/tutorial/invoice index.jsp editInvoice2.jsp editInvoice.jsp editAddress2.jsp editAddress.jsp Added: contrib/tiles/web/doc/test testStrutsAction.jsp failpage.jsp Log: Update examples. Add Tiles - Struts Action integration test Change invoice example : do not use 'extended.tld' anymore. Revision ChangesPath 1.2 +12 -0 jakarta-struts/contrib/tiles/web/doc/WEB-INF/tilesDefinitions.xml Index: tilesDefinitions.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/tilesDefinitions.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- tilesDefinitions.xml 2001/08/01 14:36:47 1.1 +++ tilesDefinitions.xml 2001/09/10 13:13:04 1.2 @@ -138,5 +138,17 @@ put name=body value=body.jsp direct=false / /definition + !-- Test Struts Action and Tiles integration -- +definition name=test.struts.action path=/test/layout.jsp + put name=title value=Test Struts Action and Tiles integration : default title direct=true / + put name=header value=header.jsp/ + put name=body value=body.jsp direct=false / +/definition + + !-- Test Struts Action and Tiles integration -- +definition name=test.struts.action.fail path=/test/failpage.jsp + put name=title value=Test fail direct=true / +/definition + /component-definitions 1.2 +14 -0 jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml Index: struts-config.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- struts-config.xml 2001/08/01 14:36:47 1.1 +++ struts-config.xml 2001/09/10 13:13:04 1.2 @@ -64,6 +64,20 @@ forward name=successpath=/tutorial/invoice/index.jsp/ /action +!-- Test Struts action and Tiles integration -- + action path=/test/testAction + type=org.apache.struts.example.tiles.test.TestActionTileAction + forward name=successpath=test.struts.action/ + forward name=failurepath=test.struts.action.fail/ + /action + +!-- Test Struts action and Tiles integration -- + action path=/test/testActionForwardJsp + type=org.apache.struts.example.tiles.test.TestActionTileAction + forward name=successpath=/test/layout.jsp/ + forward name=failurepath=test.struts.action.fail/ + /action + !-- test, to be removed -- action path=/tutorial/testAction type=org.apache.struts.example.tiles.lang.SelectLocaleAction 1.2 +1 -0 jakarta-struts/contrib/tiles/web/doc/test/index.jsp Index: index.jsp === RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/test/index.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- index.jsp 2001/08/01 14:36:46 1.1 +++ index.jsp 2001/09/10 13:13:04 1.2 @@ -13,6 +13,7 @@ LIA href=testList.jsptest lists/A LIA href=testDefinitions.jsptest definitions/A LIA href=testRole.jsptest role (With Tomcat, use 'tomcat' as userid and password)/A + LIA href=testStrutsAction.jsptest struts action integration and behavior/A LIA href=testAll.jspAll in one/A (main code + test results) /LI/UL 1.1 jakarta-struts/contrib/tiles/web/doc/test/testStrutsAction.jsp Index: testStrutsAction.jsp === %@ taglib uri=/WEB-INF/tiles.tld prefix=tiles % %-- Test tiles and struts action integration (require factory) --% hr strongTest definition set in action, and action forward to another definition/strong br tiles:insert page=/test/testAction.do tiles:put name=title value=Test definition set in action, and action forward to another definition. Title is overloaded from insert / %-- header and body values come from definition used in action's forward --% %-- name of definition to use in action --% tiles:put name=set-definition value=test.layout.test1 / /tiles:insert hr strongTest overload parameter in action/strong br tiles:insert page=/test/testAction.do tiles:put name=title
cvs commit: jakarta-struts/contrib/tiles/doc/html installation.html
cedric 01/09/10 06:16:30 Added: contrib/tiles/doc/html installation.html Log: no message Revision ChangesPath 1.1 jakarta-struts/contrib/tiles/doc/html/installation.html Index: installation.html === TABLE TR TDA name=Prerequisites/A TABLE border=0 cellspacing=5 cellpadding=5 width=100% TR TD bgcolor=#023264FONT color=#ff face=arial,helvetica,sanserif size=+1STRONGPrerequisite Software/STRONG/FONT /TD /TR TR TD BLOCKQUOTE PCopyright : This page is largely inspired from the originalA href=http://www.apache.com/struts/installation.html;Struts installation page/A. For those familiar with Struts, there is nothing realy new./P PIn order to install and use a binary distribution, you will need to acquire and install several other software packages, as follows:BR/P UL LISTRONGJava Development Kit/STRONG- You must download and install a version 1.1 (or later) Java Development Kit implementation for your operating system platform. YouEMmust/EMhave a Java2 version (JDK 1.2 or later) to build the Struts source distribution, and several of the custom tags in the Struts library require Java2 to execute. A good starting point for locating Java Development Kit distributions isA href=http://java.sun.com/j2se;http://java.sun.com/j2se/A. LISTRONGStruts/STRONG- You must download and install A href=http://jakarta.apache.org/struts;Struts/A , with release greater than 0.5. A compatible release of Struts is attached with examples. LISTRONGServlet Container/STRONG- You must download and install a servlet container that is compatible with the Servlet API Specification, version 2.2 or later, and the JavaServer Pages (JSP) Specification, version 1.1 or later. One popular choice is to download Apache'sA href=http://jakarta.apache.org/tomcat;Tomcat/A(version 3.1 or later required, version 3.2 or later recommended). LISTRONGServlet API Classes/STRONG- In order to compile Struts itself, or applications that use Struts, you will need a CODEservlet.jar/CODEfile containing the Servlet and JSP API classes. Most servlet containers include this JAR file. Otherwise, you can get the Servlet API classes distribution fromA href=http://jakarta.apache.org/builds/jakarta-servletapi;here/A. LISTRONGXML Parser/STRONG- Struts requires the presence of an XML parser that is compatible with the Java API for XML Parsing (JAXP) specification. You can download and install the JAXPA href=http://java.sun.com/xml;reference implementation/A, which is required for building the Struts source distribution. In Struts-based web applications, you may replace the reference implementation classes with any other JAXP compliant parser, such asA href=http://xml.apache.org/xerces-j;Xerces/A. See detailed instructions related to the parser in the instructions forA href=#Buildingbuilding/AandA href=#Installinginstalling/AStruts, below./LI /UL/BLOCKQUOTE /TD /TR /TABLEA name=Building/A TABLE border=0 cellspacing=5 cellpadding=5 width=100% TR TD bgcolor=#023264FONT color=#ff face=arial,helvetica,sanserif size=+1STRONGBuilding Components Library From Source/STRONG/FONT /TD /TR TR TD BLOCKQUOTE PFor now, There is no tools facility to build the Components Library./P/BLOCKQUOTE /TD /TR /TABLEA name=Installing/A TABLE border=0 cellspacing=5 cellpadding=5 width=100% TR TD bgcolor=#023264FONT
cvs commit: jakarta-struts/contrib/tiles build.xml build.properties.sample build-webapps.xml
cedric 01/09/10 06:16:55 Modified:contrib/tiles build.xml build.properties.sample build-webapps.xml Log: Improve build process Revision ChangesPath 1.2 +2 -10 jakarta-struts/contrib/tiles/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- build.xml 2001/08/01 14:36:36 1.1 +++ build.xml 2001/09/10 13:16:55 1.2 @@ -20,10 +20,6 @@ build.properties file in the base directory, or a build.properties file in your user home directory. -catalina.home (optional). The path to the Tomcat 4.0 - installation. This is required only when - executing the deploy.catalina target. - servlet.jar (required). The path to the Servlet API classes to compile against (currently, either version 2.2 or 2.3 supported). @@ -40,10 +36,6 @@ of the Jakarta Commons Digester package (version 1.0 or later). -tomcat.home (optional). The path to the Tomcat 3.x - installation. This is required only when - executing the deploy.tomcat target. - struts.libs (required). The path to the Struts library installation. . @@ -62,7 +54,6 @@ property name=jdbc20ext.jar value=../jdbc2_0-stdext.jar/ property name=servlet.jar value=../jakarta-servletapi/lib/servlet.jar/ property name=struts.libs value=${struts.home}/lib/ -property name=tomcat.home value=../build/tomcat/ property name=xerces.jar value=../xml-xerces/xerces.jar/ @@ -154,9 +145,10 @@ echo message=java.class.path = ${java.class.path}/ echo message=java.home = ${java.home}/ echo message=user.home = ${user.home}/ -echo message=tomcat.home = ${tomcat.home}/ +echo message=struts.home = ${struts.home}/ echo message=struts.libs = ${struts.libs}/ echo message=dist.home = ${dist.home}/ +echo message=build.home = ${build.home}/ echo message=basedir = ${basedir}/ /target 1.2 +1 -1 jakarta-struts/contrib/tiles/build.properties.sample Index: build.properties.sample === RCS file: /home/cvs/jakarta-struts/contrib/tiles/build.properties.sample,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- build.properties.sample 2001/08/01 14:36:36 1.1 +++ build.properties.sample 2001/09/10 13:16:55 1.2 @@ -6,7 +6,7 @@ # to build.properties in the same directory that contains the Struts # build.xml file. # -# $Id: build.properties.sample,v 1.1 2001/08/01 14:36:36 cedric Exp $ +# $Id: build.properties.sample,v 1.2 2001/09/10 13:16:55 cedric Exp $ # - # WARNING: The relative paths below assume that the build.xml file is in the 1.2 +6 -6 jakarta-struts/contrib/tiles/build-webapps.xml Index: build-webapps.xml === RCS file: /home/cvs/jakarta-struts/contrib/tiles/build-webapps.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- build-webapps.xml 2001/08/01 14:36:36 1.1 +++ build-webapps.xml 2001/09/10 13:16:55 1.2 @@ -17,7 +17,7 @@ build.xml script. build.homeBase directory into which we are building - the Struts tiles. + the Struts Tiles. compile.classpath If specified, contains a set of JAR files and/or directories to be added to the @@ -29,6 +29,9 @@ struts.libs The directory containing struts.jar and the associated TLD files. +tiles.libsThe directory containing tiles.jar and + the associated TLD files. + webapp.libs If specified, must be the pathname of a directory from which all available *.jar files are copied to the web @@ -37,7
cvs commit: jakarta-struts build-webapps.xml
cedric 01/09/10 06:18:02 Modified:.build-webapps.xml Log: Enable contrib/tile build. Revision ChangesPath 1.6 +1 -5 jakarta-struts/build-webapps.xml Index: build-webapps.xml === RCS file: /home/cvs/jakarta-struts/build-webapps.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- build-webapps.xml 2001/08/07 23:25:45 1.5 +++ build-webapps.xml 2001/09/10 13:18:01 1.6 @@ -187,15 +187,13 @@ /copy !-- Compile Tiles contrib -- -!-- ant antFile=build.xml dir=contrib/tiles target=compile.for.struts property name=struts.libs value=../../${struts.libs}/ property name=build.home value=../../${build.home}/tiles/ property name=dist.homevalue=../../${dist.home}/ property name=app.name value=tiles/ property name=project.name value=Tiles/ -/ant --- +/ant /target @@ -244,7 +242,6 @@ description=Create distribution output of web applications !-- Compile Tiles dist -- -!-- ant antFile=build.xml dir=contrib/tiles target=dist.for.struts property name=struts.libs value=../../${struts.libs}/ property name=build.home value=../../${build.home}/tiles/ @@ -252,7 +249,6 @@ property name=app.name value=tiles/ property name=project.name value=Tiles/ /ant --- /target
Re: Installing IIS Plug-in for WebLogic
This would be ***way*** off topic if posted to the Struts-User list, and make no sense at all in the context of DEV (and CVS). This is really a matter for WebLogic support. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Alex Lin wrote: Does anyone have an example of iisproxy.ini file using Internet Information Server as external listener for Weblogic. Thanks, Alex Lin
RE: session.setAttribute() don't work sometimes
Gang, The second time if the value of the Id is null then it will over write the value you set the first time as the session keeps only one value of the attribute, in your case ID. Also there is no need to get and re set the attributes on the sessions as they are valid for the duration of the session. Ram
Bug in Latest ErrorsTag
Perhaps I did something wrong in my use of the html:errors tag with a specific property, but I believe I've discovered a bug. The problem arises when I place code like this in a jsp: html:errors property=searchCriteria/ I have an ActionError in scope with a name of 'searchCriteria' when this code is executed. The error message that I specified shows up just fine, but it is flanked by two nulls. I determined the problem to be the non-existence of the errors.header and errors.footer properties. If I defined these two properties, then instead of seeing this: null X null I would see foo X bar However, I don't want the header/footer in this instance. What is happening is that the header and footer are being attached to the legitimate error message, even when they are null. Here's the code from ErrorsTag.java: if ((message != null)(property == null) || propertyMsgPresent) { results.append(message); results.append(\r\n); } The problem is that if propertyMsgPresent is true, the message var will be appended even if it is null. (There is a duplicate of this code for the footer.) I changed it to look like this: if ((message != null)(property == null) || (propertyMsgPresent message != null)) { results.append(message); results.append(\r\n); } Which checks for the existence of message before appending it. Here's a unified diff if anyone wants it. Index: ErrorsTag.java === RCS file: /home/cvspublic/jakarta-struts/src/share/org/apache/struts/taglib/html/ErrorsTag.java,v retrieving revision 1.11 diff -u -r1.11 ErrorsTag.java --- ErrorsTag.java 2001/07/16 00:44:54 1.11 +++ ErrorsTag.java 2001/09/10 19:01:49 @@ -244,7 +244,8 @@ reports = errors.get(property); // Render header iff this is a global tag or there is an error for this property boolean propertyMsgPresent = reports.hasNext(); - if ((message != null)(property == null) || propertyMsgPresent) { + if ((message != null)(property == null) || + (propertyMsgPresent message != null)) { results.append(message); results.append(\r\n); } @@ -264,7 +265,8 @@ message = RequestUtils.message(pageContext, bundle, locale, errors.footer); -if ((message != null)(property == null) || propertyMsgPresent) { +if ((message != null)(property == null) || + (propertyMsgPresent message != null)) { results.append(message); results.append(\r\n); } Joey -- Sun Certified Java2 Programmer -- My Pocket Smalltalk Stuff: www.joeygibson.com/st -- -- We thought about killin' him, but we kinda -- hated to go that far - Briscoe Darling