Nicholas Carrier

Ranch Hand
+ Follow
since Apr 14, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Nicholas Carrier

This is probably really simple, but I'm reading Head First: Servlet's and JSP and I understand how this works.

${person.dog.name}



Where there is an attribute of type person that has a property that is an object of type Dog that has a property that is a string which holds his name. In that case it's going to print out the person's dog's name.

What confuses me, and it's really just a side question, is how to do that with [].

This obviously doesn't work because it goes from inner most expression outwards.

${person[dog["name"]}



And prints out nothing because there is no property in the person object that has the same name as say Clifford.

Thanks for you help ahead of time. If I figure it out before anyone replies I'll post my own answer.
18 years ago
JSP

Originally posted by marc weber:

What? You mean there are people who still use Windows?



Marc Weber has asked you a question, would you like to reject it or allow?

Eclispse is the way to go. It has your debugger (which you can debug remotely with), tons of plugins to make life easier (starting and stopping webservers etc), and the intellisense that you desire.

Nicholas has given a response, would you like to reject it or allow
18 years ago
That's what I get for reading a book from 2003

Thanks for your help.
Well a few quick things that are not related to why nothing is showing up:

The event package is never used.
The variables b, c, and f are never used.

As for why nothing happens, that's not really the case. The code runs, it just isn't designed to do anything.

In your code this is what you are doing:

Frame f=new Frame(); // creating a new frame
Label l=new Label("Party at Tim's"); // creating a new label
Button b=new Button("You bet"); // creating a new button
Button c=new Button("Shoot me"); // creating a new button
Panel p=new Panel(); // creating a new panel
p.add(l); // adding the lable to the panel



If you were to put system.out's between each line, you would see that it's processing your code, but that your code doesn't have any output. You have to give the frame a size and make it visible. If you just want to try out something to see how it works, here is an example


import java.awt.*;
import java.awt.event.*;

// a class that gets all the methods and variables from the Frame class
public class Party3 extends Frame {

// a constructor to create an instance of the class Party3
public Party3() {
//Creates a frame with the title BasicApplication Title
super("BasicApplication Title"); // sets the title

// sets the size of the frame
setSize(200, 200); // sets the size

// creates a label with the word's Hello world placed in the center
Label l = new Label("hello world",Label.CENTER);

// adds the label to the frame in the center of the frame
add(l,BorderLayout.CENTER);

// tells the application to close when you press the x button
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false); dispose();
System.exit(0);
}
});
}

// the main method so that it runs
public static void main(String[] args) {

//creates an instance of the class you created above
Party3 app = new Party3();
app.setVisible(true);
}
}



Hope this helps. More importantly, go to the swing section in the book. They explain how Gui's work there. Swing is like AWT but better
[ February 14, 2007: Message edited by: Nicholas Carrier ]
18 years ago
I'm reading Beginning JSP Web Development by Jayson Falkner et al. Apress � 2003 and it says to download the latest request tag library from

http://jakarta.apache.org/builds/jakarta-taglibs/nightly/projects/request/



However, when I go there, the directory is empty. I tried downloading the standard Tag Libraries and it's not in there either. Does anyone know where I can find this?

Thanks ahead of time.
I taught myself to program in java on the subway rides to and from work without any programming experience (aside from basic html, and by basic I mean that I knew how to make a link). Try the Head First Series. I think you'll enjoy it and it's pretty easy to read.
18 years ago
Basically you have too many closing )'s

You have

Product newProd = new Product(Integer.parseInt(txtCost.getText()), txtName.getText()), txtbrief.getText());

It should look like this:

Product newProd = new Product(Integer.parseInt(txtCost.getText()), txtName.getText(),txtbrief.getText());

There is a need for the extra ) after txtCost because you are closing out the parseInt() method, and there is a need for the extra ) after textbrief because you are closing out the constructor, but there is no need for the extra ) after txtName.

Hope that helps.
[ January 22, 2007: Message edited by: Nicholas Carrier ]
18 years ago
You would give the ip address of the router, and then open and point the port in router to the computer that the application is running on. Also, make sure your firewall isn't blocking the port.
18 years ago
This might be old and I'm not sure if it will help (I run openSuse) but since you are echoing the JAVA_HOME variable and it's coming out blank I'm guessing you haven't exported it. In order for you to use a variable in Linux you have to export it. You can try it in the console like so:

JAVA_HOME=whaterever it is
export JAVA_HOME
PATH=$JAVA_HOME:$PATH
export PATH

Then try whatever it is you were going to try. If it works you just have to do that in your profile. Also, does FC6 have Java in the package management system (YUM?)? I'd be surprised if it doesn't. If it doesn't, it definitely will soon now that Java has gone all Open Source on us
18 years ago
Can you not use the javadocs for the JDK that you are using (it has all the variables/methods and definitions), or do you need it for something else?
18 years ago
That's what I thought
18 years ago
Let me ask a question about the first response and answer the second one. Will the get absolute path give me a path that points to the client's machine, or will it take that path and still look on the application server?

Yes, it is a browser, and I don't need to open the file, I just need it to be saved in another program. Basically I need it to work somewhat like when you pass a binary into a database.

I think I'm going to have to try the servlet that you gave me as an example and try to find a way to handle the binary. I'm not sure that the program that my application access will take a binary (but I'm assuming it doesn, even though we all know what happens when you assume). Right now, I'm only able to take a file path.

Can someone point me in the direction to learn more about creating binary and handling binary files?

Thanks
18 years ago
Here is the deal. I have this program that takes a file path and uploads a file into Documentum Server. This works fine when the file is on the server that my application is running on. However, the problem is, that they cannot pass me the file path because the files that are being uploaded are coming from the client's computer, not the server. So, if the application reads a file path, it is going to look on the server machine for the path specified.

The solution is to have the servlet pass me a binary file, and then upload the binary file. Here is where my question lies.

If they create a binary of type File, and then pass me the File object, can I use the getAbsolutePath() method of the File object or is this going to give me the same problem. Will it look for that path on the server, or with the absolutePath point to the actual Binary File.

I appologize in advance if that question is too vague. Let me know what else you are going to need to answer it.

Thanks
18 years ago
I was actually coming here to delete the question

As always, thanks for the help and I'm going to try use a way to make it more readable as suggested.

<----feels dumb
18 years ago
Here's the question: Is there a way to get to the end of a method and skip everything like break in a loop.

For example

public String getAnswer() {
String answer = null;

If (something == somethingElse) {
answer = "Yo' Momma";
// what would go here to go straight to the return
}

// other stuff which would lead to a different answer
answer = "Yo' Sister"

return answer;

}



Is there no other way than using else? Basically, how do I stop a method from finishing and go straight to a return?
18 years ago