Q:

JAVA - Is there possible pass a servlet value received to a .java file, but in another project?

good afternoon. I have a .JSP file that send a value to a servlet file. I have another project, where there is a java file in that i want to get this servlet value received by .JSP file.
My question is if is there possible pass this servlet value to this .java file in another project ? Or can i send by .JSP file directly ?
I created a Java Class in my Web Application, but now, how can i pass the servlet parameter to this java class ?
I will put the code down here:
Servlet code:
public class ServletJava extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     response.setContentType("text/html;charset=UTF-8");

     /*I WANT TO INSTANCE THE PARAMETER HERE TO SEND TO OTHER CLASS*/
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    public String getServletInfo() {
        return "Short description";
    }

}

The Class java:
public class RecebeServlet {
     public static void main(String[] args) throws Exception {
      /*I WANT RECEIVE THE PARAMETER HERE !! */
   }
}

A:

It is probably bad practice to have a class with only one main mathod. I am sure that you can divide the logic from that class into several methods instead of having one giant main.
But anyway, since you asked: Just call your main method as you would call any static method:
String[] args = new String[1];
args[0] = yourValue;
RecebeServlet.main(args);

But again, please consider refactoring your RecebeServlet class. You do not want to have program logic in your main method.

