从jsp方法输出Html块

时间:2016-07-05 10:09:56

标签: html jsp methods

 String generate_general_control_bar(){

        String returnstring = 
                "<div class = 'col-md-2'>
                        <a href='#' class=' col-xs-6 btn btn-control disabled' role = 'button'>
                            <span class = 'glyphicon glyphicon-chevron-left'></span>
                            Previous
                         </a>
                        <a href='#' class=' col-xs-6 btn btn-control disabled' role = 'button'>
                            Future-1
                         </a>

                        </div> 
                           <div class = 'col-md-offset-2 col-md-4'>

                                <a href='#' class=' col-xs-4 btn btn-control disabled' role = 'button'>Future-2</a>
                                <a href='#' class=' col-xs-4 btn btn-control disabled' role = 'button'>
                                    <span class='glyphicon glyphicon-trash'></span> Delete</a>
                                <a href='#' class=' col-xs-4 btn btn-control  disabled' role = 'button'>
                                    <span class='glyphicon glyphicon-remove'></span> Reset</a>
                            </div> 
                         <div class = 'col-md-offset-2 col-md-2'>

                                <a href='#' class=' col-xs-6 btn btn-control disabled' role = 'button'>
                                    <span class='glyphicon glyphicon-floppy-saved'></span> Save
                                </a>
                                <a href='#' class=' col-xs-6 btn btn-control disabled' role = 'button'>
                                    Next
                                    <span class='glyphicon glyphicon-chevron-right'></span>
                                </a> 
                         </div>";

        return returnstring;
    }

Html代码是显示按钮。 我想从jsp方法输出这个html代码。但它显示字符串文字等错误未正确关闭。

1 个答案:

答案 0 :(得分:0)

您无法在具有相同引号的多行上构建String,请按以下步骤操作:

String test = "some text here"+
              "another text here"+ ...