JSP - how to call the java application

I have a java applicaiton which needs two parameters in order to generate the XML file and send the XML file to the client via http post. This works.

Now i want to initiate the process via JSP.
Should i use JSP servlet or something..
JSP invoke a java class which no paremeter is required, isnt it?

please advise what is the best to do.
A very simple example would be very appreicated.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use struts.
When you click a button in your jsp , it will invoke a java class(In struts terminology, this java class is called Action Class)

see this example

In the above tutorial, index.jsp is the jsp page which invokes the java class NameAction.java (the Action Class).


>>>>JSP invoke a java class which no paremeter is required, isnt it?

since  you are using 2 parametres in your java class to generate the xml, you can pass those two parametres from the jsp (thats one option).  In that case , you have to store those two parametres in something called Form-Bean (in the above application , it is NameForm.java)

If you do not want to pass any parametres from jsp, thats fine as well. In that case you are getting those two parametres in your java class from some other source like request or session or hardcoded values.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
May be have a html with a Link/Button & submit the page to a Servlet.

In the Servlet doPost method call the routine that you wish.

Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Servlet methods:

protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
      doPost(arg0, arg1);
protected void doPost(HttpServletRequest req, HttpServletResponse arg1) throws ServletException, IOException {
      String param1 = req.getParameter("param1");
      String param2 = req.getParameter("param1");

<form name="frm" method="POST" action="/UrlMappedToServlet" >
<input type=text name="param1" value=""/>
<input type=text name="param2" value=""/>

<input type=submit name="submit" value="submit"/>


you can use the JNLP protocol to download the standalone program fromt he url

eg http://localhost:8080/abc/APPLICATION.jnlp

you have to have a JNLP xml file contains the jars, war files which are to be downloaded.

Have a look at JNLP

This would be a start for you

LeanMoreTryMoreAuthor Commented:
Thanks you guys info.
Thats enough for me to go on.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.