File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Call to JSF experts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Call to JSF experts" Watch "Call to JSF experts" New topic

Call to JSF experts

Pallavi Roy
Ranch Hand

Joined: Jun 01, 2006
Posts: 37
Hi All,
I have included a servlet and JSF portlet in the same war file and deployed on Websphere Portal Server.
But currently the saving of the text area contents into word document is happening but it saves the entire portlet page instead of only the text area contents.I do not understand why my data is not getting printed.Please help me scrutinize this code.

1) JSF Portlet Page:

<h:inputTextarea id="text1" value="#{pc_TextAreaView.textAreaValue}" rows="10" cols="50" />
<h:commandButton id="save1" value="Save with Servlet" action="#{pc_TextAreaView.SaveAsWord}" />

2) Backing bean Save method:

3) Servlet to handle the saving in word document

Break the ice - SCJP 1.4,<br />Where There's a will- SCWCD 1.4.<br />Back in action - Websphere Certified Portal 6 Application Developer
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
<h:inputTextarea id="text1" value="#{pc_TextAreaView.textAreaValue}" rows="10" cols="50" />

ValueBinding vb = facesContext.getApplication().createValueBinding("#{pc_TextAreaView}");
TextAreaView mybean = (TextAreaView) vb.getValue(facesContext);

Shouldn't you get the value of "textAreaValue" from pc_TextAreaView?

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Pallavi Roy
Ranch Hand

Joined: Jun 01, 2006
Posts: 37
I have included the following step in my code.
String mytextarea = mybean.getTextAreaValue();

In my managed bean i have TextAreaValue as my property for which i have the setter and getter methods for this property.hence i am retreiving the value.

But there is a strange thing that i have discovered.
The response object which i have forwarded is already having the conetnt of my page embedded in it.So even if i try writing into it using response.getOutputStream(); it does not show any changes.
So when i run open my word file.The word doc is having the skeleton of my webpage and it searches for stylesheets .css when i try to open my saved word document.

Has anybody come across this before.This is really a driving me crazy for the past one week.

Best Regards,
I agree. Here's the link:
subject: Call to JSF experts
It's not a secret anymore!