Win a copy of Rust Web Development this week in the Other Languages forum!

Tracy Nelson

+ Follow
since Sep 29, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tracy Nelson

Originally posted by Bear Bibeault:
if you ignore sites whose purpose is to show pictures of kittens and narrow your pool to serious web applications, I think you'll find a much larger percentage of Java-powered sites.

Exactly. I've worked on several (hmmm, more than a dozen, now that I think about it) J2EE projects, and none were for "web sites". If all you want to do is serve HTML and images, then there's nothing wrong with PHP or Perl, and they're both lighter-weight technologies than J2EE. J2EE is for web applications, which are quite a bit different than a blog or forum site. The last really big project I worked on required me to aggregate and present data from sites across the US and Germany in as close to real time as we could manage (the back-end systems were processing tens of millions of bar code scans a day, we could only get filtered and sanity-checked stuff that lagged by about ten minutes). It was hard enough to do that with EJBs, I can't imagine trying to meet reliability and traceability requirements with a home-grown distributed system infrastructure in Perl or PHP...

That said, when I threw together a quick photo-sharing site for my family (a few years ago), I just used PHP, because it was quick and easy.
14 years ago
I have the XML passed as a String to my web method, then I use JAXB to unmarshall it into the appropriate Java class. If you've got a schema defined (and it appears you do), then there shouldn't be any reason to write any parser code. Just use JAXB to generate the classes from your schema and let JAXB do the work.

At least, that's what *I* do....
14 years ago
You want to declare your column with the DATE type. If Oracle gives you a hard time about not specifying a date, you can attach an XSL script to your OracleXMLSave object and add one before saving.
Dynamic SQL is the opposite of stored procedures. What you do is to use a StringBuffer to create your SELECT statement, appending your SORT BY and ORDER BY clauses. Create a PreparedStatment, passing your StringBuffer as the statement to execute. Then just call executeQuery().

If your shop requires that all SQL be performed via stored procedures, then you should talk to your DBA and see if they have any suggestions. Otherwise, you might want to write a small utility that goes out to the database, grabs the metadata for the table you're querying, and generates the stored procedure with the IF statements for every column. At least that way, you don't have to go in and update the SP by hand every time the table schema changes.

Originally posted by Iris Hoekstra:
We're writing an application that needs to be able to insert records into a database with a unique id.

Is the only restriction that the ID must be unique? If so, then you can probably just use Date.getTime() to get the time in milliseconds, then prepend the user ID or some other per-user bit of data.

If the IDs have to be a monotonically increasing series, then you could write a simple sequence generator class that takes a value in its constructor and has a thread-safe getNextId() method that just increments the value and passes back the new value. Initialize it with the value returned from "SELECT MAX(id) FROM <whatever table you're using>". This only has to be done at application startup, so even if it takes a couple of seconds to get the value, it shouldn't be too bad.

If you have to have gapless sequences (e.g., check or invoice numbers), then your safest bet is to use the database sequence table already discussed. If possible, use a stored procedure to control access to the table. This way, you can prevent anyone from modifying the table directly, so nobody introduces gaps or overlaps.

For your two-database situation, I'd recommend using a stateful EJB to hand out new IDs, unless you need gapless numbers. Then I'd recommend you keep the sequence table on only one database, and make all transactions hit that database.

Originally posted by Guy Allard:
tell each one how to set up a shortcut on the desktop that opens your site.

Or maybe write a batch file to stick an entry in their HOSTS file. This would work even if some of them run some flavor of Unix (with a shell script, obviously).
15 years ago

Originally posted by godhs gop:
I have a j2ee application running on a cluster. The input for a functionality is a excel file. Can you tell me if it will be possible to access the file placed in a shared drive from the app?
Thanks in advance.

Depends on if it's accessible from the server. If your server can't (or doesn't) mount the share, then you won't be able to get access to it (modulo intricate schemes involving P2P or other ad-hoc file sharing techniques). If the share is available from the server, then you'll have to do the necessary vis a vis permissions.

Originally posted by Barry Brashear:
I created an ear file from RAD6. Now how can the code be executed outside
of RAD?

Drop it on your app server. Most have an admin console that will let you browse to the EAR file and then deploy it. You may have to set up any data sources and JNDI bindings you're using, too.
15 years ago

Originally posted by Mohit Sinha:

We tried doing an import of the WSDL to the workbench & made it part of our project but still its not giving us what all services are provided by the webservice

How do you know it's not giving you all the services? If a service isn't listed in the WSDL, then it doesn't exist. If someone tries to tell you otherwise, make them give you a WSDL file that shows that service.

Try getting a copy of NetBeans from NetBeans Home. Create a new Web project, and set your Java EE version to 1.4. Then right-click on the project and select "New -> Web Service Client". It'll prompt you for the WSDL URL. Enter that and it'll generate the proper client stubs.

Oh, and I'd push hard to get a current version of Java on your server. WS development with JAX-WS is an order of magnitude easier than writing all those interfaces and specifying endpoints and all the other housekeeping you used to have to do. IBM should have WebSphere 6.1 figured out in a couple of months (it's out now, but largely unusable until they get a profile for Eclipse/RAD figured out, and get their app manager patched up), it supports Java 1.5 (just as 1.6 comes out, hmmmm....)
15 years ago

Originally posted by manish ahuja:

Currently I have a scenario where in the external system to which I have
to send data over web services has published its web service wsdl.
something like this

Now I have to test the service.

Most current IDEs (Eclipse and Netbeans, anyway) have a facility that will generate a test client for you, given a WSDL descriptor. The generated client should be able to marshall and unmarshall the data appropriately for you, and the WSDL should give you a good idea as to what the WS will accept for input.
15 years ago

Originally posted by Srinivas Pitta:
my question was passing the complex object (user defined object) from Client Side when WebService exposes the method of OBJECT type as a parameter.

I don't think this will work. Objects don't have deserializers, so you'd need to cast it into something that was known to support Serializable. And if you're going to do that, you might as well just declare your parameter as a Serializable (at the very least).

What exactly is it you're trying to do? Why would you want to accept unknown objects into your service?
15 years ago
Hi! I've got about two days of JSF experience under my belt, and I'm having a (presumably) simple problem. I've got a simple JSF data entry page that has a couple of date fields in it. When I submit the page, I get an error "Can't set property 'startDate' on class '' to value '8/23/06 12:00 AM'. I've got setters in the Task class that take a String, a java.util.Date, and a java.sql.Date (java.sql.Date is the type I ultimately want). The field in the JSP is defined as:

<h:inputText id="startDate" value="#{task.task.startDate}" title="StartDate" >
<f:convertDateTime pattern="dd-MMM-yyyy" type="date"/>

Any pointers? Is there something I need to add to the converter to handle this? FWIW, I'm using NetBeans 5.5-beta2, and its built-in JSF generator to create the JSF page, controller and converter, so I really have no idea what I'm doing....
15 years ago