Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何通过单击受保护共享文件夹中jsp的链接打开文件?_Java_Jsp_Struts_Jcifs - Fatal编程技术网

Java 如何通过单击受保护共享文件夹中jsp的链接打开文件?

Java 如何通过单击受保护共享文件夹中jsp的链接打开文件?,java,jsp,struts,jcifs,Java,Jsp,Struts,Jcifs,我尝试使用JCIFS(SmbFile)概念在受保护的共享文件夹上编写文件。以下是我尝试并成功在受保护文件夹上写入文件的代码段: String username = "username"; String password = "password"; String protectedFolder = "smb://machineName/protectedFolderName"; String fileName = "SampleFile.xls"; String filePath = protec

我尝试使用JCIFS(SmbFile)概念在受保护的共享文件夹上编写文件。以下是我尝试并成功在受保护文件夹上写入文件的代码段:

String username = "username";
String password = "password";
String protectedFolder = "smb://machineName/protectedFolderName";
String fileName = "SampleFile.xls";
String filePath = protectedFolder + fileName;
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(username  + ":" +   
password);
SmbFile protectedFile = new SmbFile(strTemplate, auth);
SmbFileOutputStream fileOut = new SmbFileOutputStream(protectedFile);
wb.write(fileOut);
fileOut.close();

The above code successfully creates 'SampleFile.xls' in the protected folder.
如果我想通过单击链接(href)从jsp页面打开该文件,我如何执行上述JCIFS身份验证? 对此的任何想法都是值得赞赏的


谢谢

我想你可以创建一个简单的Servlet来为你做这件事?是的!我正在尝试。我会更新状态。