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
Yes. I see, that you don't see my problem
If you are acquainted with Struts2, you know that there are "struts-tags" (usually with a prefix s:) and "struts-dojo-tags" (usually with a prefix sx:). And I am using sx (Dojo) and only in this case submiting form FCKeditor does not POST data. If I use s: submit it submits correctly. But in my framework I have to use Dojo. There is a possibilty to use s:submit, but then I loose advantages of targets, because I have to reload the whole page.
So the solution would be to "connect" the instanceName with the variable declared in Action class, but I don't know where or how to do that.
Re: Start with Struts2 + FCKeditor
Re: Start with Struts2 + FCKeditor
Yes it is. I just hoped, that anynone knows the solution
Re: Start with Struts2 + FCKeditor
Ok... I have done some investigation
I have noticed, that on submit, some of the content of the generated iframe is:
Re: Start with Struts2 + FCKeditor
JSP:
Javascript:
Of course you have to have String variable editField in your ActionClass.