Hi, I have the following requirement. I need to pass parameters from html page to batch file which in turn passes the paramter to xml file.I need to know how to pass parameters from html to batch file and from batch file to xml file Thanks
Are the batch file and xml file client or server side?
Either way you will need to add some script to the html file. Or even use server side scripting to generate the html...
What kind of "parameters"? What kind of "html page"? What kind of "batch file"? What kind of "xml file"?
Assuming that you mean that data from a HTML form should be processed by a batch file and written to disc as XML:
- Data from HTML forms is always processed using the CGI protocol, and it's possible to do it with a batch script, probably even a Windows batch file.
- However, this is going to be extremely uncomfortable, error-prone and insecure. It's much better to have a language or framework specifically geared towards web applications handle the low-level CGI stuff for you.
- Common choices are: PHP, Perl, Java servlets or ASP.
- While it's possible to write XML simply by outputting strings, you're virtually guaranteed to get malformed XML eventually.
- It's much better to use a real XML framework to produce the XML - there are several to choose from for pretty much any language worth using.
m.mahesh.2000, it might be worth you drawing a little diagram of the various parts of the puzzle. HTML and XML files are not programs!
Consider these possible diagrams:
CGI Approach:
+--------------+ +----------------+
| Browser | | Web Server |
| | | (eg: Apache) |
| +----------+ | | +------------+ |
| |HTML | | --> | | CGI | |
| |Javascript| | | | | |
| +----------+ | | | +-------+ | |
+--------------+ | | | Perl | | |
| | +-------+ | |
| +------------+ |
+----------------+
Servlet Container Approach:
+--------------+ +------------------+
| Browser | | Tomcat |
| | | |
| +----------+ | | +-------------+ |
| |HTML | | --> | | Servlet | |
| |Javascript| | | | Container | |
| +----------+ | | | +---------+ | |
+--------------+ | | | Servlet | | |
| | +---------+ | |
| +-------------+ |
+------------------+
The browser renders your HTML, executes any javascript, and sends HTTP requests to your server - be this Apache, Tomcat, or other? Do you know what kind of server you have?
Apache spawns child CGI processes to act on certain HTTP requests. CGI processes are typically PHP or Perl scripts.
Tomcat has a number of threads to act on HTTP requests. Some requests are handled by Servlet instances hosted within a Servlet container.
Either the CGI process, or the servlet, will do the work of creating your XML file on the server, and contacting your database.
Hope this helps.