views:

1023

answers:

3

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

A: 

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...

jheriko
The batch file and xml file are present in the server.I need to pass the paramaters from the client side to server sile. Can i sample for that if you dont mind
the other answer on here addresses that. i'm not going to do the work for you, but suffice it to say, its easy when you have the right tools.
jheriko
+3  A: 

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.
Michael Borgwardt
The batch file just sets the classpatha and calls the xml file which is already there. The xml will plot the graph according to the dates selected by the user. So these dates i need to pass to the batch file and inturn pass to the xml file
XML files are data. They cannot be called, they cannot plot graphs, and they don't have a classpath. Please give a more detailed explanation of your environment - and do it by editing your question, don't add it to the comments.
Michael Borgwardt
the xml file inturn connects to the database and calls the software which is responsibe to plot the graphs
XML files cannot connect to databases or call other software either. Whatever you have there, it's not simply an XML file, and what it is needs to be explained in the question if you want to have any chance to get it answered.
Michael Borgwardt
+3  A: 

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.

toolkit