The problem may be that you need to make a trip through the ActionServlet before using the Velocity View tools, so a Struts VelTool VM may not do what you need.

What does work, with any system, is to use a index.html page and do the redirect with meta tags. I point it to a Welcome action so I can use the same one in every application and then just change what Welcome does.

<html>
<head>
<meta http-equiv="Refresh" content="0;URL=./Welcome.do">
</head>
<body>
<br />
</body>
</html>

HTH, Ted.

Rich Garabedian wrote:

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:[EMAIL PROTECTED]
Sent: Wednesday, December 10, 2003 10:54 AM
To: Velocity Users List; [EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to