Hi Pallavi,
 
I use Liferay on Tomcat. The servlet I included within my portlet war.
Not in a separate war.
 
Sorry for my short answer, but we have currently system tests with our
customer...
 
Regards, Stephan

________________________________

Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 22. November 2006 08:08
An: [email protected]
Betreff: RE: response.Header() not working in JSF Portlet


Hi Stephan,
                 
                 My concepts are not very clear regarding the portal
server.
                 I am using RAD as my IDE and Wepsphere portal server
and application server(WAS).
                 Which Portal server are you using.Are you using the
same combination.
                 I wanted to know whether you are creating a seperate
war file to deploy your servlet on WAS.
                 Then invoking a call to your servlet from your portlet.
                 Can you show me some light on this grey area.
 
Best Regards,
Pallavi

________________________________

From: Strittmatter, Stephan
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 21, 2006 9:29 PM
To: MyFaces Discussion
Subject: AW: response.Header() not working in JSF Portlet


Hi Pallavi,
 
within a portlet it is not allowed to chenge the response header.
Otherwise a portlet would damage the portal around your portlet.
 
I had this problem also and created a servlet, which I assigned with the
special extention. The only problem was, that I had to include the part
in a verbatim tag to have a form with an own defined target probably
there is a different more elegant way...:
 
<f:verbatim>

<form action="${request.contextPath}/download.xml" target="_blank"
method="post">

<input type="submit" value="Download" title="Download XML file"
id="execute" style="width:7em;" class="portlet-form-button" /> 

<input type="hidden" name="execute" value="execute" />

</form>

</f:verbatim>



In the web.xml you have to define then the servlet and assign it to the
extention.
 
In the servlet you can access the backing bean by following to get some
values:
 
FacesContext c = FacesContext.getCurrentInstance();

Application application = c.getApplication();

MyBackingBean bBean= (MyBackingBean)
application.createValueBinding("#{MyBackingBean}").getValue(c);

 
Regards,
 
Stephan
________________________________

Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 20. November 2006 12:25
An: [email protected]
Betreff: response.Header() not working in JSF Portlet


Hi All,
         I have a JSF portlet where i want to save the contents of my
Text area on the click of a button to a word document.
         (IBM Websphere portal)
 
     <h:inputTextarea id="text1"
value="#{pc_TextAreaView.textAreaValue}" rows="10" cols="50" />
     <h:commandButton id="save" value="Save As Word"
action="#{pc_TextAreaView.SaveAsWord}"/>
 
In my page bean i have written the follwoing code but the
response.setHeader() doesn't seem to work.
I am not getting any pop dialog and i cannot save my file.
Please let me know what is wrong in this code snippet.How can i make it
work in my portlet.
 
========================================================================
=======
 
public String SaveAsWord() {
  
  FacesContext context = FacesContext.getCurrentInstance();
  HttpServletResponse response =
(HttpServletResponse)context.getExternalContext().getResponse();
  response.setContentType("application/vnd.ms-word");
     response.setHeader("Content-Disposition", "attachment;
filename=myfile.doc"); 
     response.setHeader("Cache-Control", "no-cache");
     try{
     byte[] buf=new byte[4*1024];
     InputStream inStream=new
ByteArrayInputStream(textAreaValue.getBytes());
     OutputStream outStream=response.getOutputStream();
     int sizeRead;
     while ( ( sizeRead=inStream.read(buf, 0, buf.length) ) != -1 )
       {
       outStream.write(buf, 0, sizeRead);
       }
     inStream.close();
     outStream.close();
  }
     catch(IOException ex){
      ex.printStackTrace();
      }
     return null;
  }
 
Best Regards,
Pallavi 

  

The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.

www.wipro.com
        

The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.

www.wipro.com
        

Reply via email to