Redirecionar a index.jsp para xhtml

Ta sim coloquei um breakpoint e subi o JBoss no debug ele entrou la :frowning:

verifica no seu web.xml se a sua extensão reconhecida para faces é .jsf mesmo:

<servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping>

verifica no seu web.xml se o default suffix está para .xhtml mesmo, ou para .jsp (qualquer coisa posta ele aqui para vermos)

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>

Outra coisa, se você quiser fazer o tomcat ler para “server:8080/seuprojeto/” algum arquivo específico, é só você alterar, no web.xml, o parâmetro welcome-file-list

 <welcome-file-list>  
   <welcome-file>login.jsp</welcome-file>  
 </welcome-file-list>  

Opa evufuji nao tinha essas configuraçoes nao, coloquei mas nao funcionou, vou colocar aqui o web.xml:

[code]<?xml version="1.0" encoding="UTF-8"?>

Everton

javax.faces.STATE_SAVING_METHOD server com.sun.faces.config.ConfigureListener Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.jsf /faces/* javax.faces.DEFAULT_SUFFIX .xhtml index.jsp

[/code]

minha index index.jsp

<jsp:forward page="/pages/Cadastro.jsf"/>

minha Pagina cadastro que eu queria subir:

[code]<

<!-- 
	Replace path to template, title, header and body
	with actual data.
 -->
<ui:composition template="">
		<ui:define name="pageTitle">Title</ui:define>
		<ui:define name="pageHeader">Header</ui:define>
		<ui:define name="body">
		
			<form jsfc="h:form" id="Form">				
			
			<div class = "retangle_top"/>
							
			<h: inputText id = "#{textNome} value = "Nada" />
							
			
			</form>
		</ui:define>
</ui:composition>
[/code]

Agora quando eu tenho acessar a pagina pede pra mim fazer download do arquivo =[

olha a imagem


Em algum lugar você troca o mime type que o server informa ao navegador? Tipo, no seu template tem alguma metatag que fale o formato, algo como isso.

http-equiv="Content-Type" content="text/html; charset=utf-8" />

ou mesmo em algum bean seu.

Eu tirei o “<” do inicio, mas continuo do mesmo jeito, sobre o mime type não sei o que é =[

[quote=evefuji]Em algum lugar você troca o mime type que o server informa ao navegador? Tipo, no seu template tem alguma metatag que fale o formato, algo como isso.

http-equiv="Content-Type" content="text/html; charset=utf-8" />

ou mesmo em algum bean seu.[/quote]

nao tem nao

então defina no seu web.xml os mime types para cada extensão de arquivo:

[code]

doc application/vnd.ms-word dsp text/html gif image/gif htm text/html html text/html jnlp application/x-java-jnlp-file jpeg image/jpeg jpg image/jpeg js application/x-javascript pdf application/pdf [/code](etc... o jsf vc deveria colocar como text/html)

coloquei todos, mas ta abrindo a pg pra fazer dl =[

ta gerando no console ao final:

Buildfile: C:\Users\everton\Desktop\eclipse-jee-helios-SR1-win32-x86_64\eclipse\plugins\org.eclipse.jst.server.generic.jboss_1.6.1.v200904151730\buildfiles\jboss323.xml deploy.j2ee.web: [jar] Building jar: C:\Users\everton\Documents\web\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\Everton.war [move] Moving 1 file to C:\Program Files\jboss-5.0.0.CR2-jdk6\jboss-5.0.0.CR2\server\default\deploy BUILD SUCCESSFUL Total time: 10 seconds

Ta gerando o deploy normal

Olá.
Lembro de ter passado por esse erro,mas não consegui simular aqui

esse é meu web.xml q funciona:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5"&gt;
	&lt;display-name&gt;projetoBase&lt;/display-name&gt;
	&lt;context-param&gt;
		&lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
		&lt;param-value&gt;org.jboss.el.ExpressionFactoryImpl&lt;/param-value&gt;
	&lt;/context-param&gt;
	  
	&lt;context-param&gt;
		&lt;param-name&gt;javax.faces.CONFIG_FILES&lt;/param-name&gt;
		&lt;param-value&gt;/WEB-INF/faces-config.xml&lt;/param-value&gt;
	&lt;/context-param&gt;
	
	&lt;context-param&gt;
		&lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt;
		&lt;param-value&gt;.xhtml&lt;/param-value&gt;
	&lt;/context-param&gt;
	&lt;context-param&gt;
		&lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
		&lt;param-value&gt;client&lt;/param-value&gt;
	&lt;/context-param&gt;
	
	&lt;context-param&gt;
		&lt;param-name&gt;facelets.DEVELOPMENT&lt;/param-name&gt;
		&lt;param-value&gt;true&lt;/param-value&gt;
	&lt;/context-param&gt;
	
	&lt;context-param&gt;
		&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
		&lt;param-value&gt;
			/WEB-INF/applicationContext.xml
		&lt;/param-value&gt;
	&lt;/context-param&gt;
	
	&lt;welcome-file-list&gt;
		&lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
		&lt;welcome-file&gt;index.htm&lt;/welcome-file&gt;
		&lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
		&lt;welcome-file&gt;default.html&lt;/welcome-file&gt;
		&lt;welcome-file&gt;default.htm&lt;/welcome-file&gt;
		&lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt;
	&lt;/welcome-file-list&gt;
	  
	&lt;context-param&gt;
		&lt;param-name&gt;org.ajax4jsf.VIEW_HANDLERS&lt;/param-name&gt;
		&lt;param-value&gt;com.sun.facelets.FaceletViewHandler&lt;/param-value&gt;
	&lt;/context-param&gt;
	
	&lt;filter&gt;
		&lt;display-name&gt;RichFaces Filter&lt;/display-name&gt;
		&lt;filter-name&gt;richfaces&lt;/filter-name&gt;
		&lt;filter-class&gt;org.ajax4jsf.Filter&lt;/filter-class&gt;
	&lt;/filter&gt;
	&lt;listener&gt;
		&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
	&lt;/listener&gt;
	&lt;listener&gt;
		&lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
	&lt;/listener&gt;
	&lt;filter-mapping&gt;
		&lt;filter-name&gt;richfaces&lt;/filter-name&gt;
		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
		&lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
		&lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
		&lt;dispatcher&gt;INCLUDE&lt;/dispatcher&gt;
	&lt;/filter-mapping&gt;

	&lt;servlet&gt;
		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
		&lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
		&lt;load-on-startup&gt;0&lt;/load-on-startup&gt;
	&lt;/servlet&gt;
	
	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
		&lt;url-pattern&gt;*.faces&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;
&lt;/web-app&gt;

Mas como vou adaptar seu web.xml com o meu??

por exemplo, esse extension filter aqui esta dando erro na hora do deploy.

<filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>*.jsf</url-pattern> </filter-mapping>

se eu tiro ele fica a pagina pra dl

Vai vendo o que se adapta ou não :smiley:

Everton,
Voce conseguiu pegar essa pagina jsp ?

Também estou precisando fazer isso.

Obrigado;

Consegui nao amigo =[, negocio ta feio kkk. Quando digito no browser http://localhost:8080/Everton, abre um dialog pra dl =[

Puts,

Beleza então, eu também estouy tentando aqui, qualquer coisa eu posto para nós =)

Abs

Everton,tu está usando RichFaces?

tem alguma linha mais ou menos assim response.setContentType(“text/html”); em algum constructor do seu bean?

Tenta colocar um metatag no seu template que defina o content type para text/html.

to não rafa.

evefuji eu nem tenho nenhum bean ainda so tenho essa pagina.

to não rafa.

evefuji eu nem tenho nenhum bean ainda so tenho essa pagina.[/quote]

me mostra as libs do teu projeto.