Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm relatively new to Java (took in college years ago) and I'm trying to figure out how to call my checkbox class from an example JSP web page I found. The example web page is AffableBean: https://netbeans.org/kb/docs/javaee/ecommerce/page-views-controller.html

And my checkbox class looks like the example at: http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/CheckBoxDemoProject/src/components/CheckBoxDemo.java except mine is called CheckBoxColName.

When you download and run the AffableBean project (see link at bottom of example above), it has a Dairy link. I want to access/check my checkboxes from there, or from a button. I tried adding the following in the category.jsp class like this:

XML
<%@page import="controller.CheckBoxColName"%>
<div id="categoryLeftColumn">
                <div class="categoryButton" id="selectedCategory">
                    <span class="categoryText">dairy</span>


<%
    CheckBoxColName ckBox = new CheckBoxColName();
    ckBox.createAndShowGUI();
    System.out.println("hi");
%>
                </div>

                <a href="#" class="categoryButton">
                    <span class="categoryText">meats</span>
                </a>

                <a href="#" class="categoryButton">
                    <span class="categoryText">bakery</span>
                </a>

                <a href="#" class="categoryButton">
                    <span class="categoryText">fruit & veg</span>
                </a>
            </div>


When I run the project and click the Dairy link, Netbeans says it found 2 matches of dairy in 2 files. category.jsp and also index.jsp. The index file I'm using is from the example. Maybe there's an error in the example, but I'm still not sure how to do this well enough to clean it up and add my own. Any ideas? I tried following the Netbeans example for JSP and couldn't get a web page to work. If you know of a better example that would be great, or if you know what's wrong with the AffableBean example that makes the Dairy error, that would be great too. As far as I know, what I added above isn't the issue.

The relavent index.jsp portion looks like this:
XML
<div id="indexLeftColumn">
               <div id="welcomeText">
                   <p>[ welcome text ]</p>
               </div>
           </div>

           <div id="indexRightColumn">
               <div class="categoryBox">
                   <a href="#">
                       <span class="categoryLabelText">dairy</span>
                   </a>
               </div>
               <div class="categoryBox">
                   <a href="#">
                       <span class="categoryLabelText">meats</


Note that my checkbox code will feed column names into a dynamic table that the user will enter data into. Also, my "hi" and checkbox GUI never show up.
Posted
Updated 2-Apr-14 5:14am
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900