mirizarry Posted January 20, 2010 Share Posted January 20, 2010 I have got most of my program working where I can drill down reports but I am unable to figure out how to convert the parameters from JRPrintHyperlink into a hashmap. If I hardcode my values into a hashmap it works fine, but I really need to pass the parameters supplied by JRPrintHyperlink.The most frustrating part is that I can see the values from the debugger and I can even add watches like these passedParameters.get(0).name passedParameters.get(0).value but cannot use that same notation in my java source.What is the magic I am looking for??? Thanks,MelCode: switch (hyperlink.getHyperlinkType()) { case JRHyperlink.HYPERLINK_TYPE_REFERENCE: { try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); } catch (ClassNotFoundException ex) { Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex); } Connection con = null; String url = "jdbc:jtds:sqlserver://mySQL/myDB"; String user = "myUser"; String pw = "xxXXXXXX"; try { con = DriverManager.getConnection(url, user, pw); } catch (SQLException ex) { Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex); } try { HashMap myParameters = new HashMap(); String myURL = hyperlink.getHyperlinkReference(); List passedParameters = hyperlink.getHyperlinkParameters().getParameters(); for(int I=0; I<passedParameters.size();I++){ // What goes here to make a hashmap from a hyperlink!!!!! // String myName = passedParameters.get(I).name; // String myValue = passedParameters.get(I).value; } jasperPrint = JasperFillManager.fillReport(myURL, myParameters, con); YCWUAReportViewer jasperviewer = new YCWUAReportViewer(jasperPrint); jasperviewer.setVisible(true); try { con.close(); } catch (SQLException ex) { Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex); } } catch (JRException ex) { Logger.getLogger(frmMaster.class.getName()).log(Level.SEVERE, null, ex); } //JOptionPane.showMessageDialog(this, "Hello " + hyperlink.getHyperlinkReference()); try { con.close(); } catch (SQLException ex) { Logger.getLogger(YCWUAReportViewer.class.getName()).log(Level.SEVERE, null, ex); } break; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now