开发者

how to get the source page which request other page in JSP

I have a form

<form name=frmMain method="POST"  action="processUpload.jsp" enctype="multipart/form-data">
<p align="center"><table border="1" align="center" width="90%" cellspacing="0" bordercolordark="white" bordercolorlight="black">
<tr>
<td width="261" height="111">
<table border="0" cellspacing="0px"  bordercolor="#B9B9B9" id="AutoNumber1" style="border-collapse: collapse" cellpadding="0px" align="left" width="100%" height="114">
    <tr>
        <td width="264" height="25" colspan="2" bgcolor="#FCDCA0">
<p align="left"><b><font face="Tahoma" size="2">&nbsp;</font><font face="Tahoma">Upload you excel file</font></b></p>

 </td>
    </tr>

    <tr>
        <td width="15px" height="23">
            <p align="right"  style="vertical-align: middle"><font face="Verdana" size="2"><b>&nbsp;File:&nbsp;</b></font>&nbsp; </td>
        <td width="300px" height="23">

            <p align="left">&nbsp;<input type="file" name="excelfile" size="40" >
        </td>
    </tr>

    <tr>
        <td width="15px" height="28">

                <p align="center"></td>
        <td  height="28">
                <p align="left">
                <input type="submit" name="p开发者_如何学编程rocess" value="Process">
        </td>
        </tr>
    </table>
    </td>
    </tr>
</table>
            </form>

I submit this form to prcessUpload.jsp in processUpload.jsp I do upload file, when upload file is finished, I want to redirect to source page which contains the form.

Problem: I want to make this processUpload.jsp generic, means I will reuse it in other web application. whatever page make a request to this jsp page, I will have the exact name of the source page.

any suggestions or solutions. Thanks in advance.

NathanPhan


I would add a hidden argument to the URL in the form that tells the uploadFile.jsp where to go back to when it is done. You'd need to add a button or some javascript to the uploadFile page to make this happen at the appropriate time.

Another option would be for the JSP to pick up the redirect location from some a server-side configuration file; e.g. via the servlet context parameters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜