You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by MYoung <cl...@live.com> on 2008/02/22 23:42:08 UTC

Howto use .xhtml instead of .html for template file extension

I follow this: 

http://cwiki.apache.org/confluence/display/WICKET/Use+a+different+extension+for+template+files

added this to MyPage:

    @Override
    public String getMarkupType() {
    	return "xhtml";
    }

and it doesn't work.  Firefox wants to download the file instead of showing
the page.
http://www.nabble.com/file/p15641885/no-go-xhtml.jpg 

IE7 cannot even download the file.

What am I doing wrong?
-- 
View this message in context: http://www.nabble.com/Howto-use-.xhtml-instead-of-.html-for-template-file-extension-tp15641885p15641885.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Howto use .xhtml instead of .html for template file extension

Posted by UPBrandon <bc...@up.com>.
Out of curiosity, since pages in a Wicket application aren't accessed as
directly as something like a JSP might be, what reasoning is there for using
an XHTML file extension instead of HTML?

-Brandon


MYoung wrote:
> 
> I follow this: 
> 
> http://cwiki.apache.org/confluence/display/WICKET/Use+a+different+extension+for+template+files
> 
> added this to MyPage:
> 
>     @Override
>     public String getMarkupType() {
>     	return "xhtml";
>     }
> 
> and it doesn't work.  Firefox wants to download the file instead of
> showing the page.
>  http://www.nabble.com/file/p15641885/no-go-xhtml.jpg 
> 
> IE7 cannot even download the file.
> 
> What am I doing wrong?
> 

-- 
View this message in context: http://www.nabble.com/Howto-use-.xhtml-instead-of-.html-for-template-file-extension-tp15641885p15674567.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Howto use .xhtml instead of .html for template file extension

Posted by Kent Tong <ke...@cpttm.org.mo>.

MYoung wrote:
> 
> Firefox wants to download the file instead of showing the page.
>  http://www.nabble.com/file/p15641885/no-go-xhtml.jpg 
> 
> IE7 cannot even download the file.
> 

The mime type Wicket returns to the browser is text/<THE MARKUP TYPE>. In
your case it's text/xhtml which is not correct. Instead, one should use 
application/xhtml+xml or text/html. The problem is that IE doesn't support
XHTML at all, so you have to use text/html and let all browsers treat the
response as html, not xhtml.

Wicket could be enhanced to differentiate between the template file
extension and the mime type.

For your case, try below as a workaround (or simply name your files
as *.html):

public class MyPage extends WebPage {
	public String getMarkupType() {
		return "xhtml";
	}
	protected void configureResponse() {
		super.configureResponse();
		getResponse().setContentType("text/html");
	}
}


-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: http://www.nabble.com/Howto-use-.xhtml-instead-of-.html-for-template-file-extension-tp15641885p15660676.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org