鍍金池/ 問答/Java  HTML/ 字符串中的html代碼中夾雜了jsp代碼,如何獨(dú)立顯示jsp的部分

字符串中的html代碼中夾雜了jsp代碼,如何獨(dú)立顯示jsp的部分

clipboard.png

圖片中的圈圈就是我的問題,兩個(gè)form表單,第二個(gè)表單是我動(dòng)態(tài)生成的。生成的代碼如下:

if(para.dragDrop){
                // 創(chuàng)建帶有拖動(dòng)的html
                html += '<form id="uploadForm" action="'+para.url+'" method="post" enctype="multipart/form-data">';
                html += '    <div class="upload_box">';
                html += '        <div class="upload_main">';
                html += '            <div class="upload_choose">';
                html += '                <div class="convent_choice">';
                html += '                    <div class="andArea">';
                html += '                        <div class="filePicker">點(diǎn)擊選擇文件</div>';
                html += '                        <input id="fileImage" type="file" size="30" name="fileselect[]" '+multiple+'>';
                html += '                    </div>';
                html += '                </div>';
                html += '                <span id="fileDragArea" class="upload_drag_area">或者將文件拖到此處</span>';
                html += '            </div>';
                html += '            <div class="status_bar">';
                html += '                <div id="status_info" class="info"></div>';
                html += '                <div class="btns">';
                html += '                    <div class="webuploader_pick">繼續(xù)選擇</div>';
                html += '                    <div class="upload_btn">開始上傳</div>';
                html += '                </div>';
                html += '            </div>';
                html += '            <div id="preview" class="upload_preview"></div>';
                html += '        </div>';
                html += '        <div class="upload_submit">';
                html += '            <button type="button" id="fileSubmit" class="upload_submit_btn">確認(rèn)上傳文件</button>';
                html += '        </div>';
                html += '        <div id="uploadInf" class="upload_inf"></div>';
                html += '    </div>';
                
                ***html += '    <input type="hidden" name="userid" value="<%= userid %>"/>';***
                
                html += '</form>';
                

請麻煩看看倒數(shù)第二行,我如何才能正確顯示已經(jīng)提前在jsp頁面中寫好的userid字符串呢?

回答
編輯回答
安若晴
var userid = 'xxxx';
html += '<input type="hidden" name="userid" value="' + userid + '"/>';
2017年6月21日 23:44