Webアプリの作成において困っていることがあります。
それは、
lang
1<form action="◯◯" method="POST" name="form1"> 2<input type="hidden" name="□□" value="${ △△ }"> 3</form> 4••• 5<a href="" onclick="document.form1.submit(); return false;"> 6••• 7</a>
というコードがあり、
<a>タグで囲まれた部分をクリックすると、
もう少し、具体的に申しますと、
まず、コードですが下記になります。
lang
1<form action="YourSelectEngineer?switch=MatchingDetailEngineer" method="POST" name="form1"> 2 <input type="hidden" name="engineerid" value="${ engineerlist.engineerid }"/> 3 </form> 4 <div class="row p-profile_box_white"> 5 <div class="col-md-12 c-matching_box"> 6 <a href="" onclick="document.form1.submit(); return false;"> 7 <div class="c-matching-leftbox c-center"> 8 <div class="c-photobox "> 9 <img src="${ engineerlist.photo }" class="img-circle c-photo"><br> 10 </div> 11 <div class="c-name"> 12 <p>${ engineerlist.name }(${ engineerlist.age })</p> 13 </div> 14 </div> 15 </a> 16 17 <div class="c-matching-rightbox"> 18 <nav class="c-position"> 19 <ul class="nav nav-stacked "> 20 <li class="c-matchingbox_info"><img src="image/minicompany_logo.png" class="c-mini_logo"> 21 <c:if test="${ engineerlist.projectmanager == true }" var="projectmanager"/> 22 <c:if test="${projectmanager}">プロジェクトマネージャー<br></c:if><c:if test="${!projectmanager}"></c:if> 23 <c:if test="${ engineerlist.projectleader == true }" var="projectleader"/> 24 <c:if test="${projectleader}">プロジェクトリーダー<br></c:if><c:if test="${!projectleader}"></c:if> 25 <c:if test="${ engineerlist.engineer == true }" var="engineer"/> 26 <c:if test="${engineer}">システムエンジニア<br></c:if><c:if test="${!engineer}"></c:if> 27 <c:if test="${ engineerlist.programer == true }" var="programer"/> 28 <c:if test="${programer}">プログラマー<br></c:if><c:if test="${!programer}"></c:if> 29 <c:if test="${ engineerlist.director == true }" var="director"/> 30 <c:if test="${director}">ディレクター<br></c:if><c:if test="${!director}"></c:if> 31 <c:if test="${ engineerlist.coder == true }" var="coder"/> 32 <c:if test="${coder}">コーダー<br></c:if><c:if test="${!coder}"></c:if> 33 <c:if test="${ engineerlist.designer == true }" var="designer"/> 34 <c:if test="${designer}">デザイナー<br></c:if><c:if test="${!designer}"></c:if> 35 <c:if test="${ engineerlist.tester == true }" var="tester"/> 36 <c:if test="${tester}">テスター<br></c:if><c:if test="${!tester}"></c:if> 37 </li> 38 <li class="c-matchingbox_info"><img src="image/ministation_logo.png" class="c-mini_logo"> ${ engineerlist.years_of_experience }年</li> 39 <li class="c-matchingbox_info"><img src="image/miniindustry_logo.png" class="c-mini_logo"> ${ engineerlist.introduction }</li> 40 </ul> 41 </nav> 42 </div> 43 </div> 44 </div>
なお、<form>内で<input type="submit">するとエラーは出ずに成功します。
因に、エラーは下記の通りです。
重大: サーブレット /Callback のServlet.service()が例外を投げました
java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/oauth/
エラー該当箇所は下記の通りです。
lang
1//アクセストークンを取り出す 2 final String accessTokenURL = 3 "https://graph.facebook.com/oauth/access_token?client_id=" 4 + appId 5 + "&redirect_uri=" 6 + URLEncoder.encode(callbackURL, "UTF-8") 7 + "&client_secret=" 8 + appSecret 9 + "&code=" 10 + URLEncoder.encode(code, "UTF-8"); 11 final String accessTokenResult = httpRequest(new URL(accessTokenURL)); 12 13 String httpRequest(URL url) throws IOException { 14 HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 15 conn.setDoOutput(true); 16 conn.setUseCaches(false); 17 conn.setRequestMethod("GET"); 18 BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); 19 String line = null; 20 String response = ""; 21 while ((line = reader.readLine()) != null) { 22 response += line; 23 } 24 reader.close(); 25 conn.disconnect(); 26 return response; 27 }
final String accessTokenResult = httpRequest(new URL(accessTokenURL));
でエラーが出ているようです。
しかし、<input type="submit">では正常に動作しているので、
原因がよくわかりません。
何故、<a>タグですとエラーが出てしまうのでしょうか?
ご回答の程よろしくお願い致します。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。