Nathan -
I'm using VelocityViewServlet, but this template produces an HTML
form if 'binds' is not defined. Is there a
way to set the content type from inside the template?
Garey
Nathan Bubna wrote:
This sounds like an issue with the content-type your servlet (the one
processing the temp
This sounds like an issue with the content-type your servlet (the one
processing the template) is setting on the response. Are you using
the VelocityViewServlet or your own? if the former, are you setting
the 'default.contentType' property to 'text/xsl' in your
velocity.properties? If not, then
Hi -
The subject kinda says it all. Here is a snippet of my template
${count}
#foreach($bind in ${binds})
${bind.statusString}
ark:/${bind.noid}
${bind.message}
#end
When this generates a page that is viewed by a browser, the browser
does not
On 6/8/07, Garey <[EMAIL PROTECTED]> wrote:
Nathan -
I'm using VelocityViewServlet, but this template produces an HTML
form if 'binds' is not defined. Is there a
way to set the content type from inside the template?
hmm. the VelocityViewServlet automatically puts the
HttpServletResponse i
Nathan -
I tried setting the content type from the template and no joy. I
also tried setting the content type in the response
from my logic before passing the request off to the VelocityViewServlet.
Also no go. I suppose that is because either a) the handoff to the
ViewServlet is a forward
Nathan -
The message below was sent inadvertently before completion. In
extending the ViewServlet, what seems best to me is to signal the
content-type from my logic. Stuff an attribute into the request? Any
problems with that that you can see?
Thanks for any help;
Garey Mills
actually, b) is true too. the VVS does explicitly set the content type.
either way, you should extend the VVS. the key method to override is
the setContentType(request, response) method.
to be able to tell what content type to set, you will want to push an
indicator (or the content type value
Nathan -
I believe that I have done what you suggested. I created a class
MyVelocityViewServlet that extends VelocityViewServlet. It contains only
an overridden setContentType(request, response) which pulls an attribute
out of the request and sets the content type of the response based on
That all sounds correct. The only thing i can think of to check on is
whether any content has been committed to the response or if
response.getWriter() is called before the setContentType() call
happens.
http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/ServletResponse.