Nick Wa

Greenhorn
+ Follow
since Nov 28, 2013
Nick likes ...
Netbeans IDE Oracle Java
Merit badge: grant badges
Biography
Completed a BSc in physiology. Currently in my 2nd year of computer science, focusing in software and web development.
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Wa

Without seeing the source code and sample queries you're making, it's very difficult to determine the cause. Normally, EOFException is thrown when the data input stream ends. In this case, perhaps the stream was ended before data could be retrieved, unable to connect (i.e. where you specify the path to the database, username and password), timed out due to far too many connections, etc... .
10 years ago
I understand what you're trying to do, however, you've skipped the crucial steps for using TagSupport. First, you need to create a .java file that either implements or extends TagSupport. If you implement it, there are several methods you'll have to overwrite. If you extend it, you only need to overwrite the methods you'll be using. The documentation for these methods can be found HERE. Second, in your web application, you should have a folder called WEB-INF, which contains web.xml. In this folder, you'll need to add a .tld file, which will provide information for the custom tag. Last, in your JSP, you'll call the custom tag. In order to reference it, you'll use: <%@ taglib uri="WEB-INF/myTagLib.tld" prefix="g" %>. Later in your JSP, you'll use <g: customTag />. In your .tld, you'll define the role of customTag and call the .java. "g" is just a random letter I chose, you can use whichever letter as long as it is not one already in use. For example, if you're going to use JSTL, you shouldn't use "c" as your custom tag.

If you absolutely need to use the custom tag in an <input> tag, then you're going to have to edit the .tld for <input> to include your custom tag. It may be easier to make a new tag and resources just to avoid having to combine your code with the Java and .tld of the <input>.

Also, check out BeanUtils as suggested by Tim Holloway.
10 years ago
JSP
Your code is trying to do a few things at once and it's a bit hard to understand but I might be able to guess it.

The <input> tag has to be in a <form> tag. Afterward, you need to use the proper attributes within the <input> tag. When you use the id attribute, that is generally associated with things such as <label> tags, which assists with the webpage interactivity. Also, the value attribute will print ${beanName1.beanName2.attribute1} to the screen as a string but not access the value it references. In order to retrieve the value from the <input> tag into your JSP, you will need to specify a name attribute. For example:

<label for="myText">Click on this to get into the text box: </label>
<input type="text" name="getThisText" id="myText" />

I'm confused why you're using ${beanName1.beanName2.attribute1} to get the value of a form field. Are you trying to pass that value into attribute1? If so, you'll need to create a constructor in your JavaBean that accepts the desired type and amount of parameters, such as:



Ideally, in your servlet you would be assigning the value using setValue(String str) but you could also do it in a JSP.

If I haven't answered your question, can you please re-phrase what you're trying to do?
10 years ago
JSP
In cases 1-4, after each method is called, flag still is set to true, so it will keep looping that same method infinitely, or until your JDK crashes. To prevent it, either use a counter or simply put flag = false before the break. In order for your menu to loop back on itself, the easiest way would be to call GiftGenerator() in case 5 (or whichever case you want). Keep in mind, this will also cause introduction() to execute. If that will be problematic for your program, then think what you'll have to add or change to your method. Also, you should add a "break" keyword at the end of case 5. Even though it will properly loop back when you call GiftGenerator(), if you decide to add any additional cases, you'll need a break there and it's proper syntax.
10 years ago
Since BlueJ seems to contain classes that are not common to most Java programming or stored in other IDEs, I'll try to give a rough outline of how you can approach the problem of drawing shapes other than lines. I won't go into specific detail with code as it might not be applicable to your IDE.

JCanvas seems to be able to draw lines (and possibly other shapes), so I'm guessing it's like Graphics (or Graphics2D), possibly combined with a Canvas class. When you create a program, including a GUI, there are always events being fired. You have to listen to all the events you're interested in and when a particular one is caught, you should have code that does something. Right now, EventObject events listens for any events fired when the JButtons for drawing a line or oval are fired, or when the user interacts with the canvas (i.e mouse click). What you have to do next is catch the event when the "Draw Oval" JButton is pressed, then use JCanvas to draw an oval.

Since you call .isMouseEvent(EventObject object), is there any method to invoke that detects a button press or an ActionEvent? Sorry for this question but normally, the way you write event-listeners is night-and-day compared to these event-listeners.
10 years ago