From the code:

org.apache.myfaces.taglib.html.ext.HtmlPanelGridTag
=======================
public class HtmlPanelGridTag
       extends HtmlPanelGridTagBase
{
   public String getComponentType()
   {
       return HtmlPanelGrid.COMPONENT_TYPE;
   }

   public String getRendererType()
   {
       return "org.apache.myfaces.Grid";
   }
=======================

=======================
org.apache.myfaces.component.html.ext.HtmlPanelGrid
   public static final String COMPONENT_TYPE =
"org.apache.myfaces.HtmlPanelGrid";
=======================


Thus:

tomahawk.taglib.xml:
=======================
   <tag>
       <tag-name>panelGrid</tag-name>
       <component>
           <component-type>org.apache.myfaces.HtmlPanelGrid</component-type>
           <renderer-type>org.apache.myfaces.Grid</renderer-type>
       </component>
   </tag>
=======================


However, it's very strange that the jsp tag handler is what's setting
the renderer.
The superclass of the HtmlPanelGrid component has this:

javax.faces.component.html.HtmlPanelGrid
=======================
   private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Grid";
   public HtmlPanelGrid()
   {
       setRendererType(DEFAULT_RENDERER_TYPE);
   }
=======================

You might need to use this renderer instead, although I suspect it's
really a bug in the MyFaces code organization.   Seems like an issue
common to all extended classes.   Non-extended components set the
renderer in the constructor -- the renderer assocation should be
separate from the ViewHandler.

On 2/9/07, raju <[EMAIL PROTECTED]> wrote:

Hi,

I was able to run this application.Please let me know how to migrate this
application to  use facelets with tomahawk if some one has tried it out.I am
getting error:<t:panelGrid> Tag Library supports namespace:
http://myfaces.apache.org/tomahawk, but no tag was defined for name:
panelGrid

I have created a tomahawk.taglib.xml to refer to components and added a
context-param entry into web.xml.
I need to add a tag entry in I am not able to find tag entry for to be added
in tomahawk.taglib.xml.

my .xhtml file as follows:
---------------------------------

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml";
        xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns:h="http://java.sun.com/jsf/html";
        xmlns:f="http://java.sun.com/jsf/core";
    xmlns:t="http://myfaces.apache.org/tomahawk";>
<body bgcolor="#ffffff">

<f:view>
  <h:form id="welcomeForm" enctype="multipart/form-data">
    <t:panelGrid columns="3">
    <t:inputFileUpload id="uFile" value="#{FileUploadBean.theFile}"
storage="file" required="true" />
    </t:panelGrid>
    <h:panelGrid columns="3">
    <h:commandButton id="onlyButton" action="#{FileUploadBean.fmWelcome}"
value="Click here to Upload"/>
    </h:panelGrid>


  </h:form>
</f:view>
</body>

</html>

Regards
Raju


JBuilderDoug wrote:
>
> I finally figured this out, so  I'm going to put an entire example in this
> post.  I'm using Tomahawk 1.1.3 with RI JSF created in Borland's JBuilder.
> I've created a .war file from borland and deployed it under Tomcat 5.5 so
> it should be Borland independent.  The problems I was having previously
> were in trying to deploy Tomahawk on a old JSF project. I'm pretty sure
> I'm safe in saying you must use JSP 2.0 and Servlet 2.4 as a minimum.
>
> inputFileUpload/Tomahawk specific elements are bold/italic
>
> In the backing bean WelcomeBean.java, I only read the uploaded file into a
> byte [].  In my personal application, I simply insert the byte [] into an
> Oracle BLOB.  You may need to write it to a file.  I'll assume you know
> how to do that.
>
> I think that's pretty much it.  If you have any questions please respond
> to this post.  I'll receive an e-mail and try to help.  If you want to
> know how to implement Tomahawk 1.1.3 into Borland's JBuilder, I can help
> with that also I believe.
>
> Doug
>
> Required libraries for this minimal project
>
> commons-beanutils.jar
> commons-collections.jar
> commons-digester.jar
> commons-fileupload.jar
> commons-logging.jar
> jsf-api.jar
> jsf-impl.jar
> jstl.jar
> standard.jar
> tomahawk-1.1.3.jar
>
> index.jsp
>
> <html>
> <html>
> <head>
> <title>index</title>
> </head>
> <body bgcolor="#ffffc0">
> <h1></h1>
> <jsp:forward page="Welcome.faces"></jsp:forward>
> </body>
> </html>
>
> Welcome.jsp
>
> <[EMAIL PROTECTED] uri="http://java.sun.com/jsf/html"; prefix="h"%>
> <[EMAIL PROTECTED] uri="http://java.sun.com/jsf/core"; prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t" %>
> <html>
> <head>
> <title>index</title>
> </head>
> <body bgcolor="#ffffff">
> <h1>GoHurst Welcome</h1>
> <f:view>
>   <h:form id="welcomeForm" enctype="multipart/form-data">
>     <t:panelGrid columns="3">
>     <t:inputFileUpload id="uFile" value="#{WelcomeBean.theFile}"
> storage="file" required="true" />
>     </t:panelGrid>
>     <h:panelGrid columns="3">
>     <h:commandButton id="onlyButton" action="#{WelcomeBean.fmWelcome}"
> value="Click here to Upload"/>
>     </h:panelGrid>
>   </h:form>
> </f:view>
> </body>
> </html>
>
> WelcomeBean.java
>
> package tomahawkfileupload;
>
> import java.io.File;
> import java.io.InputStream;
> import javax.servlet.http.HttpSession;
> import javax.faces.context.FacesContext;
> import org.apache.myfaces.custom.fileupload.UploadedFile;
>
> public class WelcomeBean
> {
>     private UploadedFile theFile;
>
>     public UploadedFile getTheFile() {
>       return theFile;
>     }
>
>     public void setTheFile (UploadedFile theFile) {
>       this.theFile = theFile;
>     }
>
>     public String fmWelcome()
>     {
>         FacesContext context = FacesContext.getCurrentInstance();
>         HttpSession session = (HttpSession)
> context.getExternalContext().getSession(false);
>         try {
>           InputStream stream = theFile.getInputStream();
>           long fSize = theFile.getSize();
>           byte [] buffer = new byte[(int)fSize];
>           stream.read(buffer, 0, (int)fSize);
>           stream.close();
>         } catch (Exception ioe) {
>            ioe.printStackTrace();
>         }
>         return "success";
>     }
> }
>
>
> web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4">
>   <display-name>TomaModule</display-name>
>   <servlet>
>     <servlet-name>Faces Servlet</servlet-name>
>     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.faces</url-pattern>
>   </servlet-mapping>
>   <filter>
>     <filter-name>MyFacesExtensionsFilter</filter-name>
>
> <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
>     <init-param>
>       <param-name>maxFileSize</param-name>
>       <param-value>20m</param-value>
>     </init-param>
>   </filter>
>   <filter-mapping>
>     <filter-name>MyFacesExtensionsFilter</filter-name>
>     <servlet-name>Faces Servlet</servlet-name>
>   </filter-mapping>
>   <filter-mapping>
>     <filter-name>MyFacesExtensionsFilter</filter-name>
>     <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
>   </filter-mapping>
> </web-app>
>
>
> faces-config.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer
> Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>
> <faces-config xmlns="http://java.sun.com/JSF/Configuration";>
>   <managed-bean>
>     <managed-bean-name>WelcomeBean</managed-bean-name>
>
> <managed-bean-class>tomahawkfileupload.WelcomeBean</managed-bean-class>
>     <managed-bean-scope>session</managed-bean-scope>
>   </managed-bean>
>
>   <navigation-rule>
>     <from-view-id>*</from-view-id>
>     <navigation-case>
>       <from-action>#{WelcomeBean.fmWelcome}</from-action>
>       <from-outcome>success</from-outcome>
>       <to-view-id>/Welcome.jsp</to-view-id>
>     </navigation-case>
>     <navigation-case>
>       <from-action>#{WelcomeBean.fmBicycle}</from-action>
>       <from-outcome>bypass</from-outcome>
>       <to-view-id>/Welcome.jsp</to-view-id>
>     </navigation-case>
>   </navigation-rule>
> </faces-config>
>
>

--
View this message in context: 
http://www.nabble.com/Tomahawk-1.1.3-inputFileUpload-solution-tf2318350.html#a8882592
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Reply via email to