Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adding javascript into Help Webapp
icon8.gif  Adding javascript into Help Webapp [message #554495] Mon, 23 August 2010 11:54
Remo Blaser is currently offline Remo BlaserFriend
Messages: 9
Registered: August 2010
Junior Member

I am trying to add a tinymce WYSIWYG Editor into the Eclipse Webapp.
I customized Help so i can press a "edit" Button to edit the Content which is shown at the moment.
Now i get the Problem to import the .js File.

If the "edit" button is pressed, a Servlet called ChangeServlet is called, this Servlet looks like this:



import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ChangeServlet extends HttpServlet {

	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// Getting the Path of the HTML File
		String incomingPath = req.getParameter("path");
		// Changing Path to open it
		String preparedPath = incomingPath.replace(
				"", "C:/dev/java/pf51-13");
		// Öffne das HTML File

		File html = new File(preparedPath.replace("?path=0_11#Chapter12", "").replace("?path=0_11", ""));
		FileReader fr = new FileReader(html);
		BufferedReader br = new BufferedReader(fr);
		String htmlString = "";
		String line;
		// Reading HTML File
		while ((line = br.readLine()) != null) {
			htmlString += line;
		// Getting content out of the HTML File
		String body = htmlString.substring(htmlString.lastIndexOf("</h1>") + 5,
		// Getting title out of the HTML File
		String title = htmlString.substring(htmlString.lastIndexOf("<h1>") + 4,
		// implement js and show textareas to edit
				.print("<html><head><script type='text/javascript' src='C:/dev/java/pf51-13/'></script>" +
						"<script type='text/javascript'>" +
						"tinyMCE.init({" +
						"mode : 'textareas'," +
						"theme : 'advanced'" +
						"});" +
				.print("<body><form method='GET' action='/help/save'><h2>Titel</h2><br /><textarea name='title'>"
						+ title
						+ "</textarea><br /><br /><h2>Inhalt</h2><br /><textarea name='text'>"
						+ body
						+ "</textarea><input type='submit' value='Speichern' /><input type='hidden' name='html' value='"
						+ htmlString
						+ "' /><input type='hidden' name='path' value='"
						+ incomingPath
						+ "'><input type='hidden' value='"
						+ title
						+ "' name='oldtitle' /><input type='hidden' value='"
						+ body + "' name='oldtext' /></form></body></html>");


Now i got my problem, the Webapp can't find the tiny_mce.js file, even if i copy it into the same folder and changing the path in the <style> tag.

Hope i can reach some help here.


[Updated on: Mon, 23 August 2010 13:33]

Report message to a moderator

Previous Topic:context sensitive help with eclipse infocenter
Next Topic:Extension point selection - adding new extensions
Goto Forum:

Current Time: Sun Jun 24 11:29:22 GMT 2018

Powered by FUDForum. Page generated in 0.01961 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top