Andrew McLaren

Ranch Hand
+ Follow
since May 27, 2005
Merit badge: grant badges
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 Andrew McLaren

I am looking to save an XML document - really a DOM, not an actual file - in a SQL Server database. I've done lots of rummaging, and managed only to confuse myself (which doesn't take much). Any gentle, or not so gentle, nudges in the right direction would be greatly appreciated.

The closest I've been able to get is to convert the DOM to a string, and then write pass that thru a StringReader, and then finally insert it into the table, in an NText column, with .setCharacterStream. That gets some of the text from the DOM in, but not even close to all of it.

Thanks
I downloaded and installed the portal toolkit today (running WSAD 5.1). I am utterly and completely new to portals and such, so maybe I am confused. But when I try to install the Websphere Portal 5.0 for Test Environment, I get message about all sorts of pre-reqs, like the Websphere App Server 5.0.2 image. I don't quite understand all this. I am not running Websphere on my laptop, just WSAD. But what do I need to test a portlet application?
18 years ago

Originally posted by Merrill Higginson:
My best guess would be that "dataSource" does not match exactly what you put in your struts-config.xml file as the form bean to be used by the action.

Do you have the following Entry in your struts-config.xml?

<action name="dataSoure" path="/myAction" ..>

In this case, "myAction" is whatever action is specified in your <html:form> tag.



Aha! That was it, thanks a ton!

Andrew
18 years ago
I am trying to display data from an ActionForm in a jsp page. I want to just write static text. This doesn't work:


But this does (with an html:form):


The bean:write doesn't throw any errors, it just doesn't display anything.
So confused...
18 years ago
Ok, thanks for the reply.

Yes, it works fine with a plain old HTML form. Our architecture folks may have some issues with doing it that way, but at this point it doesn't look like there is much alternative.

Thanks!
18 years ago
Let me see if I can explain this, so that it makes sense.

I have a fairly simple Struts based app that allows a user to populate a form. I want to post that form to an external site, not one within this web application. In the forward for my action, I can't use a redirect, because that results in the request containing the form data being destroyed. But if I don't redirect, I get a 404 Page not found error when it tries to forward to the external URL.

Am I missing something simple here?

Thanks
18 years ago

Originally posted by Stan James:
Your recursion will probably look something like:

Draw out an XML doc with a couple nested folders, follow this through and write down what it would print. I had to do recursion on paper this way many times before it came naturally. It takes a little effort to remember just where to "pop back" when you return from the nested call.

[ December 01, 2005: Message edited by: Stan James ]




Here's what I came up with (liberally pillaged from the dom4j cookbook):



It definitely took me a few stabs to get it going, but it looks to be working so far!
18 years ago
Thanks for all the replies. This is a pretty big lead forward for me, so we'll see how it goes.

And yes, I am using dom4j. I couldn't even imagine trying to write my own parser.

Peace

Andrew
18 years ago
I am attemping to parse through an XML document, which in oversimplified form looks kinda like this:

<root>
<folder>
<table>...</table>
<folder>
<table>...
</folder>
</folder>
</root>

Since I could theoretically have any number of nested <folder> elements, I guess the only way I could do this is through recursion, yes? But I am not entirely sure I have a solid grip on how recursion works. If I have something like 5 nested calls to same method, will Java work it's way back up in the correct order, until I reach the top call?

I hope this makes some semblance of sense.

Thanks!

Andrew
18 years ago

Originally posted by Paul Clapham:
SAXReader isn't in the standard Java API. I guess from my Google search you're asking about the class in DOM4J? What I found didn't have any documentation for this constructorbut the name of the parameter does suggest you should be passing it a class name and not a String containing XML.

Okay, that's what you're doing wrong. How should you do it right? Based on the documentation I saw, I would try something likebut that's just a guess. If it were me I would be looking around the DOM4J documentation for some example code.



Aha! That gets me farther, at least. Now it's complaining about the markup not being well formed, but that I think I can handle.

Thanks much!

Andrew

Originally posted by Ulf Dittmer:
It would be most useful to see the actual exception, particularly the name of the class that is not found.



That's one of the (many!) things that's confusing me here. After the ClassNotFoundException, it gives returns the contents of the string I am passing into SAXReader, implying to me that it is looking for a class named the contents of the string.
But according to the JavaDocs for dom4j, that's a valid constructor.
I am trying to convert a string into a DOMDocument. As far as I can tell, the string is valid XML. Here's the relevant block of code:

It dies on the SAXReader line, although it isn't throwing a SAXException. Instead I get java.lang.ClassNotFoundException: plus the entire string I am trying to convert.

Any ideas on what I am doing wrong?

Originally posted by Jeanne Boyarsky:
Andrew,
You can set system properties if you run the application using "Run...". Then click on the arguments tab. There is a section for VM arguments.



Hooray!

Thanks a ton!

Andrew
18 years ago
I am trying to run a little java application I have developed in WSAD 5.1.2. In the middle of creating an object, the app dies with an OutOfMemoryError.

I can run the app fine from the command prompt with java -Xms100m -Xmx100m.

I can't for the life of me figure out how to do something similar in WSAD. I've tried starting up WSAD with vmargs= -Xms250m -xmx250m, but it makes no difference at all. It dies at the same point. I can watch the memory usage grow on the javaw thread WSAD spawns, and it will consistently die at around 60MB.

Thanks!
18 years ago
Hrm, never used collections like this in Struts before, but it works like a champ!

Thanks a ton!

Andrew
18 years ago