aspose file tools*
The moose likes Spring and the fly likes Rich Text Area using TinyMCE in Spring MVC application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Rich Text Area using TinyMCE in Spring MVC application" Watch "Rich Text Area using TinyMCE in Spring MVC application" New topic
Author

Rich Text Area using TinyMCE in Spring MVC application

sajjad ahmad
Ranch Hand

Joined: Jan 23, 2003
Posts: 78

I have created an MVC applicaiton using ROO , I am trying to use a rich text area in my creat.jspx page. I am using TinyMCE.

The Java script files are attached correctly but it looks like spring mvc tag for area is not accepting the effects tinyMCE library is trying to apply on it because I still see a normal text area.

I also tried tinyMCE ina separte Web applicaiton (j2ee) and can see the desired rich text area when using it from a jsp page.

I have a feeling that somehow the spring mvc tag is forcign it's own css and java scripts on text area and overriding TinyMCE in this case.

This is now pissing me off , I have no clue why this is happening. Cna any body out there help me to understand whats going on here?


Regards,
Sajjad Ahmed Paracha

My Technical Blogs
J2EE Frameworks : http://comparingexsitingj2eeframeworks.blogspot.com/
Adobe Flex : http://adobeflexandj2ee.blogspot.com/
JAVA : http://javaiscoool.blogspot.com/
Design Pattern : http://designpatterndiscussions.blogspot.com/

“Only as high as I reach can I grow, only as far as I seek can I go, only as deep as I look can I see, only as much as I dream can I be.” Karen Ravn
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

Please BeForthrightWhenCrossPostingToOtherSites
http://forum.springsource.org/showthread.php?132867-Rich-Text-Area-using-TinyMCE-in-Spring-MVC-application&p=432120#post432120


[How To Ask Questions][Read before you PM me]
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

You have not given anyone much information to work with, so the amount of help anyone can give is limited. Try viewing the rendered HTML in Firebug and maybe you can tell better what is happening. There are lots of results on a Google search of TinyMCE and Spring MVC below are the first few.


http://www.tinymce.com/forum/viewtopic.php?id=27106
http://blog.benkuhl.com/2012/05/tinymce-spellcheck-implmentation-with-spring-mvc/
http://webknox.com/q/with-tinymce-how-to-make-a-rich-text-editor-coexist-with-another-textarea
sajjad ahmad
Ranch Hand

Joined: Jan 23, 2003
Posts: 78
p


Bill gorder, thanks for your reply. I have posted same question on multiple forums hoping i can get quick help. That should not be a problem, If I find a solution on one thread i willupdate the other thread accordingly.
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

sajajad,

If I find a solution on one thread i willupdate the other thread accordingly.


Thanks for doing that. The other part we ask for is just a link to the other cross posted threads. What this allows us to do is look and see what kind of advice (working or not) that has already been given. This way we are not spending our time repeating the same efforts as others. I hope that makes sense.

Did you get a chance to take a look at the outputted HTML? This is often the best way to find out exactly what is causing the problem.
sajjad ahmad
Ranch Hand

Joined: Jan 23, 2003
Posts: 78
Let me give you more details about it , I am writing the below code in spring roo generated application to load the desired js file in my application



on run time in html code I can see the js file in being included correctly (the path is correct) , but I don't see the alert messages , however if I remove line


I can see the alert messages , which means there is some problem when spring is trying to load the js file however I don't see any error both on server console or at browser.

I am almost cluless here that whats going wrong at this point.

Below is the code generated for the page where I am including the js file


and the html code for text area where I can't see this whole rich text box thing being applied is


sajjad ahmad
Ranch Hand

Joined: Jan 23, 2003
Posts: 78
Ah , finally resolved the problem. It was the most stupid problem I ever had and it watsed my whole weekend :s.

I found the solution from following website
http://stackoverflow.com/questions/8303050/including-js-files-jquery-in-jspx-files

he problem was apparently the way script tag has to be written in application meant to run on IE I was using the below java script include


The solution ws to write it like



Below I am copying some stuff from that web site

JSPX has the quirky behaviour that it auto-collapses tags without body. So effectively
<script type="text/javascript" src="route/to/scripts/jquery.js"></script>
<script type="text/javascript" src="route/to/scripts/jquery.ui.js"></script>
<script type="text/javascript" src="route/to/scripts/something.js"></script>
will end up in browser as
<script type="text/javascript" src="route/to/scripts/jquery.js" />
<script type="text/javascript" src="route/to/scripts/jquery.ui.js" />
<script type="text/javascript" src="route/to/scripts/something.js" />
which is invalid <script> syntax (rightclick page in browser and do View Source to see it yourself). The browser behaviour is undetermined.

You can workaround this by putting a <jsp:text /> between the tags
<script type="text/javascript" src="route/to/scripts/jquery.js"><jsp:text /></script>
<script type="text/javascript" src="route/to/scripts/jquery.ui.js"><jsp:text /></script>
<script type="text/javascript" src="route/to/scripts/something.js"><jsp:text /></script>


Please go to the mentioned website for the details.
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

Glad you got this resolved. Thanks for posting back with the solution.
 
jQuery in Action, 2nd edition
 
subject: Rich Text Area using TinyMCE in Spring MVC application