Selamlar.JSP sayfamda databaseden verilerimi cekiyorum.Datatableye dolduruyorum.

this.menuAction = function() {

    function action() {  
        var url = "/MyElectronicP/employee";
        electron.service.ajaxcall(url, "POST", null, null, success, null);
        function success(data) {
            $("#panel").html(data);
            electron.gui.dataTable();
        }
    }
    $("body").on("click", "#side-menu a", action);
}

//Servlet(Controller)

            request.setAttribute("data", db.getAllEntities(Employee.class));
            RequestDispatcher dispatcher = request.getRequestDispatcher("menu/employee.jsp");
            dispatcher.forward(request, response);

%@page import="com.electron.pojo.Employee"%

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<fmt:setbundle basename="com.electron.properties.language_az"></fmt:setbundle>

<fmt:message key="name" var="name"/>

<fmt:message key="surname" var="surname"/>

<fmt:message key="detail" var="detail"/>
<table id="tbl-employee" class="table table-bordered table-hover dt-responsive" cellspacing="0">

   <thead class="btn-success">  
    <th>${name}</th>
    <th>${surname}</th>  
    <th>${detail}</th> 
    </thead>
  <tbody>
    <c:forEach items="${data}" var="i">
        <tr> 
            <td>${i.name}</td> 
            <td>${i.surname}</td>    
            <td><button data-toggle="modal" data-target="#detail-employee-modal" data-iddetail="${i.id}" id="btn-detail-emp-modal" type="button" class="btn btn-primary btn-xs" data-title="Detail"><span class="glyphicon glyphicon-asterisk"></span></button></td>
        </tr>
    </c:forEach>                             
    </tbody>
</table>

Detail buttonuna click etdikde yeniden controllere gidiyorum.

this.detailEmployee1 = function() {

    function action() {  
        var id = $(this).data("iddetail");
        var url = "/MyElectronicP/employee?action=detail&id=" + id;
        electron.service.ajaxcall(url, "POST", null, null, success, null);
        function success(data) {
             alert(data);
        } 
    }
    $('body').on("click", "table #btn-detail-emp-modal", action);
}

request.setAttribute("dataa", dbe.select(Employee.class, igDecimal.valueOf(Long.parseLong(id)))); RequestDispatcher dispatcher = request.getRequestDispatcher("employeeModals/employeeDetail.jsp");

dispatcher.forward(request, response);

<%@page import="com.electron.pojo.Employee"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<fmt:setbundle basename="com.electron.properties.language_az"></fmt:setbundle>

<fmt:message key="name" var="name"/>

<fmt:message key="surname" var="surname"/>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div class="row centered-form">

    <div class="modal fade" id="detail-employee-modal" tabindex="-1" role="dialog" aria-hidden="true">

        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
                    <h4 class="modal-title custom_align" id="Heading">${employeeEdit}</h4>
                </div>  
                <div class="modal-body">  
                    <div class="form-group"> 
                        ${name}<input class="form-control" type="text" class="form-control" id="nameE" name="txtName" placeholder="Name"> 
                    </div>   
                    <div class="form-group">
                        ${surname}<input class="form-control" type="text" class="form-control" id="surnameE" name="txtSurname" placeholder="Surname"/> 
                    </div>    
                </div>
                <div class="modal-footer ">                    
                </div>
            </div> 
        </div> 
    </div>
</div>

soruldu: 22 Eyl '15, 13:59

Yusuf's gravatar image

Yusuf
94253548
cevap kabul oranı: 0%

Bu soruya ilk cevap veren sen ol!
toggle preview

Bu soruyu takip et

E-Posta üzerinden:

Üyelik girişi yaptıktan sonra abonelik işlemlerini yapabilirsiniz

RSS üzerinden:

Cevaplar

Cevaplar ve Yorumlar

Yazı Formatlama

  • *italic* ya da _italic_
  • **bold** ya da __bold__
  • link:[text](http://url.com/ "başlık")
  • resim?![alt text](/path/img.jpg "başlık")
  • liste: 1. Foo 2. Bar
  • temel HTML etiketleri de kullanılabilir

Bu sorunun etiketleri:

×112
×26
×6

Soruldu: 22 Eyl '15, 13:59

Görüntüleme: 366 kez

Son güncelleme: 22 Eyl '15, 13:59

powered by BitNami OSQA