0

in html body

    <form method="get" action="MovieTiming.jsp">
        <table  cellspacing="0" cellpadding="0" border="2" style="width:50%; height:   400px;" bgcolor="pink">
            <tr style="height:4px;">
                <td id="Date" colspan="5">
                    Please input date (yyyymmdd)<input  name="Date" type="text" size="8" maxlength="8" value="<%=date%>"></input>
                    <button type="submit" value="Submit">Get Movies List</button>     
                </td>        
                <td>
                   <button   onclick=fileWrite();>save file</button>
                   <input type="file" id="loc" name="loc" >[/B]</input>


                </td>        
            </tr>
            <tr bgcolor="white">
                <td id="output" colspan="10" style="height:400Px;">&nbsp;</td><td><textarea id="out" name="out" rows=20 cols=20 ></textarea></td> 
            </tr>
        </table>
        </form>




function fileWrite
{
<%
            String loc  = request.getParameter("file");
            String func = request.getParameter("out");
            if(func!=null)
            {

                File strFile        = new File(loc);
                Writer objWriter    = new BufferedWriter(new FileWriter(strFile));
                objWriter.write(func);
                objWriter.flush();
                objWriter.close();
            }
            %>
}

but this code is throwing exception whenever i click on save as button says that no such file exist.
is there any other way of write data to the file using html javascript or jsp(embed in html)
prefer javascript

please help
please help

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by DangerDev
0

check the location, may be there is some permission problem in server, there u have to put file read/write permission some time.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.