Retrieving parameters in URL with Java

java, parameters, servlets, url

Solution

In SERVLET must be request, yes?

String xml_path= request.getParameter("xml");

String xsl_path=request.getParameter("xsl");

Problem

I have a little Servlet that uses XSL and XML to generate PDF. Since I want to specify the files via URL I need to get those Parameters from there: ``` localhost/Servlet?xml=c:\xml\test.xml&xsl=c:\xsl\test.xsl ``` so the parameters that I need are ``` c:\xml\test.xml c:\xsl\test.xsl ``` and those need to be read into the variables xml-file and xsl-file. I have this but that doesn't really help me I guess since I don't know how to apply the values into the variables: ``` Map para = request.getParameterMap(); java.util.Iterator it = params.keySet().iterator(); while ( it.hasNext() ) { String key = (String) it.next(); String value = ((String[]) para.get( key ))[ 0 ]; } ``` Any idea on how to do that? Thanks, TheVagabond

Original source