velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rich Garabedian" <r...@autorevenue.com>
Subject RE: Problem using Velocity strut tools as the welcome file
Date Wed, 10 Dec 2003 15:59:50 GMT
Thanks for the response!

I must confess, however, than I'm not sure what you mean.

I've set up the VelocityServlet in web.xml, so Tomcat should know what
to do with files containing the vm file extension. I just did a further
test and if I change this line in the welcome.vm file:

	<LI><A href="$link.setForward('logon')">Sign in</A></LI>

to

	<LI><A href="$link.setAction('template.logon.vm')">Sign
in</A></LI>

I no longer get the exception?????? So the page seems to be rendering
fine, but it definitely doesn't like the setForward() function.

> -----Original Message-----
> From: Barbara Baughman [mailto:barbara.baughman@utdallas.edu]
> Sent: Wednesday, December 10, 2003 10:54 AM
> To: Velocity Users List; rich@autorevenue.com
> Subject: Re: Problem using Velocity strut tools as the welcome file
> 
> My guess is that you have to run through a servlet to render a
> Velocity page.  Most servlet containers would recognize the .jsp
> extension as an indicator to automatically build a servlet behind the
> scenes.  The .vm extension does not.
> 
> Barbara Baughman
> X2157
> 
> On Wed, 10 Dec 2003, Rich Garabedian wrote:
> 
> > I'm writing some rudimentary tests to get Velocity up-and-running
with
> > Jakarta struts. I have a very small logon example. It works
perfectly
> > with jsp's. It works perfectly with velocity as well UNLESS I change
the
> > welcome page from this:
> >
> >   <welcome-file-list>
> >             <welcome-file>index.jsp</welcome-file>
> >   </welcome-file-list>
> >
> > To this:
> >
> >   <welcome-file-list>
> >             <welcome-file>welcome.vm</welcome-file>
> >   </welcome-file-list>
> >
> > index.jsp is the typical redirect page:
> >
> > <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
> > <logic:redirect forward="welcome"/>
> >
> > Error I get is this:
> >
> > Invocation of method 'setForward' in  class
> > org.apache.velocity.tools.struts.StrutsLinkTool threw exception
class
> > java.lang.NullPointerException : null
> > org.apache.velocity.exception.MethodInvocationException: Invocation
of
> > method 'setForward' in  class
> > org.apache.velocity.tools.struts.StrutsLinkTool threw exception
class
> > java.lang.NullPointerException : null
> >
> > I've included my stuts config file at the bottom of this email as
well.
> >
> > Can anyone tell me if this is expected behavior?
> >
> > I'm using:
> >
> > struts 1.1
> > velocity-tools-1.1-beta1
> > jakarta-tomcat-5.0.16
> >
> >
> > Struts config file:
> >
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> >
> > <!DOCTYPE struts-config PUBLIC
> >           "-//Apache Software Foundation//DTD Struts Configuration
> > 1.1//EN"
> >
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> >
> > <struts-config>
> >
> > <!-- ======================================== Form Bean Definitions
-->
> >
> >
> >
> >     <form-beans>
> >         <form-bean name="logonForm"
> >
> > type="com.autorevenue.prospecting.struts.forms.LogonForm"/>
> >     </form-beans>
> >
> > <!-- =================================== Global Forward Definitions
-->
> >
> >     <global-forwards>
> >         <forward name="welcome"
> >                  path="/Welcome.do"/>
> >
> >         <forward name="logon"
> >                  path="/Logon.do"/>
> >     </global-forwards>
> >
> > <!-- =================================== Action Mapping Definitions
-->
> >
> >     <action-mappings>
> >         <action
> > type="com.autorevenue.prospecting.struts.actions.LogonAction"
> >                                 path="/LogonSubmit"
> >                                 name="logonForm"
> >                                                 scope="request"
> >                                                 validate="true"
> >                 input="/templates/logon.vm">
> >                                                 <forward
name="success"
> > path="/Welcome.do" redirect="true"/>
> >                         </action>
> >
> >         <action path="/Welcome"
> >
> > type="org.apache.struts.actions.ForwardAction"
> >                 parameter="/templates/welcome.vm"/>
> >
> >         <action path="/Logon"
> >
> > type="org.apache.struts.actions.ForwardAction"
> >                 parameter="/templates/logon.vm"/>
> >     </action-mappings>
> >
> >
> > <!-- ================================ Message Resources Definitions
-->
> >
> >     <message-resources parameter="ApplicationResources"
null="false"/>
> >
> >
> > </struts-config>
> >
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message