velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Harvey III <charl...@alloy.com>
Subject Re: replacement for jsp:forward
Date Thu, 04 Aug 2005 15:33:40 GMT
You CAN set a servlet in your welcome file list.  But you have to have
a dummy file in the directory for it to work.

I use Struts with Velocity, so I have the main page in a directory mapped
as index.do in my struts-config.xml.  So, in said directory, I create an
empty file called "index.do".  Either Apache or Tomcat will read through
the directory, see the file, and attempt to serve it.  But then Tomcat
will see that it should be serving a servlet instead and process it.
Its a neat trick.

Also, if you want to have "index.vm" pointing to a particular servlet,
just have this and nothing else on the page:

$response.sendRedirect( "/myServlet" )


It is not exactly a forward, but it sends the request to the right place.



Charlie



Andrew Mason said the following on 8/4/2005 11:15 AM:

>I think he meant an onLoad() in spring 
>On Thu August 4 2005 4:04 pm, Michael Fortin wrote:
>  
>
>>I could do a javascript redirect but that would assume that the client
>>has javascript enabled.  A meta refresh would be an options too but I
>>was hoping to avoid client side redirects, is there a way to do it
>>server side?
>>
>>Thanks
>>Michael
>>
>>Michael Oliver wrote:
>>    
>>
>>>Just use a plain old index.html page and use onLoad to go to your velocity
>>>entry point.
>>>
>>>Michael Oliver
>>>CTO
>>>Alarius Systems LLC
>>>6800 E. Lake Mead Blvd, #1096
>>>Las Vegas, NV 89156
>>>Phone:(702)643-7425
>>>Fax:(702)974-0341
>>>*Note new email changed from oliverm@matrix-media.com
>>>-----Original Message-----
>>>From: Michael Fortin [mailto:mikef@vendorpromotions.com]
>>>Sent: Thursday, August 04, 2005 7:44 AM
>>>To: Velocity Users List
>>>Subject: replacement for jsp:forward
>>>
>>>Hello all,
>>>
>>>I've been trying to configure a site with velocity and spring and I'm
>>>having a little trouble with the welcome page.  With jsp I can just add
>>>an index.jsp with a jsp:forward in it to route to my servlet the will
>>>render my home page.  I really want to keep it a pure velocity site but
>>>there doesn't seem to be an equivalent to jsp:forward in velocity.  I've
>>>tried to set a servlet in my welcome file list in the web.xml but that
>>>didn't work, I just get a directory listing.  Is there a way to do this?
>>>
>>>
>>>Thanks,
>>>Michael
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>>      
>>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>  
>

---------------------------------------------------------------------
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