JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Web Framework » JSF  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 JSF chart 無法更新
cool3690





發文: 44
積分: 0
於 2017-09-04 02:21 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我想查詢價錢並用圖表show出有幾張發票
但我輸入數字並按了查詢後,他都沒動靜.....

以下是我的程式碼:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"         
                xmlns:f="http://java.sun.com/jsf/core">
               
 
    <ui:define name="source">
        <h:outputStylesheet library="css" name="styles.css"  />
        <h3 style="margin-top:0">發票查詢</h3>        
        <h:form id="f1">
           
          金額大於:<h:inputText id="a" value="#{aapqchart.apk08}" />
             金額小於:<h:inputText id="b" value="#{aapqchart.apk082}" /> 
            
     <p:commandButton   ajax="true"  update="f2" value="查詢"  actionListener="#{aapqchart.searchchart}" /> 
 
        </h:form>
       
        <h:form id="f2">
        
             <br/>
              
             <p:chart  type="bar" id="b2"  model="#{aapqchart.barModel}" style="height:300px" />
              
         </h:form>
        
    </ui:define>
</ui:composition>
   


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 private com.tiptop.db.dao.TiptopDAO tiptopDAO;
    private com.tiptop.db.dao.EntityDAO entityDAO;
    private java.util.List<com.tiptop.db.entity.APK> apkchart;
    private BarChartModel barModel;
    private int apk08=10,apk082=15;
  
ArrayList<String> c = new ArrayList<String>();
ArrayList<String> d = new ArrayList<String>();
    private List<APK> apktest;
   //set,get
  
  @PostConstruct
    public void init() {
        createBarModels();
    }
    public aapqchart() {
       
    }
  
    private void createBarModels() {
        createBarModel();
       
    }
     
    private void createBarModel() {
        barModel = initBarModel();      
        barModel.setTitle("Bar Chart");
        //barModel.setLegendPosition("ne");      
        Axis xAxis = barModel.getAxis(AxisType.X);
        xAxis.setLabel("Gender");    
        Axis yAxis = barModel.getAxis(AxisType.Y);
        yAxis.setLabel("Births");
        yAxis.setMin(0);
        yAxis.setMax(50);
    }
private BarChartModel initBarModel() {
        BarChartModel model = new BarChartModel();
  
        searchchart();          
        ChartSeries boys = new ChartSeries();
        boys.setLabel("Boys");
  for(int j=0;j<c.size();j++)
  {
     boys.set(c.get(j), new Integer(d.get(j)));
      
  }model.addSeries(boys); 
   
        return model;
    }
 
public String searchchart() {
    this.apktest = this.entityDAO.APKchart(this.c,this.d,this.apk08,this.apk082);
  
        return null;
    } 

請各位幫幫我,看要怎麼改,謝謝


cool3690 edited on 2017-09-04 08:12
reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:cool3690]
jimmy14

Give me J-Power !



發文: 787
積分: 3
於 2017-09-04 02:48 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
試試看
<p:commandButton ajax="true" update=":f2" value="查詢" actionListener="#{aapqchart.searchchart}" />


reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:jimmy14]
cool3690





發文: 44
積分: 0
於 2017-09-04 03:57 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
報告Jimmy14大大
還是無法查詢耶......
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<ui:define name="source">
        <h:outputStylesheet library="css" name="styles.css"  />
        <h3 style="margin-top:0">發票查詢</h3>        
        <h:form id="f1">       
          金額大於:<h:inputText id="a" value="#{aapqchart.apk08}" />
             金額小於:<h:inputText id="b" value="#{aapqchart.apk082}" /> 
        <p:commandButton ajax="true" update=":f2" value="查詢" actionListener="#{aapqchart.searchchart}" />           
        </h:form>       
        <h:form id="f2">        
             <br/>              
             <p:chart   type="bar"   model="#{aapqchart.barModel}" style="height:300px" >
              
              </p:chart>
         </h:form>
        
    </ui:define>


reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:cool3690]
jimmy14

Give me J-Power !



發文: 787
積分: 3
於 2017-09-04 04:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
是無法查詢? (aapqchart.searchchart 有執行嗎?)
還是無法更新? (檢查 response回傳的資料)


reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:jimmy14]
cool3690





發文: 44
積分: 0
於 2017-09-04 05:12 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我當初是寫查詢功能==>OK(可以做出TABLE表格
但我改成要查圖表時就不行了.....


reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:cool3690]
snowbean71





發文: 92
積分: 0
於 2017-09-04 05:37 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
 public void searchchart(ActionEvent event) {
    this.apktest = this.entityDAO.APKchart(this.c,this.d,this.apk08,this.apk082);
 }


1
 actionListener="#{aapqchart.searchchart(event)}" 


你用的是actionListener不是 action


snowbean71 edited on 2017-09-04 05:39
reply to postreply to post
javabean71.....snowbean71......JSF+JPA+Primefaces
作者 Re:JSF chart 無法更新 [Re:snowbean71]
cool3690





發文: 44
積分: 0
於 2017-09-04 07:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
有改了
OK了
謝謝snowbean大 , jimmy大
感謝


reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:snowbean71]
cool3690





發文: 44
積分: 0
於 2017-09-13 03:47 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
snowbean71大大好:
想再請教你一個問題
日期都一樣,所以我想把同一天日期的金額加總
化成統計圖,EX:9/11,9/12,913....
但我寫了都會當機
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public void cal()
{        oea61.clear();
        oea72.clear();
    this.oeatest=this.entityDAO.findOEAchart(this.beginDate,this.endDate,this.oea61,this.oea72);
     double count=0;
     int j;
     for(i=0,j=0;i<oea61.size();i++)
  {   String te="",te1="";
      
     //oea72是日期
      if(oea72.get(i).equals(oea72.get(i+1)))//這行都會錯(1)
      {count+=new Double(oea61.get(i));
      
      }
      else
      {da.add(j, oea72.get(i));
    mon.add(j, String.valueOf(count));
      count=0;
      j++;
      
      }
  
  }
}
//..........畫圖

(1)那行他判斷似乎都會錯誤(用其他判斷式EXBlush%10!=0就可以show出畫面.....
想問這判斷式,哪裡有錯,目前預設日期是9/10-9/13共要4條長條圖


cool3690 edited on 2017-09-13 07:38
reply to postreply to post
作者 Re:JSF chart 無法更新 [Re:cool3690]
snowbean71





發文: 92
積分: 0
於 2017-09-13 06:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
oea71如果是 List 的話,你使用
1
if(oea72.get(i).equals(oea72.get(i+1))) 

i+1 那一定會超出size,然後發生錯誤。

錯誤訊息中應該會有說明
你自已應該去學debug 一下了


reply to postreply to post
javabean71.....snowbean71......JSF+JPA+Primefaces
作者 Re:JSF chart 無法更新 [Re:snowbean71]
cool3690





發文: 44
積分: 0
於 2017-09-13 08:07 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
了解,我會試著學好debug的
我再努力研究看看,謝謝


reply to postreply to post
» JWorld@TW »  Web Framework » JSF

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8