Help need in javax.smartcardio.exception

getting error
javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0xc000002b
at sun.security.smartcardio.ChannelImpl.doTransmit(ChannelImpl.java:202)
at sun.security.smartcardio.ChannelImpl.transmit(ChannelImpl.java:73)
while setting pin limit in the card.
Please help what is the cause of getting this error.
thanks in advance

First you should check that the library has the checkbox 'Deploy by default' is checked for your library.
The you open the project properties of the view controller project, select Deployments, edit the deployment descriptor. Select the Node 'File Groups'->'WEB-INF/lib'->'Contributors'. this should give you a list of libraries your project uses. Check if your library has the checkbox checked (is selected fro deployment). If it's not checked, set it.
This should include the library.
Timo

Similar Messages

  • Help Needed! java.lang.Exception: Unable to connect to server

    I am trying to connect remotely to my office workstation and get the error "java.lang.Exception: Unable to connect to server".  I have already upgraded to MountainLion, installed Java 7, and have also tried 3 different browsers (Safari, Firefox, Chrome) without success.  I was able to login a few weeks ago and it has since stopped.  My employer's IT support cannot understand how to help me and they're telling me I need to buy a PC.
    Can someone help?

    Check whether your connection pool and datasource are really
    started. Also check you have the correct JDNI name, NOT name,
    for your datasource.
    "Ajay Singh" <[email protected]> wrote:
    >
    Hi,
    =============
    java.lang.Exception: Unable to resolve wwinvDataSource. Resolved: '' Unresolved:'wwinvDataSource'
    =============
    I am getting this error in the JSP. wwinvDataSource is the name of my DataSource.
    Has anybody encountered similar problem?
    Thanks,
    Ajay

  • HELP Needed with this error:   Exception in thread "main" java.lang.NoClass

    Folks,
    I am having a problem connecting to my MSDE SQL 2000 DB on a WindowsXP pro. environment. I am learning Java and writing a small test prgm to connect the the database. The code compiles ok, but when I try to execute it i keep getting this error:
    "Exception in thread "main" java.lang.NoClassDefFoundError: Test1"
    I am using the Microsoft jdbc driver and my CLASSPATH is setup correctly, I've also noticed that several people have complained about this error, but have not seen any solutions....can someone help ?
    Here is the one of the test programs that I am using:
    import java.sql.*;
    * Microsoft SQL Server JDBC test program
    public class Test1 {
    public Test1() throws Exception {
    // Get connection
    DriverManager.registerDriver(new
    com.microsoft.jdbc.sqlserver.SQLServerDriver());
    Connection connection = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://LAPTOP01:1433","sa","sqladmin");
    if (connection != null) {
    System.out.println();
    System.out.println("Successfully connected");
    System.out.println();
    // Meta data
    DatabaseMetaData meta = connection.getMetaData();
    System.out.println("\nDriver Information");
    System.out.println("Driver Name: "
    + meta.getDriverName());
    System.out.println("Driver Version: "
    + meta.getDriverVersion());
    System.out.println("\nDatabase Information ");
    System.out.println("Database Name: "
    + meta.getDatabaseProductName());
    System.out.println("Database Version: "+
    meta.getDatabaseProductVersion());
    } // Test
    public static void main (String args[]) throws Exception {
    Test1 test = new Test1();

    I want to say that there was nothing wrong
    with my classpath config., I am still not sure why
    that didn't work, there is what I did to resolved
    this issue.You can say that all you like but if you are getting NoClassDefFound errors, that's because the class associated with the error is not in your classpath.
    (For future reference: you will find it easier to solve problems if you assume that the problem is your fault, instead of trying to blame something else. It almost always is your fault -- at least that's been my experience.)
    1. I had to set my DB connection protocol to TCP/IP
    (this was not the default), this was done by running
    the
    file "svrnetcn.exe" and then in the SQL Server Network
    Utility window, enable TCP/IP and set the port to
    1433.Irrelevant to the classpath problem.
    2. I then copied all three of the Microsoft JDBC
    driver files to the ..\jre\lib\ext dir of my jdk
    installed dir.The classpath always includes all jar files in this directory. That's why doing that fixed your problem. My bet is that you didn't have the jar file containing the driver in your classpath before, you just had the directory containing that jar file.
    3. Updated my OS path to located these files
    and....BINGO! (that simple)Unnecessary for solving classpath problems.
    4. Took a crash course on JDBC & basic Java and now I
    have created my database, all tables, scripts,
    stored procedures and can read/write and do all kinds
    of neat stuff.All's well that ends well. After a few months you'll wonder what all the fuss was about.

  • Help Needed on Null Pointer Exception

    Hi All,
    Am using the wls10 platform. Any help would be appriciated. Have been struggling on this for a bit now.
    Thanks,
    The the relevant control code is:
    @JdbcControl.SQL(statement = "SELECT p.PATCH_ID, p.REQUIRES,ps.PRODUCT_DISPLAY_NAME, v.VERSION_NAME,p.PATCH_NAME,p.DESCRIPTION, to_char(p.RELEASE_DATE, 'MM/DD/YYYY') RELEASE_DATE, p.SUPERCEDES, p.RELEASE_TYPE, p.KB_ARTICLE, p.SYSTEM_IMPACT , p.DOWNLOAD_LOCATION, p.requirelogin, p.SEVERITY, p.ACTIVE, p.MD5, P.DOWNLOAD_FILE_SIZE from patch p, version v, products ps where p.VERSION_ID = v.VERSION_ID and v.PRODUCT_ID = ps.PRODUCT_ID and upper(p.PATCH_NAME) {sql: whereClause} and v.active = 1 ORDER BY ps.PRODUCT_DISPLAY_NAME, v.VERSION_NAME")
         public Patch[] findPatchByReleaseName(String whereClause)throws SQLException;
    The controller code is:
         @Jpf.Action(forwards = {
                        @Jpf.Forward(name = "success", path = "Downloadpage.jsp", actionOutputs = { @Jpf.ActionOutput(name = "findPatchResult", type = com.vmware.s3portal.domain.Patch[].class) }),
                        @Jpf.Forward(name = "noResults", path = "index.jsp"),
                        @Jpf.Forward(name = "authError", path = "/jsps/authCheck.jsp"),
                        @Jpf.Forward(name = "error", path = "/jsps/error.jsp") })
              public Forward findPatchByReleaseName(DisplayDataFormBean form) {
                   Forward forward = null;
                   String patchname = form.getPatchname();
                   boolean releaseNameFlag = true;
                   if (logger.isDebugEnabled()) {
                        logger.debug("patchname in findPatchByReleaseName is = " + patchname);
                   try {
                        findPatchResult = null;// reset it
                        if(patchname != null){
                             patchname = patchname.trim().toUpperCase();
                        if (! StringUtils.isEmptyString(patchname) && ! IllegalCharValidator.isValid(patchname)) {
                             logger.debug("patchname is illegal.");
                             forward = new Forward("noResults");
                             forward.addActionOutput("noResults", Boolean.TRUE);
                             setPageOutputs(forward, form);
                             return forward;
                        String whereClause = "";
                        if (!StringUtils.isEmptyString(patchname)) {
                             logger.debug("search by patchname");
                             if (patchname.indexOf("*") != -1 || patchname.indexOf(" ") != -1 || patchname.indexOf("-") != -1) {
                                  patchname = patchname.replaceAll("\\*", "%");
                                  patchname = patchname.replaceAll(" ", "%");
                                  patchname = patchname.replaceAll("\\-", "%");
                                  whereClause += " like '%" + patchname + "%'";
                             } else {
                                  whereClause += " like '%" + patchname + "%'";
                        whereClause = getWhereClause(whereClause);
                        logger.debug("whereClause in findPatchByReleaseName: " + whereClause);
                        findPatchResult = rmcontrol.findPatchByReleaseName(whereClause);
                        if (findPatchResult == null || findPatchResult.length == 0) {
                             // forward to index.jsp
                             forward = new Forward("noResults");
                             forward.addActionOutput("noResults", Boolean.TRUE);
                             setPageOutputs(forward, form);
                             return forward;
                        sorter.sort(getRequest(),findPatchResult);
                        logger.debug("Total number of patchs returned in ReleaseName Search: "+ findPatchResult.length);
                        forward = new Forward("success");
                        forward.addActionOutput("products", products);
                        forward.addActionOutput("versions", versions);
                        forward.addOutputForm(form);
                        forward.addActionOutput("actionForm", form);
                        forward.addActionOutput("findPatchResult", findPatchResult);
                        forward.addActionOutput("sorter", sorter);
                        forward.addActionOutput("releaseNameFlag", releaseNameFlag);
                   } catch (S3PException exception) {
                        logger.error("Auth Exception in findPatchByReleaseName().", exception);
                        forward = new Forward("authError");
                   } catch (Exception exception) {
                        logger.error("Exception in findPatchByReleaseName().", exception);
                        forward = new Forward("error");
                   return forward;
    The exception I am getting is:
    14 May 2008 15:48:58,028 ERROR PatchupdateController: Exception in findPatchByRe
    leaseName().
    java.lang.NullPointerException
    at org.apache.beehive.controls.system.jdbc.JdbcControlImpl.execPreparedS
    tatement(JdbcControlImpl.java:257)
    at org.apache.beehive.controls.system.jdbc.JdbcControlImpl.invoke(JdbcCo
    ntrolImpl.java:224)
    at com.vmware.s3portal.dbaccess.RMControlBean.findPatchByReleaseName(RMC
    ontrolBean.java:191)
    at portlets.patchupdate.PatchupdateController.findPatchByReleaseName(Pat
    chupdateController.java:291)
    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[
    Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
    at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;
    I)Ljava.lang.Object;(Unknown Source)
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(F
    lowController.java:870)
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForwa
    rd(FlowController.java:809)
    at org.apache.beehive.netui.pageflow.FlowController.internalExecute(Flow
    Controller.java:478)
    at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(
    PageFlowController.java:306)
    at org.apache.beehive.netui.pageflow.FlowController.execute(FlowControll
    er.java:336)
    at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execu
    te(FlowControllerAction.java:52)
    at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
    tProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201
    (PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunn
    er.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
    at org.apache.beehive.netui.pageflow.interceptor.action.ActionIntercepto
    r.wrapAction(ActionInterceptor.java:168)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors.wrapAction(ActionInterceptors.java:87)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processAct
    ionPerform(PageFlowRequestProcessor.java:2116)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInt
    ernal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(Pa
    geFlowRequestProcessor.java:853)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(A
    utoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageF
    lowActionServlet.java:158)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlow
    Utils.java:1170)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.exec
    uteAction(ScopedContentCommonSupport.java:686)

    Hi All,
    Am using the wls10 platform. Any help would be appriciated. Have been struggling on this for a bit now.
    Thanks,
    The the relevant control code is:
    @JdbcControl.SQL(statement = "SELECT p.PATCH_ID, p.REQUIRES,ps.PRODUCT_DISPLAY_NAME, v.VERSION_NAME,p.PATCH_NAME,p.DESCRIPTION, to_char(p.RELEASE_DATE, 'MM/DD/YYYY') RELEASE_DATE, p.SUPERCEDES, p.RELEASE_TYPE, p.KB_ARTICLE, p.SYSTEM_IMPACT , p.DOWNLOAD_LOCATION, p.requirelogin, p.SEVERITY, p.ACTIVE, p.MD5, P.DOWNLOAD_FILE_SIZE from patch p, version v, products ps where p.VERSION_ID = v.VERSION_ID and v.PRODUCT_ID = ps.PRODUCT_ID and upper(p.PATCH_NAME) {sql: whereClause} and v.active = 1 ORDER BY ps.PRODUCT_DISPLAY_NAME, v.VERSION_NAME")
         public Patch[] findPatchByReleaseName(String whereClause)throws SQLException;
    The controller code is:
         @Jpf.Action(forwards = {
                        @Jpf.Forward(name = "success", path = "Downloadpage.jsp", actionOutputs = { @Jpf.ActionOutput(name = "findPatchResult", type = com.vmware.s3portal.domain.Patch[].class) }),
                        @Jpf.Forward(name = "noResults", path = "index.jsp"),
                        @Jpf.Forward(name = "authError", path = "/jsps/authCheck.jsp"),
                        @Jpf.Forward(name = "error", path = "/jsps/error.jsp") })
              public Forward findPatchByReleaseName(DisplayDataFormBean form) {
                   Forward forward = null;
                   String patchname = form.getPatchname();
                   boolean releaseNameFlag = true;
                   if (logger.isDebugEnabled()) {
                        logger.debug("patchname in findPatchByReleaseName is = " + patchname);
                   try {
                        findPatchResult = null;// reset it
                        if(patchname != null){
                             patchname = patchname.trim().toUpperCase();
                        if (! StringUtils.isEmptyString(patchname) && ! IllegalCharValidator.isValid(patchname)) {
                             logger.debug("patchname is illegal.");
                             forward = new Forward("noResults");
                             forward.addActionOutput("noResults", Boolean.TRUE);
                             setPageOutputs(forward, form);
                             return forward;
                        String whereClause = "";
                        if (!StringUtils.isEmptyString(patchname)) {
                             logger.debug("search by patchname");
                             if (patchname.indexOf("*") != -1 || patchname.indexOf(" ") != -1 || patchname.indexOf("-") != -1) {
                                  patchname = patchname.replaceAll("\\*", "%");
                                  patchname = patchname.replaceAll(" ", "%");
                                  patchname = patchname.replaceAll("\\-", "%");
                                  whereClause += " like '%" + patchname + "%'";
                             } else {
                                  whereClause += " like '%" + patchname + "%'";
                        whereClause = getWhereClause(whereClause);
                        logger.debug("whereClause in findPatchByReleaseName: " + whereClause);
                        findPatchResult = rmcontrol.findPatchByReleaseName(whereClause);
                        if (findPatchResult == null || findPatchResult.length == 0) {
                             // forward to index.jsp
                             forward = new Forward("noResults");
                             forward.addActionOutput("noResults", Boolean.TRUE);
                             setPageOutputs(forward, form);
                             return forward;
                        sorter.sort(getRequest(),findPatchResult);
                        logger.debug("Total number of patchs returned in ReleaseName Search: "+ findPatchResult.length);
                        forward = new Forward("success");
                        forward.addActionOutput("products", products);
                        forward.addActionOutput("versions", versions);
                        forward.addOutputForm(form);
                        forward.addActionOutput("actionForm", form);
                        forward.addActionOutput("findPatchResult", findPatchResult);
                        forward.addActionOutput("sorter", sorter);
                        forward.addActionOutput("releaseNameFlag", releaseNameFlag);
                   } catch (S3PException exception) {
                        logger.error("Auth Exception in findPatchByReleaseName().", exception);
                        forward = new Forward("authError");
                   } catch (Exception exception) {
                        logger.error("Exception in findPatchByReleaseName().", exception);
                        forward = new Forward("error");
                   return forward;
    The exception I am getting is:
    14 May 2008 15:48:58,028 ERROR PatchupdateController: Exception in findPatchByRe
    leaseName().
    java.lang.NullPointerException
    at org.apache.beehive.controls.system.jdbc.JdbcControlImpl.execPreparedS
    tatement(JdbcControlImpl.java:257)
    at org.apache.beehive.controls.system.jdbc.JdbcControlImpl.invoke(JdbcCo
    ntrolImpl.java:224)
    at com.vmware.s3portal.dbaccess.RMControlBean.findPatchByReleaseName(RMC
    ontrolBean.java:191)
    at portlets.patchupdate.PatchupdateController.findPatchByReleaseName(Pat
    chupdateController.java:291)
    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[
    Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
    at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;
    I)Ljava.lang.Object;(Unknown Source)
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(F
    lowController.java:870)
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForwa
    rd(FlowController.java:809)
    at org.apache.beehive.netui.pageflow.FlowController.internalExecute(Flow
    Controller.java:478)
    at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(
    PageFlowController.java:306)
    at org.apache.beehive.netui.pageflow.FlowController.execute(FlowControll
    er.java:336)
    at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execu
    te(FlowControllerAction.java:52)
    at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
    tProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201
    (PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunn
    er.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:64)
    at org.apache.beehive.netui.pageflow.interceptor.action.ActionIntercepto
    r.wrapAction(ActionInterceptor.java:168)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:50)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:58)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionI
    nterceptors.wrapAction(ActionInterceptors.java:87)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processAct
    ionPerform(PageFlowRequestProcessor.java:2116)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInt
    ernal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(Pa
    geFlowRequestProcessor.java:853)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(A
    utoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageF
    lowActionServlet.java:158)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlow
    Utils.java:1170)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.exec
    uteAction(ScopedContentCommonSupport.java:686)

  • Help needed for javax.naming.Context and javax.naming.InitialContext

    I need help on this two..
    I am currently doing a project which required Connection Pooling. And this is the first time i'm exposed to all this.. I know nothing about these files.. But, i manage to get help from someone on DataSource. But i can't find any for naming.context and naming.InitialContext.. Can anyone help me? I need to know where i can get these 2 files or how to configure it.. Thanks! ;p

    This'll help you:
    http://java.sun.com/products/jndi/tutorial/

  • Help needed:Printing HTML file using javax.print

    Hi
    I am using the following code which i got form the forum for rpinting an HTML file.
    The folllowing code is working fine, but the problem is the content of HTML file is not getting printed. I am geeting a blank page with no content. What is the change that is required in the code? ALso is there any simpler way to implement this. Help needed ASAP.
    public boolean printHTMLFile(String filename) {
              try {
                   JEditorPane editorPane = new JEditorPane();
                   editorPane.setEditorKit(new HTMLEditorKit());
                   //editorPane.setContentType("text/html");
                   editorPane.setSize(500,500);
                   String text = getFileContents(filename);
                   if (text != null) {
                        editorPane.setText(text);                    
                   } else {
                        return false;
                   printEditorPane(editorPane);
                   return true;
              } catch (Exception tce) {
                   tce.printStackTrace();
              return false;
         public String getFileContents(String filename) {
              try {
                   File file = new File(filename);
                   BufferedReader br = new BufferedReader(new FileReader(file));
                   String line;
                   StringBuffer sb = new StringBuffer();
                   while ((line = br.readLine()) != null) {
                        sb.append(line);
                   br.close();
                   return sb.toString();
              } catch (Exception tce) {
                   tce.printStackTrace();
              return null;
         public void printEditorPane(JEditorPane editorPane) {
                   try {
                        HTMLPrinter htmlPrinter = new HTMLPrinter();
                        htmlPrinter.printJEditorPane(editorPane, htmlPrinter.showPrintDialog());
                   } catch (Exception tce) {
                        tce.printStackTrace();
         * Sets up to easily print HTML documents. It is not necessary to call any of the setter
         * methods as they all have default values, they are provided should you wish to change
         * any of the default values.
         public class HTMLPrinter {
         public int DEFAULT_DPI = 72;
         public float DEFAULT_PAGE_WIDTH_INCH = 8.5f;
         public float DEFAULT_PAGE_HEIGHT_INCH = 11f;
         int x = 100;
         int y = 80;
         GraphicsConfiguration gc;
         PrintService[] services;
         PrintService defaultService;
         DocFlavor flavor;
         PrintRequestAttributeSet attributes;
         Vector pjlListeners = new Vector();
         Vector pjalListeners = new Vector();
         Vector psalListeners = new Vector();
         public HTMLPrinter() {
              gc = null;
              attributes = new HashPrintRequestAttributeSet();
              flavor = null;
              defaultService = PrintServiceLookup.lookupDefaultPrintService();
              services = PrintServiceLookup.lookupPrintServices(flavor, attributes);
              // do something with the supported docflavors
              DocFlavor[] df = defaultService.getSupportedDocFlavors();
              for (int i = 0; i < df.length; i++)
              System.out.println(df.getMimeType() + " " + df[i].getRepresentationClassName());
              // if there is a default service, but no other services
              if (defaultService != null && (services == null || services.length == 0)) {
              services = new PrintService[1];
              services[0] = defaultService;
         * Set the GraphicsConfiguration to display the print dialog on.
         * @param gc a GraphicsConfiguration object
         public void setGraphicsConfiguration(GraphicsConfiguration gc) {
              this.gc = gc;
         public void setServices(PrintService[] services) {
              this.services = services;
         public void setDefaultService(PrintService service) {
              this.defaultService = service;
         public void setDocFlavor(DocFlavor flavor) {
              this.flavor = flavor;
         public void setPrintRequestAttributes(PrintRequestAttributeSet attributes) {
              this.attributes = attributes;
         public void setPrintDialogLocation(int x, int y) {
              this.x = x;
              this.y = y;
         public void addPrintJobListener(PrintJobListener pjl) {
              pjlListeners.addElement(pjl);
         public void removePrintJobListener(PrintJobListener pjl) {
              pjlListeners.removeElement(pjl);
         public void addPrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.addElement(psal);
         public void removePrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.removeElement(psal);
         public boolean printJEditorPane(JEditorPane jep, PrintService ps) {
                   if (ps == null || jep == null) {
                        System.out.println("printJEditorPane: jep or ps is NULL, aborting...");
                        return false;
                   // get the root view of the preview pane
                   View rv = jep.getUI().getRootView(jep);
                   // get the size of the view (hopefully the total size of the page to be printed
                   int x = (int) rv.getPreferredSpan(View.X_AXIS);
                   int y = (int) rv.getPreferredSpan(View.Y_AXIS);
                   // find out if the print has been set to colour mode
                   DocPrintJob dpj = ps.createPrintJob();
                   PrintJobAttributeSet pjas = dpj.getAttributes();
                   // get the DPI and printable area of the page. use default values if not available
                   // use this to get the maximum number of pixels on the vertical axis
                   PrinterResolution pr = (PrinterResolution) pjas.get(PrinterResolution.class);
                   int dpi;
                   float pageX, pageY;
                   if (pr != null)
                        dpi = pr.getFeedResolution(PrinterResolution.DPI);
                   else
                        dpi = DEFAULT_DPI;
                   MediaPrintableArea mpa = (MediaPrintableArea) pjas.get(MediaPrintableArea.class);
                   if (mpa != null) {
                        pageX = mpa.getX(MediaPrintableArea.INCH);
                        pageY = mpa.getX(MediaPrintableArea.INCH);
                   } else {
                        pageX = DEFAULT_PAGE_WIDTH_INCH;
                        pageY = DEFAULT_PAGE_HEIGHT_INCH;
                   int pixelsPerPageY = (int) (dpi * pageY);
                   int pixelsPerPageX = (int) (dpi * pageX);
                   int minY = Math.max(pixelsPerPageY, y);
                   // make colour true if the user has selected colour, and the PrintService can support colour
                   boolean colour = pjas.containsValue(Chromaticity.COLOR);
                   colour = colour & (ps.getAttribute(ColorSupported.class) == ColorSupported.SUPPORTED);
                   // create a BufferedImage to draw on
                   int imgMode;
                   if (colour)
                        imgMode = BufferedImage.TYPE_3BYTE_BGR;
                   else
                        imgMode = BufferedImage.TYPE_BYTE_GRAY;
                   BufferedImage img = new BufferedImage(pixelsPerPageX, minY, imgMode);
                   Graphics myGraphics = img.getGraphics();
                   myGraphics.setClip(0, 0, pixelsPerPageX, minY);
                   myGraphics.setColor(Color.WHITE);
                   myGraphics.fillRect(0, 0, pixelsPerPageX, minY);
                        java.awt.Rectangle rectangle=new java.awt.Rectangle(0,0,pixelsPerPageX, minY);
                   // call rootView.paint( myGraphics, rect ) to paint the whole image on myGraphics
                   rv.paint(myGraphics, rectangle);
                   try {
                        // write the image as a JPEG to the ByteArray so it can be printed
                        Iterator writers = ImageIO.getImageWritersByFormatName("jpeg");
                        ImageWriter writer = (ImageWriter) writers.next();
                                       // mod: Added the iwparam to create the highest quality image possible
                        ImageWriteParam iwparam = writer.getDefaultWriteParam();
                        iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ;
                        iwparam.setCompressionQuality(1.0f); // highest quality
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
                        ImageOutputStream ios = ImageIO.createImageOutputStream(out);
                        writer.setOutput(ios);
                        // get the number of pages we need to print this image
                        int imageHeight = img.getHeight();
                        int numberOfPages = (int) Math.ceil(minY / (double) pixelsPerPageY);
                        // print each page
                        for (int i = 0; i < numberOfPages; i++) {
                             int startY = i * pixelsPerPageY;
                             // get a subimage which is exactly the size of one page
                             BufferedImage subImg = img.getSubimage(0, startY, pixelsPerPageX, Math.min(y - startY, pixelsPerPageY));
                                                 // mod: different .write() method to use the iwparam parameter with highest quality compression
                             writer.write(null, new IIOImage(subImg, null, null), iwparam);
                             SimpleDoc sd = new SimpleDoc(out.toByteArray(), DocFlavor.BYTE_ARRAY.JPEG, null);
                             printDocument(sd, ps);
                             // reset the ByteArray so we can start the next page
                             out.reset();
                   } catch (PrintException e) {
                        System.out.println("Error printing document.");
                        e.printStackTrace();
                        return false;
                   } catch (IOException e) {
                        System.out.println("Error creating ImageOutputStream or writing to it.");
                        e.printStackTrace();
                        return false;
                   // uncomment this code and comment out the 'try-catch' block above
                   // to print to a JFrame instead of to the printer
                   /*          JFrame jf = new JFrame();
                             PaintableJPanel jp = new PaintableJPanel();
                             jp.setImage( img );
                             JScrollPane jsp = new JScrollPane( jp );
                             jf.getContentPane().add( jsp );
                             Insets i = jf.getInsets();
                             jf.setBounds( 0, 0, newX, y );
                             jf.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
                             jf.setVisible( true );*/
                   return true;
              * Print the document to the specified PrintService.
              * This method cannot tell if the printing was successful. You must register
              * a PrintJobListener
              * @return false if no PrintService is selected in the dialog, true otherwise
              public boolean printDocument(Doc doc, PrintService ps) throws PrintException {
                   if (ps == null)
                   return false;
                   addAllPrintServiceAttributeListeners(ps);
                   DocPrintJob dpj = ps.createPrintJob();
                   addAllPrintJobListeners(dpj);
                   dpj.print(doc, attributes);
                   return true;
              public PrintService showPrintDialog() {
                   return ServiceUI.printDialog(gc, x, y, services, defaultService, flavor, attributes);
              private void addAllPrintServiceAttributeListeners(PrintService ps) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < psalListeners.size(); i++) {
                   PrintServiceAttributeListener p = (PrintServiceAttributeListener) psalListeners.get(i);
                   ps.addPrintServiceAttributeListener(p);
              private void addAllPrintJobListeners(DocPrintJob dpj) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < pjlListeners.size(); i++) {
                   PrintJobListener p = (PrintJobListener) pjlListeners.get(i);
                   dpj.addPrintJobListener(p);
              // uncomment this also to print to a JFrame instead of a printer
              /* protected class PaintableJPanel extends JPanel {
                   Image img;
                   protected PaintableJPanel() {
                        super();
                   public void setImage( Image i ) {
                        img = i;
                   public void paint( Graphics g ) {
                        g.drawImage( img, 0, 0, this );
    Thanks
    Ram

    Ram,
    I have had printing problems too a year and a half ago. I used all printing apis of java and I still find that it is something java lacks. Now basically you can try autosense. To check whether your printer is capable of printing the docflavor use this PrintServiceLookup.lookupPrintServices(flavor, aset); . If it lists the printer then he can print the document otherwise he can't. I guess that is why you get the error.
    Regards,
    Kevin

  • Help me - I have a problem of using the javax.smartcardio

    Hi everybody!!!
    I'm creating an application to communicate with javacard.
    I searched on internet and know about javax.smartcardio.
    But I can not use it, even it's inside the default library of Java 6.
    I already import the javax.smartcardio.*; to my java file.
    But it can not find the class inside this package.
    Can somebody help me? Thanks a lot.

    Hi everybody.
    I got the advice from Mr. Safarmer on this forum.
    So:
    If you're using Eclipse to develop the application.
    You have to set the JRE Library to Alternate JRE.
    Below is the instruction for dummies like me ^^:
    Go to Build Path > Configure Buil Path of your project
    In Libraries tab, Edit the JRE System Library
    Instead of choosing the Execution Environment, we choose Alternate JRE (usually jre6)--> This is my case. And i did it.

  • Help needed to run JSTL 1.1 in Tomcat 6.0.16

    Hi All,Help needed to run JSTL 1.1 in Tomcat 6.0.16. I am trying to run the example given in http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html The example tries to connect to MySQL database from JSP using JSTL and JNDI Datasource.I am running the example using Eclipse 3.4.2 using Sysdeo plugin to start and stop Tomcat server from Eclipse IDE.
    My web.xml file has <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    </web-app>
    and test.jsp has proper taglib directives
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    I have placed the jstl.jar and standard.jarof the jakarta-taglibs-standard-1.1.2.zip under E:\Deepa\workspace\DBTest\WebContent\WEB-INF\lib directory also placedcontext.xml file under E:\Deepa\workspace\DBTest\WebContent\META-INF and the content of context.xml is as below
    <Context path="/DBTest" docBase="DBTest"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000"
    username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
    </Context>
    Now while running the example, Eclipse creates one DBTest.xml file under C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
    which has the following line:
    <Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest" workDir="E:\Deepa\workspace\DBTest\work" />
    I am getting the following error when running http://localhost/DBTest/WebContent/test.jsp
    in Browser:
    <HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    In the Tomcat Server console, I am getting the following error:
    INFO: Server startup in 7295 ms
    May 20, 2009 6:36:48 AM org.apache.jasper.compiler.TldLocationsCache processWebDotXml
    WARNING: Internal Error: File /WEB-INF/web.xml not found
    May 20, 2009 6:36:48 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    what is the problem with my code?
    When running the same example, by creating a local server in Eclipse(creating new Server connection pointing to same Tomcat 6.0 installation) it runs fine without any error.

    Hi evnafets,
    Wow, very helpful information, great insight into working of Eclipse. Thanks a lot.
    I have one more question. I have a context.xml file under {color:#0000ff}E:\Deepa\workspace\DBTest\WebContent\META-INF{color} folder and that has the Resource element to connect to MySQL database:
    {code{color:#000000}}{color}<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    {color:#0000ff}url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>{color}
    {color:#0000ff}</Context>{color}As usual when running application in local Tomcat server of Eclipse, this data source works fine. But when I run the application on Tomcat, by starting Sysdeo plugin from Eclipse, the DBTest.xml file created in C:\Tomcat 6.0\conf\Catalina\localhost has the context entry as<Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest\WebContent" workDir="E:\Deepa\workspace\DBTest\work">
    </Context>The<Resource> element I have specified in the context.xml of \WebContent\META-INF folder is not taken into account by Tomcat and it gives the following error:May 21, 2009 5:20:04 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException_: Cannot create JDBC driver of class '' for connect URL 'null'"
    _at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(_QueryTagSupport.java:276_)
    at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(_QueryTagSupport.java:159_)
    at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(_test_jsp.java:113_)
    at org.apache.jsp.test_jsp._jspService(_test_jsp.java:66_)
    at org.apache.jasper.runtime.HttpJspBase.service(_HttpJspBase.java:70_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.jasper.servlet.JspServletWrapper.service(_JspServletWrapper.java:374_)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(_JspServlet.java:342_)
    at org.apache.jasper.servlet.JspServlet.service(_JspServlet.java:267_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:290_)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:206_)
    at org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:233_)
    at org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:191_)
    at org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:128_)
    at org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:102_)
    at org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:109_)
    at org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:286_)
    at org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:845_)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(_Http11Protocol.java:583_)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(_JIoEndpoint.java:447_)
    at java.lang.Thread.run(_Thread.java:619_)
    {code}
    So to overcome this error I had to place the <Resource> element in DBTest.xml under C:\Tomcat 6.0\conf\Catalina\localhost {color:#000000}and then it works fine. {color}{color:#ff0000}*Why is the context.xml file in META-INF not considered by Tomcat server using Sysdeo Plugin?*
    *Thanks,*
    *Deepa*{color}
    {color}
    Edited by: Deepa76 on May 26, 2009 9:32 PM

  • Urgent help needed in jtable

    PLEASE could someone help me look at this and see why the color of my data in a jtable cell is niot turning red when I press enter
    THX
    package mintest;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.table.*;
    import com.borland.jbcl.layout.*;
    import java.awt.color.*;
    import javax.swing.event.*;
    import java.awt.Image;
    import javax.swing.ImageIcon;
    import javax.swing.AbstractButton;
    import javax.swing.JButton;
    import java.awt.datatransfer.*;
    import javax.swing.BorderFactory;
    import javax.swing.border.Border;
    import javax.swing.border.TitledBorder;
    import javax.swing.border.EtchedBorder;
    import java.io.*;
    import java.awt.print.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import javax.swing.BorderFactory;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.border.Border;
    import javax.swing.table.TableCellRenderer;
    import java.awt.Color;
    import java.awt.Component;
    import javax.swing.table.DefaultTableCellRenderer;
    public class VeckoSchema extends JPanel
    private boolean DEBUG = false;
    JTabbedPane tabbedPane;
    Color rgdcolor2= new Color (0,153,255); //Definiera f?rgen f?r schema-,projekt- och l?nehuvudflikarna
    Color rgdcolor1= new Color (0,102,255);
    Color rgdcolor3= new Color (51,204,255); //Definiera f?rgen f?r schema-,projekt- och l?nehuvudflikarna
    Color rgdcolor= new Color (0,0,153);
    Color rgdcolor4= new Color (153,153,153);
    JList list;
    DefaultListModel listModel = new DefaultListModel();
    ImageIcon icon= new ImageIcon ("D:\\Dokument\\Skolarbete\\Examens projekt\\JAVA\\minTest\\Bakgrundsbild2.jpg");
    ImageIcon icon1= new ImageIcon ("D:\\Dokument\\Skolarbete\\Examens projekt\\JAVA\\minTest\\Save16.gif");
    ImageIcon icon2= new ImageIcon ("D:\\Dokument\\Skolarbete\\Examens projekt\\JAVA\\minTest\\printer2.gif");
    JButton spara;
    JButton Ok_knapp = new JButton();
    JPanel panel7;
    TitledBorder title;
    Border blackline;
    JTable table = new JTable(new MyTableModel());
    int x;int y;
    Object data1;
    //ColorRenderer renderer;
    Color mincellColor= Color.red;
    TableCellRenderer Renderer;
    public VeckoSchema() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception
    this.setBackground(rgdcolor2);
    this.setLayout(null);
    //Skapa tabellen
    //JTable table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setBounds(30, 40, 1000, 600);//(avst?nd fr?n v?nster sidan 49, avst?nd fr?n norr 39, bredd 144, h?jd 38));
    this.add(scrollPane);
    //TableCellRenderer weirdRenderer = new WeirdRenderer();
    table.setCellSelectionEnabled(true);
    table.requestFocus(true);
    table.getInputMap().put(KeyStroke.getKeyStroke(
    KeyEvent.VK_ENTER, 0),
    "check");
    table.getActionMap().put("check", new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
    try {
    System.out.println("BINGO");
    x= table.getSelectedColumn() ;
    y= table.getSelectedRow() ;
    //System.out.println("markerad kolumn ?r" + table.getSelectedColumn()) ;
    //System.out.println("markerad Rad ?r" + table.getSelectedRow()) ;
    // table.setColumnSelectionAllowed(true);
    data1 = table.getModel().getValueAt(
    table.getSelectedRow(),
    table.getColumnModel().getColumn(
    table.getSelectedColumn()).getModelIndex());
    System.out.println("markerad text inneh?ller" + data1);
    x= table.getSelectedColumn() ;
    y= table.getSelectedRow() ;
    /* table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column)
    System.out.println("hejsan hoppsan markerad text inneh?ller" + data1);
    Component cell =super.getTableCellRendererComponent(table, value, isSelected,hasFocus, row, column);
    if (row == y && column == x ) {
    System.out.println("rad"+y);
    System.out.println("column"+x);*/
    //cell.setFont(new java.awt.Font("Dialog", 0, 20));
    /* cell.setForeground(Color.red);
    else
    cell.setForeground(null);
    return cell;
    // ColorRenderer centerRenderer = new ColorRenderer();
    // Use renderer on a specific column
    /* TableColumn column = table.getColumnModel().getColumn(
    table.getColumnModel().getColumn(
    table.getSelectedColumn()).getModelIndex()
    column.setCellRenderer( centerRenderer );
    table.setDefaultRenderer(String.class, centerRenderer);*/
    class table extends JTable {
    ColorRenderer multiRenderer=new ColorRenderer();
    table(MyTableModel tm)
    super(tm);
    public TableCellRenderer getCellRenderer(int row,int col) {
    if (row == y && col == x) return multiRenderer;
    else return super.getCellRenderer(row,col);
    catch(Exception x) {
    x.printStackTrace();
    class MyTableModel extends AbstractTableModel {
    String[] columnNames = {"",
    "M?NDAG",
    "TISDAG",
    "ONSDAG",
    "TORSDAG",
    "FREDAG",
    "L?RDAG",
    "S?NDAG"};
    Object[][] data = {
    {"Anna Svensson","", "","Eji Eze", "","","",""},
    {"","", "","", "Christopher ?kesson","Eji Eze","",""},
    {"","", "","", "","Sara Eggert","",""},
    {"Eji Eze","", "","", "","","",""},
    {"Stefan Wielsel","", "","", "","","",""},
    {"","", "","", "","","Anna Persson","Markus Nilsson"},
    {"","Markus Nilsson", "Malin Mejby","", "","","",""},
    {"","Stefan Wiesel", "","", "","","",""},
    {"","Anna Svensson", "","", "","","",""},
    public int getColumnCount() {
    return columnNames.length;
    public int getRowCount() {
    return data.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int row, int col) {
    return data[row][col];
    /* Denna metod g?r det m?jligt att ?ndrar i tabellen*/
    public boolean isCellEditable(int row, int col) {
    if (col < 8) {
    return false;
    } else {
    return true;
    /*Denna metod g?r s? ?ndringarna som g?rs i en viss cell inte f?rsvinnar d? man l?mnar cellen*/
    Object[][] value = {              {"Chiji Eze"},
    int row= 3;
    int col = 4;
    public void setValueAt(Object value, int row, int col) {
    /* if (DEBUG) {
    System.out.println("Setting value at " + row + "," + col
    + " to " + value
    + " (an instance of "
    + value.getClass() + ")");
    data[row][col] = value;
    fireTableCellUpdated(row, col);
    /* if (DEBUG) {
    System.out.println("New value of data:");
    printDebugData();
    /* private void printDebugData() {
    int numRows = getRowCount();
    int numCols = getColumnCount();
    for (int i=0; i < numRows; i++) {
    System.out.print(" row " + i + ":");
    for (int j=0; j < numCols; j++) {
    System.out.print(" " + data[i][j]);
    System.out.println();
    System.out.println("--------------------------");*/
    /*class MyCellColor extends DefaultTableCellRenderer
    public MyCellColor()
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column)
    JLabel result = null;
    if(isSelected && value != null)
    result = new JLabel(value.toString());
    result.setOpaque(true);
    result.setForeground(Color.blue);
    System.out.println("Result "+result.getText());
    System.out.println("Color is "+result.getForeground());
    return result;
    /* public TableCellRenderer getCellRenderer (int row, int column)
    //seulement pour la premiere colonne
    if (column == 0)
    return Renderer;
    // sinon le Renderer par d?faut
    return super.getCellRenderer (row, column);
    class ColorRenderer extends JTextArea implements TableCellRenderer{ //DefaultTableCellRenderer
    Color testfarg;
    public ColorRenderer( ){
    testfarg= Color.red;
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    System.out.println("hejsan hoppsan markerad text inneh?ller" + data1);
    //Component cell =super.getTableCellRendererComponent(table, value, isSelected,hasFocus, row, column);
    if(row==y && column == x)
    setForeground(testfarg);
    else
    setBackground(null);
    return this;

    You really need to study this tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    After you have read it, take a look at this example, and tweak it to suit your needs:
    import javax.swing.table.*;
    import javax.swing.*;
    public class Test {
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().add(new JScrollPane(new JTable(new MyTableModel())));
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    class MyTableModel extends AbstractTableModel {
      private String columnNames[] = new String[] {
          "Name", "Checked"
      private Class columnClasses[] = new Class[] {
          String.class, Boolean.class
      private Object data[][] = new Object[][] {
          { "One", Boolean.TRUE },
          { "Two", Boolean.FALSE },
          { "Three", Boolean.FALSE },
          { "Four", Boolean.TRUE },
      public int getColumnCount() {
        return columnNames.length;
      public int getRowCount() {
        return data.length;
      public Object getValueAt(int rowIndex, int columnIndex) {
        return data[rowIndex][columnIndex];
      public Class getColumnClass(int columnIndex) {
        return columnClasses[columnIndex];
      public String getColumnName(int columnIndex) {
        return columnNames[columnIndex];
      public boolean isCellEditable(int rowIndex, int columnIndex) {
        if (columnIndex == 1)
          return true;
        else
          return false;
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        data[rowIndex][columnIndex] = aValue;
    }

  • Javax.smartcardio package not found in Java source file

    I downloaded the latest JDK from developer.apple.com, but now I cannot find the javax.smartcardio package in the source package (src.jar) that came with it. I unpacked the JAR file, but simply can't find the stated package. Can you help me out?

    I can confirm the issue here (Mountain Lion, 10.8.5). A very simple program (attached below) that just enumerates terminals and checks if a card is present will crash:
    If Apple JDK6 is used in 64-bit mode (without supplying the -d32 argument)
    If Oracle JDK7 is used (can not switch to 64-bit, uses)
    It will work if:
    If Apple JDK6 is forced into 32-bit mode using -d32
    If Oracle JDK7 version of libj2pcsc.dylib is replaced with a patched version
    javax.smartcardio on Mac OS X is in a truly sad state. :-(
    Can anyone suggest alternatives for Smartcard communication on Mac OS X fat clients?
    package com.example.smartcardio;
    import javax.smartcardio.CardTerminal;
    import javax.smartcardio.CardTerminals;
    import javax.smartcardio.TerminalFactory;
    public class TestWaitForChanges {
              public static void main(String[] args) throws Exception {
                        CardTerminals terminals = TerminalFactory.getDefault().terminals();
                        while (true) {
                                  for (CardTerminal terminal : terminals.list()) {
                                            System.out.println("Checking terminal: " + terminal.getName());
                                            System.out.println("Card present: " + (terminal.isCardPresent() ? "YES" : "NO"));
                                  System.out.println("Waiting for changes...");
                                  terminals.waitForChange();

  • Cant figure this out! Help needed!

    Hi,
    Ok I need some clearing up and some help. This is a program that generates receipts for an art supply store which sells three items: a brush set; a set of oil paints; and a can of oil canvas primer. The program is able to process multiple orders. For each order placed, calculate the order and print a receipt itemizing each item @ cost, the tax, the Environmental Levy, and the total cost.
    The cost of the items are:
    1- Brush Set: $8.00
    2- Set of Oil Paints: $40.00
    3- Oil Canvas Primer: $18.75
    4- Taxes: 14%
    5-Environmental Levy: 2% on all oil based products (including the paint set and primer). Levy calculated on product cost only (i.e. calculate without tax).
    The program should also keep track of the total numbers of each item ordered. Using these values, the user can, at any time, generate a receipt summarizing all orders placed up to that point. When the user enters the sentinel to quit the program, calculate and print one final receipt summarizing all of the orders that were placed. You should also calculate and print some receipt statistics: the average cost of the receipts and the smallest and largest receipts (in terms of cost).
    Your program will make use of 2 static methods (in addition to the main() method): toCurrency() and createReceipt().
    Ok the deal is that I have the input loops set up fine they all work, except for Total because nothing shows up! I dont know what to do for the output nor the calculations and where or what methods I have to use and how to call them up into Main. This is what I have so far...I added in comments to guide myself but I cant figure it out...Please help thanks
    import javax.swing.*;
    import java.text.NumberFormat;
    class Store{
    public static void main(String[]args){
    String input = JOptionPane.showInputDialog(null,"Welcome to the Arts Store! \nEnter the following selections: \nOrder\nTotal\nQuit");
    String header,numBrush,numOil,numCan;
    while(!input.equalsIgnoreCase("quit"))
              if(input.equalsIgnoreCase("order"))
                        numBrush = JOptionPane.showInputDialog(null,"Enter the Amount of Brushes:");
                        double brush = Double.parseDouble(numBrush);
                        numOil = JOptionPane.showInputDialog(null,"Enter the Amount of Oil Paint:");
                        double paint = Double.parseDouble(numOil);
                        numCan = JOptionPane.showInputDialog(null,"Enter the Amount of Canvas Primer:");
                        double canvas = Double.parseDouble(numCan);
         else if(input.equalsIgnoreCase("total")){
              //calculate the reciept
              //call the method createReciept
         else
              System.out.println("Sorry wrong input! Try again!");
              input = JOptionPane.showInputDialog(null,"\nEnter the following selections: \nOrder\nTotal\nQuit");
         }//end while loop
    //calculate and print final reciept
    //call up createReciept() method
    //display average cost and smallest and largest order
         }//end main
    public static String toCurrency(double value) {
    NumberFormat num =NumberFormat.getCurrencyInstance();
    String str = num.format(value);
    return str;
    public static double createReceipt(String header, double numOfBrushSets, double numOfOilPaints, double numOfPrimers){
    /*This method will generate a receipt in System.out.println
    This method has 4 parameters: a String header that describes the order being calculated
    (e.g. "Receipt Number 1", "Total of 10 Receipts", etc.) and 3 int parameters for the number of Brush Sets, Oil Paints, and Oil Canvas Primers.
    Calculate the cost each item, the tax, the environmental levy (2% only on oil based products), and the total receipt cost.
    Use toCurrency() to format all currency values to 2 decimal places. Finally, createReceipt()
    should return the total cost to the calling method where it will be used to update the receipt statistics. */
    numOfBrushSets=8.00;
    numOfOilPaints=40.00;
    numOfPrimers=18.75;
    double total=numOfBrushSets+numOfOilPaints+numOfPrimers;
    double tax;
    tax=total*0.15;
    System.out.println("Welcome to the Store");
    System.out.println(" You have purchased this many brush sets:"+numOfBrushSets);
    System.out.println(" You have purchased this many paint buckets:"+numOfOilPaints);
    System.out.println(" You have purchased this many canvas primer sets:"+numOfPrimers);
    return tax;
    }

    import java.text.NumberFormat;
    import javax.swing.*;
    public class StoreRx {
        public static void main(String[]args) {
            String input = JOptionPane.showInputDialog(null,"Welcome to the Arts Store!" +
                              "\nEnter the following selections: \nOrder\nQuit");
            // create some variables to remember things as we go
            int totalBrushes = 0;
            int totalPaint   = 0;
            int totalPrimer  = 0;
            double totalReceipts = 0;
            double smallestReceipt = Double.MAX_VALUE;
            double largestReceipt  = Double.MIN_VALUE;
            int count = 0;
            while(!input.equalsIgnoreCase("quit")) {
                if(input.equalsIgnoreCase("order")) {
                    String numBrush = JOptionPane.showInputDialog(null,
                                     "Enter the Amount of Brushes:");
                    int brush = Integer.parseInt(numBrush);
                    String numOil = JOptionPane.showInputDialog(null,
                                     "Enter the Amount of Oil Paint:");
                    int paint = Integer.parseInt(numOil);
                    String numCan = JOptionPane.showInputDialog(null,
                                     "Enter the Amount of Canvas Primer:");
                    int canvas = Integer.parseInt(numCan);
                    double total = createReceipt(brush, paint, canvas);
                    if(total < smallestReceipt)
                        smallestReceipt = total;
                    if(total > largestReceipt)
                        largestReceipt = total;
                    totalBrushes  += brush;
                    totalPaint    += paint;
                    totalPrimer   += canvas;
                    totalReceipts += total;
                    count++;
                else
                    System.out.println("Sorry wrong input! Try again!");
                input = JOptionPane.showInputDialog(null,
                            "\nEnter the following selections: \nOrder\nQuit");
            }//end while loop
            // "quit" brings us here
            System.out.println("Welcome to the Store");
            System.out.println(" You have purchased this many brush sets: " +
                                 totalBrushes);
            System.out.println(" You have purchased this many paint buckets: " +
                                 totalPaint);
            System.out.println(" You have purchased this many canvas primer sets: " +
                                 totalPrimer);
            //display average cost and smallest and largest order
            double average = totalReceipts/count;
            System.out.println("smallestReceipt = " + toCurrency(smallestReceipt) + "\n" +
                               "largestReceipt  = " + toCurrency(largestReceipt)  + "\n" +
                               "average receipt = " + toCurrency(average));
        }//end main
        public static String toCurrency(double value) {
            NumberFormat num = NumberFormat.getCurrencyInstance();
            String str = num.format(value);
            return str;
         * This method will generate a receipt in System.out.println
         * This method has 4 parameters: a String header that describes the order being
         * calculated (e.g. "Receipt Number 1", "Total of 10 Receipts", etc.) and 3 int
         * parameters for the number of Brush Sets, Oil Paints, and Oil Canvas Primers.
         * Calculate the cost each item, the tax, the environmental levy (2% only on oil
         * based products), and the total receipt cost. Use toCurrency() to format all
         * currency values to 2 decimal places. Finally, createReceipt()
         * should return the total cost to the calling method where it will be used to
         * update the receipt statistics.
        public static double createReceipt(int brushes, int paints, int primers) {
            double priceOfBrushSets =  8.00;
            double priceOfOilPaints = 40.00;
            double priceOfPrimers   = 18.75;
            double taxRate = 0.14;
            double environLevy = 0.02;
            double subTotal = brushes * priceOfBrushSets +
                              paints  * priceOfOilPaints +
                              primers * priceOfPrimers;
            double total = subTotal * (1.0 + taxRate + environLevy);
            return total;
    }

  • Help needed on CD740 ???

    Help needed on CD740 ? My CD740 is GREAT , well , it was great !!? The sound and general performance are wonderful , but , it now has a fault !!? Shock Horror !!
    What can it be ?!!? Well , the display illumination has failed , as in , there isn't any !!? Have to use a torch to read it !!? Not good. Now , here's the thing , I want a phone number (UK zone) ?to talk to an actual human and I cannot find one !!? That is soooooo annoying !!? The unit is out of warranty so I want to repair this myself , no worries , I once worked for Philips in their pro studio equipment repair workshop so I know my way around black boxes !! I would like a service manual though so that I can get the case apart without damage. So , can anyone help me with a phone number , pretty please ?!!
    Thanx.

    I tried compling servlet, but it is raising error
    that coul not find package javax.servletWhat I did not mention... you need to add those JARs in the Classpath explicitly. You will find them in %TOMCAT_HOME%\common\lib. You atleast need to add servlet-api.jar to your Classpath. :)

  • Help needed to loadjava apache poi jars into oracle database.

    Help needed to loadjava apache poi jars into oracle database. Many classes left unresolved. (Poi 3.7, database 11.1.0.7). Please share your experience!

    Hi,
    The first 3 steps are just perfect.
    But with
    loadjava.bat -user=user/pw@connstr -force -resolve geronimo-stax-api_1.0_spec-1.0.jar
    the results are rather unexpected. Here is a part of the log file:
    arguments: '-user' 'ccc/***@bisera7-db.dev.srv' '-fileout' 'c:\temp\load4.log' '-force' '-resolve' '-jarsasdbobjects' '-v' 'geronimo-stax-api_1.0_spec-1.0.jar'
    The following operations failed
    resource META-INF/MANIFEST.MF: creation (createFailed)
    class javax/xml/stream/EventFilter: resolution
    class javax/xml/stream/events/Attribute: resolution
    class javax/xml/stream/events/Characters: resolution
    class javax/xml/stream/events/Comment: resolution
    class javax/xml/stream/events/DTD: resolution
    class javax/xml/stream/events/EndDocument: resolution
    class javax/xml/stream/events/EndElement: resolution
    class javax/xml/stream/events/EntityDeclaration: resolution
    class javax/xml/stream/events/EntityReference: resolution
    class javax/xml/stream/events/Namespace: resolution
    class javax/xml/stream/events/NotationDeclaration: resolution
    class javax/xml/stream/events/ProcessingInstruction: resolution
    class javax/xml/stream/events/StartDocument: resolution
    class javax/xml/stream/events/StartElement: resolution
    class javax/xml/stream/events/XMLEvent: resolution
    class javax/xml/stream/StreamFilter: resolution
    class javax/xml/stream/util/EventReaderDelegate: resolution
    class javax/xml/stream/util/StreamReaderDelegate: resolution
    class javax/xml/stream/util/XMLEventAllocator: resolution
    class javax/xml/stream/util/XMLEventConsumer: resolution
    class javax/xml/stream/XMLEventFactory: resolution
    class javax/xml/stream/XMLEventReader: resolution
    class javax/xml/stream/XMLEventWriter: resolution
    class javax/xml/stream/XMLInputFactory: resolution
    class javax/xml/stream/XMLOutputFactory: resolution
    class javax/xml/stream/XMLStreamReader: resolution
    resource META-INF/LICENSE.txt: creation (createFailed)
    resource META-INF/NOTICE.txt: creation (createFailed)
    It seems to me that the root of the problem is the error:
    ORA-29521: referenced name javax/xml/namespace/QName could not be found
    This class exists in the SYS schema though and is valid. If SYS should be included as a resolver? How to solve this problem?

  • Help needed on Servlets and JSTL

    Hi
    I am using tomcat 5.5 and JDK 1.5. What are the softwares I have to download for compiling servlets and creating JSTL ?. Help needed.
    Thanks
    IndyaRaja

    I tried compling servlet, but it is raising error
    that coul not find package javax.servletWhat I did not mention... you need to add those JARs in the Classpath explicitly. You will find them in %TOMCAT_HOME%\common\lib. You atleast need to add servlet-api.jar to your Classpath. :)

  • Help needed Displaying ALV  Secondary list without using oops concept

    Hi Experts
    Help needed Displaying ALV  Secondary list without using oops concept.
    its urgent
    regds
    rajasekhar

    hi chk this code
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
         I_CALLBACK_PF_STATUS_SET       = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
         IS_VARIANT                     = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    REPORT  Z_ALV_INTERACTIVE  MESSAGE-ID ZMSG_50651
                                    LINE-SIZE 100
                                    LINE-COUNT 60
                                    NO STANDARD PAGE HEADING.
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_PF_STATUS_SET         = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
        IS_VARIANT                      = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
      SUBMIT SLIS_DUMMY WITH P_MATNR EQ IT_VBAP-MATNR
                        WITH P_MTART EQ V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    plz reward if useful

Maybe you are looking for