Help!

View: New views
9 Messages — Rating Filter:   Alert me  

Help!

by Kakau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil

Re: Help!

by Fernando Franzine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com


On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil


Re: Help!

by Kakau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

The application works fine when I use jsf:
 <h:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

But if I replace with ajax4jsf:

<a4j:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

The page print the JNLP.

I think the tag is wrong. The code is right because the application works with jsf.

How to create a link using ajax4jsf that it will open my webStart application?!


Thanks!



2009/10/30 Fernando Franzine <fernandofranzine@...>
I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil




--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil

Re: Help!

by Fernando Franzine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That is the problem !! You can't ! Cause with ajax request you return xml responde to rendered some part of your page ! You can't link with ajax rquest....just http full request.
Regards

-
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com


On Fri, Oct 30, 2009 at 6:07 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The application works fine when I use jsf:
 <h:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

But if I replace with ajax4jsf:

<a4j:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

The page print the JNLP.

I think the tag is wrong. The code is right because the application works with jsf.

How to create a link using ajax4jsf that it will open my webStart application?!


Thanks!



2009/10/30 Fernando Franzine <fernandofranzine@...>
I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil




--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



-

JSP Interceptar pre-processamento (Eudis)

by AOCOM - Eudis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Caros colegas,

Tenho uma situação na qual presciso colocar alguns parametros em uma
página JSP usando Tomcat 6 durante
a execução, da seguinte maneira:

===> Na pagina .jsp esta assim:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="expires" content="-1">
 </head>

 <body>
  <###MARCA###>
 </body>
</html>

===> Más gostaria que quando foce processada ela mudace antes para:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="expires" content="-1">
 </head>

 <body>
<f:view>
  <h:form>
    <rich:panel style="width:100%;">
      <table width="100%">
        <tr>
          <td class="label" width="130"><h:outputLabel value="Usuário: "
/></td>
          <td class="input"><h:outputText
            value="#{trocarSenhaControl.usuario.codigo}" /> - <h:outputText
            value="#{trocarSenhaControl.usuario.nome}" /></td>
        </tr>
        <tr>
          <td class="label" width="130"><h:outputLabel
            value="Senha atual: " /></td>
          <td class="input"><h:inputSecret id="antiga" size="20"
            value="#{trocarSenhaControl.antiga}" /></td>
        </tr>
        <tr>
          <td class="label" width="130"><h:outputLabel value="Senha
nova: " /></td>
          <td class="input"><h:inputSecret id="nova" size="20"
            value="#{trocarSenhaControl.nova}" /></td>
        </tr>
        <tr>
          <td class="label" width="130"><h:outputLabel
            value="Redigite a nova: " /></td>
          <td class="input"><h:inputSecret id="redigitada" size="20"
            value="#{trocarSenhaControl.redigitada}" /></td>
        </tr>
      </table>
      <f:verbatim>
        <br />
      </f:verbatim>
      <rich:separator height="2" lineType="solid" />
      <f:verbatim>
        <br />
      </f:verbatim>
      <h:commandButton styleClass="actionbuttom"
        action="#{trocarSenhaControl.executar}" value="GRAVAR" />
      <h:commandButton styleClass="actionbuttom"
        action="#{trocarSenhaControl.sair}" value="SAIR" />
    </rich:panel>
  </h:form>
</f:view>
</body>
</html>


Atravé de tag consegui colocar o conteudo, más o problema é que ele não
processa o mesmo, caso eu quisece colocar
apenas código HTML funcionaria, más o problema é que é código JSF, então
acho que deve ser incluido antes do processamento
da página em si.

- Existe algum filtro o meio por tag de fazer esta troca antes da página
JSF ser transformada em Servlet, para que o
pre-processamento interprete o código JSF, acho que seria algo no ato da
carga do conteudo do arquivo ".jsp" pelo Tomcat?

- Se existir, qual seria?

Obrigado,

Eudis de Oliveira

---------------------------------------------------------------------
To unsubscribe, e-mail: enterprise-list-unsubscribe@...
For additional commands, e-mail: enterprise-list-help@...


Re: Help!

by Kakau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

The method called (when a user clicks in link) is a void of my bean. This method redirect to JNLP file :

            ...
            ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();       
            HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
            HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
            request.setAttribute(...);
            ...
            ExternalContext extContext = (ExternalContext) FacesContext.getCurrentInstance().getExternalContext();
            ServletContext servletContext = (ServletContext) extContext.getContext();             
            ServletContext newcontext  = (ServletContext) servletContext.getContext("/my-tool");                   
            RequestDispatcher dispatcher = newcontext.getRequestDispatcher("/my-servlet-mapping");
            dispatcher.forward(request, response);
            FacesContext.getCurrentInstance().responseComplete();

A class is called using servlet mapping.This class extends HttpServlet and is a servlet that dynamically generates the JNLP file for clients:

            ...
            response.setContentType("application/x-java-jnlp-file");
            String jnlp = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><jnlp spec=\"1.0+\""+ " codebase=\""+ host + ":" + port + "/"+ "my-tool"+ "\">" ... + "<argument>"+ request.getAttribute(" ... ")+ "</argument>" + ...;
            out.println(jnlp);     
           
But, when a user clicks in link, the page prints the jnlp. My
application doesn't open with Java WebStart.

Any idea?


2009/11/3 Fernando Franzine <fernandofranzine@...>
That is the problem !! You can't ! Cause with ajax request you return xml responde to rendered some part of your page ! You can't link with ajax rquest....just http full request.

Regards

-
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com


On Fri, Oct 30, 2009 at 6:07 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The application works fine when I use jsf:
 <h:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

But if I replace with ajax4jsf:

<a4j:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

The page print the JNLP.

I think the tag is wrong. The code is right because the application works with jsf.

How to create a link using ajax4jsf that it will open my webStart application?!


Thanks!



2009/10/30 Fernando Franzine <fernandofranzine@...>
I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil




--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



-



--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil

Re: Help!

by Fernando Franzine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Of course it was !! Because you are generated "response.setContentType("application/x-java-jnlp-file");" jnpl response....
You can't do this,...unless you know how jnlp file work...lollll
You just need redirect (http 303) to adress that have o jnpl.....and let de browser do another request to web start server.

Fher

On Fri, Nov 6, 2009 at 11:20 AM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The method called (when a user clicks in link) is a void of my bean. This method redirect to JNLP file :

            ...
            ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();       
            HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
            HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
            request.setAttribute(...);
            ...
            ExternalContext extContext = (ExternalContext) FacesContext.getCurrentInstance().getExternalContext();
            ServletContext servletContext = (ServletContext) extContext.getContext();             
            ServletContext newcontext  = (ServletContext) servletContext.getContext("/my-tool");                   
            RequestDispatcher dispatcher = newcontext.getRequestDispatcher("/my-servlet-mapping");
            dispatcher.forward(request, response);
            FacesContext.getCurrentInstance().responseComplete();

A class is called using servlet mapping.This class extends HttpServlet and is a servlet that dynamically generates the JNLP file for clients:

            ...
            response.setContentType("application/x-java-jnlp-file");
            String jnlp = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><jnlp spec=\"1.0+\""+ " codebase=\""+ host + ":" + port + "/"+ "my-tool"+ "\">" ... + "<argument>"+ request.getAttribute(" ... ")+ "</argument>" + ...;
            out.println(jnlp);     
           
But, when a user clicks in link, the page prints the jnlp. My
application doesn't open with Java WebStart.

Any idea?


2009/11/3 Fernando Franzine <fernandofranzine@...>

That is the problem !! You can't ! Cause with ajax request you return xml responde to rendered some part of your page ! You can't link with ajax rquest....just http full request.

Regards

-
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com


On Fri, Oct 30, 2009 at 6:07 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The application works fine when I use jsf:
 <h:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

But if I replace with ajax4jsf:

<a4j:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

The page print the JNLP.

I think the tag is wrong. The code is right because the application works with jsf.

How to create a link using ajax4jsf that it will open my webStart application?!


Thanks!



2009/10/30 Fernando Franzine <fernandofranzine@...>
I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil




--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



-



--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com

Re: Help!

by Kakau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem is that there isn't a "static address" for the jnlp. Because it is generated dynamically and needs to redirect to a servlet
using some mapping. :-(



2009/11/6 Fernando Franzine <fernandofranzine@...>
Of course it was !! Because you are generated "response.setContentType("application/x-java-jnlp-file");" jnpl response....
You can't do this,...unless you know how jnlp file work...lollll
You just need redirect (http 303) to adress that have o jnpl.....and let de browser do another request to web start server.

Fher

On Fri, Nov 6, 2009 at 11:20 AM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The method called (when a user clicks in link) is a void of my bean. This method redirect to JNLP file :

            ...
            ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();       
            HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
            HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
            request.setAttribute(...);
            ...
            ExternalContext extContext = (ExternalContext) FacesContext.getCurrentInstance().getExternalContext();
            ServletContext servletContext = (ServletContext) extContext.getContext();             
            ServletContext newcontext  = (ServletContext) servletContext.getContext("/my-tool");                   
            RequestDispatcher dispatcher = newcontext.getRequestDispatcher("/my-servlet-mapping");
            dispatcher.forward(request, response);
            FacesContext.getCurrentInstance().responseComplete();

A class is called using servlet mapping.This class extends HttpServlet and is a servlet that dynamically generates the JNLP file for clients:

            ...
            response.setContentType("application/x-java-jnlp-file");
            String jnlp = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><jnlp spec=\"1.0+\""+ " codebase=\""+ host + ":" + port + "/"+ "my-tool"+ "\">" ... + "<argument>"+ request.getAttribute(" ... ")+ "</argument>" + ...;
            out.println(jnlp);     
           
But, when a user clicks in link, the page prints the jnlp. My
application doesn't open with Java WebStart.

Any idea?


2009/11/3 Fernando Franzine <fernandofranzine@...>

That is the problem !! You can't ! Cause with ajax request you return xml responde to rendered some part of your page ! You can't link with ajax rquest....just http full request.

Regards

-
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com


On Fri, Oct 30, 2009 at 6:07 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The application works fine when I use jsf:
 <h:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

But if I replace with ajax4jsf:

<a4j:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

The page print the JNLP.

I think the tag is wrong. The code is right because the application works with jsf.

How to create a link using ajax4jsf that it will open my webStart application?!


Thanks!



2009/10/30 Fernando Franzine <fernandofranzine@...>
I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil




--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



-



--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil

Re: Help!

by Thomas Modeneis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If its generated dinamically you can set address on session, pass it by along session scope to another jsp who catch value and redirect to generated url.
Can i add your gTalk ?
Regards,
Thomas.

On Fri, Nov 6, 2009 at 5:00 PM, Claudia Roberta <claudia.icmc@...> wrote:
The problem is that there isn't a "static address" for the jnlp. Because it is generated dynamically and needs to redirect to a servlet
using some mapping. :-(



2009/11/6 Fernando Franzine <fernandofranzine@...>

Of course it was !! Because you are generated "response.setContentType("application/x-java-jnlp-file");" jnpl response....
You can't do this,...unless you know how jnlp file work...lollll
You just need redirect (http 303) to adress that have o jnpl.....and let de browser do another request to web start server.

Fher

On Fri, Nov 6, 2009 at 11:20 AM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The method called (when a user clicks in link) is a void of my bean. This method redirect to JNLP file :

            ...
            ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();       
            HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
            HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
            request.setAttribute(...);
            ...
            ExternalContext extContext = (ExternalContext) FacesContext.getCurrentInstance().getExternalContext();
            ServletContext servletContext = (ServletContext) extContext.getContext();             
            ServletContext newcontext  = (ServletContext) servletContext.getContext("/my-tool");                   
            RequestDispatcher dispatcher = newcontext.getRequestDispatcher("/my-servlet-mapping");
            dispatcher.forward(request, response);
            FacesContext.getCurrentInstance().responseComplete();

A class is called using servlet mapping.This class extends HttpServlet and is a servlet that dynamically generates the JNLP file for clients:

            ...
            response.setContentType("application/x-java-jnlp-file");
            String jnlp = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><jnlp spec=\"1.0+\""+ " codebase=\""+ host + ":" + port + "/"+ "my-tool"+ "\">" ... + "<argument>"+ request.getAttribute(" ... ")+ "</argument>" + ...;
            out.println(jnlp);     
           
But, when a user clicks in link, the page prints the jnlp. My
application doesn't open with Java WebStart.

Any idea?


2009/11/3 Fernando Franzine <fernandofranzine@...>

That is the problem !! You can't ! Cause with ajax request you return xml responde to rendered some part of your page ! You can't link with ajax rquest....just http full request.

Regards

-
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com


On Fri, Oct 30, 2009 at 6:07 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi!

The application works fine when I use jsf:
 <h:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

But if I replace with ajax4jsf:

<a4j:commandLink id="enterLink" action="#{Bean.join}" rendered="#{Bean.canJoin}">

The page print the JNLP.

I think the tag is wrong. The code is right because the application works with jsf.

How to create a link using ajax4jsf that it will open my webStart application?!


Thanks!



2009/10/30 Fernando Franzine <fernandofranzine@...>
I dont know if I understood well...but you should response a http response 303 to redirect to JNLP file....Cause JNLP is another request to another http server to start WS process.
Regards.

--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



On Fri, Oct 30, 2009 at 5:27 PM, Claudia Roberta <claudia.icmc@...> wrote:
Hi list!

I'm migrating a tool. The tool has Session-based and it was listed using h:commandLink when it used jsf:

<h:column>
     <f:facet name="header" >
	 <h:outputText value="#{msgs.items_title}"/>
    </f:facet>
    <h:commandLink id="enterLink" action="#{WbBean.join}" rendered="#{Bean.canJoin}">
	<h:outputText value="#{entry.title}"/>
    </h:commandLink>
    <h:outputText value="#{entry.title}" rendered="#{not Bean.canJoin}"/>
</h:column>	

When a user clicks in link, the action invokes a void method. This method prepares to send information to the servlet that will generate the JNLP file. So, an application open with Java WebStart.

I tried using a4j:commandLink, but it didn't open Java WebStart. A page was opened and the JNLP was printed.

Any suggestion?

Thanks


--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil




--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



-



--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



--
Fernando Franzini
Java Blog - http://fernandofranzini.wordpress.com



--
Claudia Roberta
Intermídia - ICMC/USP - São Carlos, SP - Brasil



--
Sun Certified Programmer for Java Platform, SE 5.0 – 310-055.
thomas.modeneis@...