Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call to JSF experts

 
Pallavi Roy
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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?
 
Pallavi Roy
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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,
Pallavi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic