小编xrc*_*wrn的帖子

使用json响应绘制chart.js中的折线图

<script type="text/javascript">
            $(function() {
                $.ajax({
                    type: "POST",
                    url: "BillnAmount",
                    cache: false,
                    dataType: 'json',
                    success: function(data) {
                        console.log(data);

                        var data = {
                            labels: ["January", "February", "March", "April", "May", "June", "July"],
                            datasets: [
                                {
                                    label: "My First dataset",
                                    fillColor: "rgba(220,220,220,0.2)",
                                    strokeColor: "rgba(220,220,220,1)",
                                    pointColor: "rgba(220,220,220,1)",
                                    pointStrokeColor: "#fff",
                                    pointHighlightFill: "#fff",
                                    pointHighlightStroke: "rgba(220,220,220,1)",
                                    data: [65, 59, 80, 81, 56, 55, 40]
                                },
                                {
                                    label: "My Second dataset",
                                    fillColor: "rgba(151,187,205,0.2)",
                                    strokeColor: "rgba(151,187,205,1)",
                                    pointColor: "rgba(151,187,205,1)",
                                    pointStrokeColor: "#fff",
                                    pointHighlightFill: "#fff",
                                    pointHighlightStroke: "rgba(151,187,205,1)",
                                    data: [28, 48, 40, 19, 86, …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery json chart.js

4
推荐指数
1
解决办法
1万
查看次数

Struts 2文本框arrangment

我想创建一个包含文本框的表单,如下所示.我正在使用Struts2.

User Name
|Text Box for user name|

mail id
|Text box for mail id|    

<s:textarea name="username" id="username" label="User Name"/>
Run Code Online (Sandbox Code Playgroud)

这显示:

User name |Text Box for user name|
Run Code Online (Sandbox Code Playgroud)

但我想要上面的格式.当我使用验证框架标签以斜体显示时,我想要正常文本.

struts2

3
推荐指数
1
解决办法
2916
查看次数

如何在Hibernate中从数据库中获取数据

这是我从数据库中获取数据的类

package com.javatpoint.mypackage;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.List;

public class retrive {
    public static void main(String args[]) {
        Configuration cfg = new Configuration();
        cfg.configure("hibernate.cfg.xml");// populates the data of the
                                            // configuration file

        // creating seession factory object
        SessionFactory factory = cfg.buildSessionFactory();

        // creating session object
        Session session = factory.openSession();

        // creating transaction object
        Transaction t = session.beginTransaction();

        Query query = session.createQuery("from EMPLOYEE");
        java.util.List list = query.list();
        System.out.println(list);
        t.commit();
        session.close();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的Emplouyee.hbm.xml …

java hibernate

3
推荐指数
2
解决办法
9万
查看次数

多捕获异常处理程序中的顺序

我知道自从Java 7你可以使用multi-catch但是我想知道它的异常顺序是否与之前版本的java一样重要?例如,我把异常,然后SQLExceptionIOException

try {
      // execute code that may throw 1 of the 3 exceptions below.

} catch(Exception | SQLException | IOException e) {   
    logger.log(e);

}
Run Code Online (Sandbox Code Playgroud)

或者我应该这样做?

try {

    // execute code that may throw 1 of the 3 exceptions below.

} catch(SQLException | IOException e) {
    logger.log(e);

} catch(Exception e) {
    logger.severe(e);
}
Run Code Online (Sandbox Code Playgroud)

java exception-handling exception multi-catch

3
推荐指数
2
解决办法
2735
查看次数

使用休眠将值插入到多个表中

我有现有的表hotelhotel_services

hotel table contains:
hotel_id
hotel_name

hotel_services contains:
hotel_id
hotel_service_name
Run Code Online (Sandbox Code Playgroud)

每家酒店都可以提供多种服务,因此在我的表单中,用户可以一次输入任意数量的服务。

所以例如:

hotel name: HOTEL1
hotel_services:
1. hotel_service1
2. hotel_service2
3. hotel_service3
Run Code Online (Sandbox Code Playgroud)

我的问题是我应该如何在休眠中以这样的方式执行此操作,以便我能够将所有数据插入到它们各自的表(即hotels 和hotel_services 表)中。

谢谢您的帮助..

hibernate

2
推荐指数
1
解决办法
2万
查看次数

如何使用参数重定向

<action name="AddedPaid"  class="iland.payment.SupplierPaidAction" method="insert">
  <result name="success"  type="redirect">ShowPaid</result>
  <result name="input">/pages/payment/addToPay.jsp</result>
  <result name="login">/pages/login.jsp</result> 
</action>   

<action name="ShowPaid" class="iland.payment.SupplierPaidAction" method="fetchAllByfk">
        <result name="success">/pages/paid/showPaidDetails.jsp</result>
        <result name="input">/pages/payment/ShowPay.jsp</result>
        <result name="login">/pages/login.jsp</result>            
 </action> 
Run Code Online (Sandbox Code Playgroud)

这里AddedPaidAction用于将表单数据添加到数据库中。将数据添加到数据库后,我将结果重定向到ShowPaid操作。这是正常工作的。现在我希望每当我将AddedPaid操作重定向到ShowPaid. 必须显示我已在 中添加数据ShowPaid的特定数据。supplierPaymentIdAddedPaid

重定向后是怎样的 url

http://localhost:8082/ClothStore/ShowPaid
Run Code Online (Sandbox Code Playgroud)

我想

http://localhost:8082/ClothStore/ShowPaid?supplierPaymentId=4
Run Code Online (Sandbox Code Playgroud)

struts2 post-redirect-get query-string

2
推荐指数
1
解决办法
6344
查看次数

图表JS动态图表

我正在使用Chart.js构建动态图表(相同的canvas元素显示30天,7天和1天的数据,具体取决于下拉值.

我有代码工作,重绘画布.新数据出现在下拉更改中,但是当我将鼠标悬停在图表上时,数据会闪烁,我可以看到图表的先前版本.我知道我需要使用该.clear()函数来清除数据,但我不确定这应该发生在哪里.在ctx函数执行之前的var ?或者 window.myLine

function redrawChart(data){
    var ctx = document.getElementById("canvas").getContext("2d");
    window.myLine = new Chart(ctx).Line(data, {
        responsive: true
    });
}
Run Code Online (Sandbox Code Playgroud)

javascript jquery chart.js

2
推荐指数
1
解决办法
4989
查看次数

无法找到'struts.multipart.saveDir'属性设置.默认为javax.servlet.context.tempdir

尝试在struts2中上传图片时,图片无法上传并显示以下信息无法找到struts.multipart.saveDir属性设置.默认为javax.servlet.context.tempdir

如何解决这个问题呢

java jsp struts2 file-upload

0
推荐指数
1
解决办法
2万
查看次数

在Jsp页面中获取客户端的IP地址

我想在我的jsp页面中获取客户端的IP地址,并希望存储在我的数据库中.

我在Jsp页面中使用以下代码来填充IP地址,但它显示的是服务器IP地址.

 <input type="hidden" name="ipaddress" value="<%=request.getRemoteAddr()%>"/> 
Run Code Online (Sandbox Code Playgroud)

java jsp

0
推荐指数
1
解决办法
2万
查看次数