Notepad servlet 2.1


It is a Java servlet lets you provide text editor for files in your web applications.

How to use it:

a) copy editPackage.jar into your WEB-INF/lib directory.

b) define EditServlet in your web.xml file:
 


    <servlet>
     <servlet-name>EditServlet</servlet-name>
     <servlet-class>com.jsos.edit.EditServlet</servlet-class>
    </servlet>

c) define a mapping:
 


    <servlet-mapping>
     <servlet-name>EditServlet</servlet-name>
     <url-pattern>/servlet/edit</url-pattern>
    </servlet-mapping>

Now you can use it. There is one GET parameter: f - describes your file: http://your_host/servlet/edit?f=your_file.

you can customize CSS settings and provide an initial parameter css describes your file with CSS settings. There your can customize look and feel for the following blogs:

#status - status message (file name)
#save - Save button
#close - Close button
#edit - Edit area. Default CSS style here is width:100%;height:90%

For example, the following code describes rounded corners for Save button:
 


#save
{
border:1px solid black;
-moz-border-radius: 6px; /* Firefox */
-webkit-border-radius: 6px; /* Safari */
border-radius: 6px;
}

An initial parameter close lets you customize exit action. By default servlet will close the window (edit page). You can describe here an URL for the redirection after closing the editor. An optional initial parameter dir lets you describe any existing directory on your server for your files. For example:
 


    <servlet>
     <servlet-name>EditServlet</servlet-name>
     <servlet-class>com.jsos.edit.EditServlet</servlet-class>
     <init-param>
      <param-name>close</param-name>
      <param-value>htpp://your_url_for_redirection</param-value>
     </init-param>
     <init-param>
      <param-name>css</param-name>
      <param-value>htpp://your_url_for_css_file</param-value>
     </init-param>
    </servlet>

In you JSP (and/or Coldfusion) pages you can use also Edit file taglib from Coldtags suite.
 

    For downloading:   editPackage.jar

This component is mobile friendly, so you can use it in your mobile HTML5 browsers too.

 © Coldbeans      Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: