Win a copy of Head First Android this week in the Android forum!

Paul Strachan

Greenhorn
+ Follow
since Oct 24, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Paul Strachan

Yes, an ajax request (if you don't want to refresh the page)
9 years ago
JSP
your code creates an ArrayList with an initialCapacity of 1000 and size of 0.
Perhaps use java.util.Timer invoking Scheduler.interrupt from your InterruptableJob
9 years ago

creates an array object with length == 3, however the elements are null.

creates an array object with length == 3, and each element is a "Books"

or...

etc

Also, your while loop will execute infinitely (u forgot to increment 'x').
9 years ago
Hi,

The browser always displays the address of the last request - AFAIK you can't change that.

One option could be to redirect after each action to your "same url"; this action would only be responsible for "rendering" your page. With this approach all your forms and data need to be defined at session scope.

so, in each action you'd do something like:
in your "same url" render action:
Also if you're using tiles, utilising page controller can sometimes be useful (e.g. call the database to retrieve a list used by the page - storing it on the request)

If you can allow 1 Url per form with multiple methods, try the EventActionDispatcher.
10 years ago
you cant use a result set with jstl because ResultSet does not follow java bean convention for getter method - better to populate a collection of java bean from the original result set. this also has advantage so you can close your ResultSet, Statement and Connection to free resources earlier.
15 years ago
JSP
It makes good design sense to separate your business logic from the struts layer, which is only handling http requests from a browser. What if you wanted to execute the same business logic originating from a wireless device or web service for instance?

Your action classes should call your business logic/model - possibly through a business delegate, but your business model should not depend on http.
15 years ago
What do I do if my ajax request is being redirected for example?
For a "normal" request this is OK, the browser simply displays the response. Its not so nice when the callback method receives some unexpected HTML content.
you could trim() in your value object setter method.
eg.

public void setName(String name) {
this.name = ((name == null) ? null : name.trim());
}

do this for all your String attribute
i have a one to many relationship (unidirectional).

using a session bean facade I try the following:

1. create parent (batch header) entity (PK = batchNo)
Loop
2. create child (batch message) entities (PK = batchNo,SequenceNo)
End Loop

I am confused with a couple of things....

1. when calling the cmr method parent.getMessages(), I get an empty collection - where are my message entities?. They exist in the DB and my deployment descriptor *supposeably* defines a relationship.

(currently, I just call a finder on the child home entity and this works - but its not cmr!!)

2. do I have to "add" each child to the parent?
(eg parent.getMessages().add(child) ?

what does this do?, or better what is the container doing?

3. when I try to "add" I get the following error:
java.sql.SQLException: ORA-00936: missing expression

4. Most examples I have found show how to "get" the collection/related entities but dont show means for managing the relationship (eg updating, creating, removing)

5. I have read somewhere that the container creates a table in the database to manage relationships - is this true? Although my app deploys successfully, there is no "extra" table in the database.

6. In general, I assume you should just be able to get your parent entity (findByPrimaryKey) and call the get..() method returning a collection, so why the need to "add" the child in the first place.

Can someone please shed some light? and advise what the sql exception could be due to. I am happy with the ejb-jar.xml <relationship> - looks OK to me and pretty simple - so I can only think its my orion-ejb-jar.xml which is wrong.

I'm still confused though....thanks