HVP pilot add functionality (build servlet in molgenis)
In order to proper present your data from a javascript call (in a plugin) you need a servlet :
- Add in model the function :
- * public String getCustomHtmlHeaders()
- {
- return "<script src=\"res/scripts/lib.js\" language=\"javascript\"></script>\n" +
- "<script src=\"Prototype/prototype.js\" language=\"javascript\"></script>\n" ;
- }
- Place the javascript file in the referred location. In the ftl file call the function as onclick="RestJsonDatafromOntocat(InputTerm?)" not as onclick="__action.value='SubmitTerm?' . The second is used for function inside the model.
- Arguments from the .ftl file can be reached through arguments
- Add in web.xml the declaration of the servlet
- <servlet>
- <servlet-name>AddEventMenuServlet?</servlet-name>
- <servlet-class>servlets.AddEventMenuServlet?</servlet-class>
- </servlet>
- <servlet-mapping> <servlet-name>AddEventMenuServlet?</servlet-name>
- <url-pattern>/AddEventMenuServlet?</url-pattern>
- </servlet-mapping>
- <servlet>
- Create directory & file for servlet ( /hvp_pilot/handwritten/java/servlets/SearchJsonServlet.java )
- Incude the necessary :
- * package servlets;
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.apache.log4j.Logger;
- import org.molgenis.util.HttpServletRequestTuple;
- import org.molgenis.util.Tuple;
- IS this the minimum/optimal set???
- What about throws ServletException, IOException....?
- What about doGet & doPost? http://www.molgenis.org/browser/molgenis2_test/src/handwritten/RESTServlet.java?rev=1473
Last modified 14 years ago
Last modified on 2010-10-01T23:19:13+02:00