L
luca
no answer on c.l.j.help, so I guess it's time to escalate here
I am creating a tag-lib and I need the top tag to
take care of setting the content type. My tag goes like:
public int doStartTag() throws JspException {
try {
HttpServletRequest request =
(HttpServletRequest)pageContext.getRequest();
HttpServletResponse response =
(HttpServletResponse)pageContext.getResponse();
//i.e. the tag encapsulates the logic to
//decide which MIME type to send
if (somecondition) {
response.setContentType("text/vnd.wap.wml");
} else {
response.setContentType("text/html");
}
:
}
My JSP file looks like:
<%@ taglib uri="/WEB-INF/tld/tags.tld" prefix="pref" %><pref:document>
(i.e. everything squeezed on the very first line
to make sure that no char escapes and the default text/html content type
is not generated).
Alas. It doesn't work. I keep getting text/html.
I did some tests. if I set the mime type explicitly in the JSP like
below (after removing the contenttype() line from the taglib) it works!
<%
response.setContentType("text/vnd.wap.wml");
%><%@ taglib uri="/WEB-INF/tld/tags.tld" prefix="pref" %><pref:document>
any idea? is there some place where the appserver decides to send out
the MIME type before I get a chance to change that in my tag?
tomace 4.1.18 here
thanks
luca
I am creating a tag-lib and I need the top tag to
take care of setting the content type. My tag goes like:
public int doStartTag() throws JspException {
try {
HttpServletRequest request =
(HttpServletRequest)pageContext.getRequest();
HttpServletResponse response =
(HttpServletResponse)pageContext.getResponse();
//i.e. the tag encapsulates the logic to
//decide which MIME type to send
if (somecondition) {
response.setContentType("text/vnd.wap.wml");
} else {
response.setContentType("text/html");
}
:
}
My JSP file looks like:
<%@ taglib uri="/WEB-INF/tld/tags.tld" prefix="pref" %><pref:document>
(i.e. everything squeezed on the very first line
to make sure that no char escapes and the default text/html content type
is not generated).
Alas. It doesn't work. I keep getting text/html.
I did some tests. if I set the mime type explicitly in the JSP like
below (after removing the contenttype() line from the taglib) it works!
<%
response.setContentType("text/vnd.wap.wml");
%><%@ taglib uri="/WEB-INF/tld/tags.tld" prefix="pref" %><pref:document>
any idea? is there some place where the appserver decides to send out
the MIME type before I get a chance to change that in my tag?
tomace 4.1.18 here
thanks
luca