title: Posting and fetching url parameters inside a jsp in struts
body: <p>I am trying to get the parameters of an url in a .jsp using struts lib and create a custom url for the action attribute of a form inside the jsp page using that parameter.</p>
  
  <p>JavaScript where parameter is populated:</p>
  
  <pre><code>function openNewWindow(qtype) {
      var x = screen.width / 3;
      var y = screen.height / 3;
  
      window.open('FileUpload.jsp?q=' + qtype, 'UploadExelSheet',
              'height=250,width=400');
  
  }
  </code></pre>
  
  <p>After redirection to FileUpload.jsp from the javascript,
  Sample url of the jsp page:
  <a href="http://localhost:8080/QuizApp/FileUpload.jsp?q=1" rel="nofollow">http://localhost:8080/QuizApp/FileUpload.jsp?q=1</a></p>
  
  <p>Here is what I have tried to fetch the 'q' value inside FileUpload.jsp and create the custom url for an action form:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;File Uploading Form&lt;/title&gt;
  &lt;meta http-equiv="refresh"
      content="${pageContext.session.maxInactiveInterval}; url=Timedout.jsp?type=timeout; charset=ISO-8859-1"&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;script src="js/myscript.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h3&gt;File Upload:&lt;/h3&gt;
      Select a file to upload:
      &lt;br /&gt;
      &lt;c:set var="qtype" value="uploadq?q=${q}" /&gt;
      &lt;s:url action="%{qtype}" var="myUrl"/&gt;
  
      &lt;s:form action="%{#myUrl}" method="post" enctype="multipart/form-data"&gt;
          &lt;input type="file" name="upload" id="uploadfile" size="50" /&gt;
          &lt;input type="submit" id="submit" /&gt;
      &lt;/s:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But it doesn't seem to work.</p>