试图弄清楚如何链接JSP网页和.java复选框类 [英] Trying to figure out how to link JSP web page and .java checkbox class

查看:65
本文介绍了试图弄清楚如何链接JSP网页和.java复选框类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相对较新的Java(几年前读过大学)而我正试图弄清楚如何从我发现的示例JSP网页调用我的复选框类。示例网页是AffableBean: https://netbeans.org/kb/docs/javaee /ecommerce/page-views-controller.html



我的复选框类看起来像以下示例: HTTP:// docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/CheckBoxDemoProject/src/components/CheckBoxDemo.java 除外我的名字叫CheckBoxColName。



下载并运行AffableBean项目时(参见上面例子中的链接),它有一个Dairy链接。我想从那里或从按钮访问/检查我的复选框。我尝试在category.jsp类中添加以下内容:



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:

<%@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>





当我运行项目并点击Dairy链接时,Netbeans说它在2个文件中找到了2个乳品匹配。 category.jsp和index.jsp。我正在使用的索引文件来自示例。也许这个例子中有一个错误,但我仍然不确定如何做到这一点,以便清理它并添加我自己的错误。有任何想法吗?我尝试遵循JSP的Netbeans示例,但无法使网页生效。如果您知道一个更好的例子,或者如果您知道产生Dairy错误的AffableBean示例有什么问题,那也会很棒。据我所知,上面添加的内容不是问题。



相关的index.jsp部分如下所示:



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:

<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</





请注意,我的复选框代码会将列名称提供给动态表格用户将输入数据。此外,我的hi和复选框GUI永远不会显示。



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.

推荐答案

这篇关于试图弄清楚如何链接JSP网页和.java复选框类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆