Jim Petersson

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

Recent posts by Jim Petersson

Hi,
I have a html table that is used on multiple jsp-pages. As it is now, every jsp-page has a copy of that table (code is copied over several jsp-pages).
What I would like to do is refactor the code, so that the same table is used on every page.

I tried to put the table in a separate jsp-page, and then do a <jsp:include ...> on it wherever I need it.
This works, but is there a better way to do it? What if I for instance would like to somehow pass in a parameter determining the size of the table? How would that be accomplished?

Thanks
16 years ago
JSP
Hi
I'm using Eclipse to deploy my application (Ejb and Web) to a Glassfish v2 server. This works fine, but I have not managed to do any profiling, normally when you right-click on the server you have an option saying 'Profile'. (Next to start, debug, publish etc.). But the profile option is grayed out for me.
Doesn't Glassfish support profiling mode? It works fine with for instance Jboss.

Thanks, Jim
Ok that makes sense.
I know that you can configure a new datasource using the Glassfish admin console, but I want to be able to deploy my app on a different computer/glassfish server. How can I make it so that my datasource configuration is included with the EAR file?
Hi,
I'm trying to set up a JPA-project ith Glassfish and Derby.
I have one problem, the database "sun-appserv-samples" is used all the time, even though I try to set a different value in my persistence.xml

This is printed to the log:
Connected: jdbc erby://localhost:1527/sun-appserv-samples;;create=true
User: user
Database: Apache Derby Version: 10.4.2.0 - (689064)
Driver: Apache Derby Network Client JDBC Driver Version: 10.2.2.1 - (538595)|#]

My persistence.xml looks like this:


As you can see I'm trying to set the db to 'MyDB'. The values for user and password are used though. Any ideas what I'm doing wrong?

Thanks
[ December 01, 2008: Message edited by: Jim Petersson ]
Ok, so now I've got a small app up and running. I have some EJB's (stateful and stateless), and a web-interface (jsp/servlet) communicating with my beans.
Now I would like to create some Entities using JPA, but I'm not sure how to set it up in Eclipse.
Should I create a new JPA-project? (and somehow connect that to my existing Enterprise project) Or should I just place my beans directly under my EJB-project?

Originally posted by Campbell Ritchie:
Do you mean ctrl-F?



No, what I'm looking for is the same as ALT-C in Editplus for instance.
Found this plugin: http://tkilla.ch/column_mode

But I couldn't get it to work

[ November 17, 2008: Message edited by: Jim Petersson ]
[ November 17, 2008: Message edited by: Jim Petersson ]

Originally posted by Mourouganandame Arunachalam:
Hope Jim is looking for option to column select (something available in editplus editor) kind of stuff.... unfortunately no development tools/editor provide this facilities as per my knowledge....

Mourougan



Yes that's what I'm looking for. I was sure I has used that in Eclipse before, but maybe I remember incorrectly and confused it with editplus/visual studio.
It's a really nice feature, I'm surprised that it doesn't exist in Eclipse
Hi,
Let's say I have the following text in a file in Eclipse:

private int a;
private int b;
private int c;

Is it possible to select/mark just the 'private' part of that text. (for instance if I would like to delete/copy all of them quickly)

Regards, Jim

Originally posted by Reza Rahman:
Jim,

Try the Eclipse project wizard for an enterprise application (deployed as an EAR). It'll walk you through your choices.

Regards,
Reza



Nice, exactly what I was looking for

Btw, thanks for the EJB3 in Action book, helped me alot!

Thanks,
Jim
Hi,
I've just started doing some EJB development, so far I've only used stand-alone java applications to test it and that works fine.
But now I thought I'd try do use a jsp/servlet web-app instead.

How do I set this up in Eclipse? Should I create a separate EJB project and a separate web-projects? (that depends on the EJB-proj)
Or is there some other project type that would incorporate both the EJB and web stuff?

Thanks,
Jim
Hi
I'm using a jsp page with some inputfields. These fields map to fields in a java-bean. What I want to do is have the user enter text in some inputfields, map it to my javabean, and then do a post to a servlet. In the servlet I want to get my bean from the session, and print out its fields (That should have been set by the jsp-page)
My code looks something like this:

JSP:


Servlet (doPost):


What happens is that I can get the Customer object from the session (in my servlet), but the name and number fields are null.

Any suggestions on what I'm doing wrong here?

[ October 28, 2008: Message edited by: Jim Petersson ]
[ October 28, 2008: Message edited by: Jim Petersson ]
16 years ago
JSP
Mike, thanks for the exhaustive reply!
16 years ago

Originally posted by Darryl Burke:
Yuo don't have to think ahead to the equals method. Merely instantiating onw of these classes will lead to a StackOverflow, always assuming the class member is to be instantiated and is not a decorative declaration.



Ahh, of course you are right. Thanks!
16 years ago

Originally posted by Piet Verdriet:


Don't do it like that. That's the best practice I can give.
Perhaps you could tell a bit more about the real problem you're trying to solve?



I don't have any "real" problem. Just came to think of this case the other day and started wondering what would be the best way to handle it.
16 years ago
Hi
Let's say you have two classes that looks something like this:

class A {
public B b;
}

class B {
public A a;
}

That is, A has a member of B and B has a member of A. Now lets say you want to override the equals method for those classes. How would you do that?

If you would do like this:

class A
public boolean equals(Object o) {
A otherA = (A)o;
return this.B.equals(otherA.B);
}

class B
public boolean equals(Object o) {
B otherB = (B)o;
return this.A.equals(otherB.A);
}

You would end up with an infinite recursive call -> stack overflow.
Whats the best practise here?

Thanks, Jim
16 years ago