Hey!
I have succesfully integrated FCKeditor editor into Struts2. But now I don't know how to post data to action...
My JSP looks something like that:
My Action class looks like this:
And I am only getting back the first value (<%=request.getAttribute("contentVOcontent") %>), not the changed one...
For example, if my value on opening the editor is:
First value
after I submit the form, I get printed out
First value
First value
I guess that it is something because Struts2 sx tag does not submit data?? How could I work around this??
I saw in some cases on forums, that they have FCKeditor without instanceName attribute - is this the case? Where do I get this kind of tag?
I have succesfully integrated FCKeditor editor into Struts2. But now I don't know how to post data to action...
My JSP looks something like that:
<s:form action="MenuAdmin-submitContent" namespace="/admin" method="post" enctype="multipart/form-data">
<FCK:editor instanceName="editField" height="500px" width="99%" >
<jsp:attribute name="value"><%=request.getAttribute("contentVOcontent") %>
</jsp:attribute>
</FCK:editor>
<sx:submit
id="button_submit"
name="button_submit"
cssClass="buttonSubmit"
value="Submit"
targets="layout-content"
indicator="ajaxIndicator" />
</s:form>
My Action class looks like this:
private String editField;
public String submitContent() {
String content = request.getParameter("editField");
System.out.println("content="+content);
System.out.println("editField="+editField);
return SUCCESS;
}
public String getEditField() {
return editField;
}
public void setEditField(String editField) {
this.editField = editField;
}
And I am only getting back the first value (<%=request.getAttribute("contentVOcontent") %>), not the changed one...
For example, if my value on opening the editor is:
First value
after I submit the form, I get printed out
First value
First value
I guess that it is something because Struts2 sx tag does not submit data?? How could I work around this??
I saw in some cases on forums, that they have FCKeditor without instanceName attribute - is this the case? Where do I get this kind of tag?

Re: Start with Struts2 + FCKeditor
Don't you see the source you have set as the value attribute or don't you get the posted value from the editor content?
Maybe you have seen those sample tags w/o instanceName but they are simply erronous. You need the attribute to have a POST input tag for the servlet. I declared the instanceName as mandatory for a good reason in the TLD.
Make sure that you check out our sample war. There you have a working POST jsp.
Re: Start with Struts2 + FCKeditor
The problem is, that I am using <sx:submit> which is an ajax post, and not a <s:submit>. In second way I get the posted value, but then I can not use Struts's targets (only one div gets refreshed).
I understand that instanceName is mandatory for a good reason, I just thought that somebody already made new TLD with id, which would be connected with a variable declared in Action class.
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
JSP:
<s:form action="Admin-submitContent" namespace="/admin" onsubmit="checkFCK('editField')" > <FCK:editor instanceName="editField" height="500px" width="99%" toolbarSet="Amplio"> <jsp:attribute name="value"><%=request.getAttribute("content") %> </jsp:attribute> </FCK:editor> <sx:submit id="button_submit" name="button_submit" cssClass="buttonSubmit" value="Submit" targets="layout-content" indicator="ajaxIndicator" afterNotifyTopics="/ajaxAfter" /> </s:form>Javascript:
function checkFCK(field){ var fckcontent = FCKeditorAPI.GetInstance(field).GetXHTML(); document.getElementById(field).value = fckcontent; }Of course you have to have String variable editField in your ActionClass.