uCosminexus Portal Framework ポートレット開発ガイド
文書管理システムを構築する場合,ファイルをサーバにアップロードする必要があります。ポートレットでは,通常のWebでファイルをアップロードするのと同様に,ファイルをアップロードできます。
ファイルをアップロードするポートレットを次に示します。
- {PROJECT_HOME}\portlets\fileupload\index.jsp
<%@ taglib uri="http://soft.hitachi.co.jp/portal/urlutils" prefix="uu" %> <%@ page contentType="text/html; charset=Shift_JIS" %> <uu:form action="upload.jsp" enctype="multipart/form-data" method="POST"> アップロードするファイル:<br> <input type="file" name="Uploaded file"> <input type="submit" value="アップロード"> </uu:form>
- {PROJECT_HOME}\portlets\fileupload\upload.jsp
<%@ taglib uri="http://soft.hitachi.co.jp/portal/urlutils" prefix="uu" %> <%@ page contentType="text/html; charset=Shift_JIS" %> <% try { String ct = request.getHeader("Content-Type"); String mimeType = ct.substring(0, ct.indexOf(";")).trim(); if (mimeType.equals("multipart/form-data")) { String boundary = ct.substring(ct.indexOf("boundary=")+9, ct.length()); // ファイルを取り出して必要な処理をする。 } else { new Exception("Unsupported MIME type"); } // 受け付け画面生成 } catch (Exception e) { // エラー画面生成 } %>
All Rights Reserved. Copyright (C) 2009, 2013, Hitachi, Ltd.
All Rights Reserved. Copyright (C) 2009, 2013, Hitachi INS Software, Ltd.