0

データベースからパス内の Web アプリケーションのフォルダーに写真をコピーしています/WebContent/images/temp/nn.png

私のディレクトリ構造は

friendit/
     WebContent/
               images/
                     temp/
                            nn.png

私のWebアプリケーションのコントローラーアクションクラスからフォルダーfriendit/webcontent/temp/nn.pngに画像を保存していますが、fileNotFound例外が発生します

相対パスに問題があります! どの相対パスを使用すればよいか教えてください

4

1 に答える 1

1

BLOB タイプをデータベースからハードディスクに直接保存することはできません

これを使ってみて、

                Blob test=userInfo.getPicture(); //take blob form sql in test variable
                InputStream x=test.getBinaryStream();
                int size=x.available();




                outputStream=new FileOutputStream("./WebContent/images/temp/nn.png");
                byte b[]= new byte[size];
                x.read(b);
                outputStream.write(b);
于 2013-04-11T07:39:10.267 に答える