Shameless self-promotion coming up...
> So building a Struts Application for the Enterprise is fine, but...what
> if you need to expose some Action such that another system can act on
> it and interoperate with it. It doesn?t have to be a fully functionally
> Axis/SOAP interface or have a UDDI d
On Tue, February 1, 2005 2:01 pm, [EMAIL PROTECTED] said:
> Thank you for your detailed reply. Its really helpfull but i had two
> questions:
I try :)
>>... and it may even be forbidden by J2EE, but... doing it is OK if you
>> are careful a
>
> I had a look in the J2EE-Specification but i can't
Hmm... Could be a cache issue, although that seems kind of unlikely. Try
removing the two cache lines in showPDF.jsp and see what happens. Is there any
chance the file isn't being close after being written, or something along those
lines? I would also use something like HTTPWatch and see what
These seems to come up a lot, I've personally been involved in this discussion
a number of times over the past two months. Someone should probably write a
Wiki entry somewhere (assuming one doesn't exist already).
The discussion generally it seems comes to this conclusion:
We've all heard that
n Tue, February 1, 2005 11:56 am, Derek Broughton said:
> On Tuesday 01 February 2005 10:46, you wrote:
>> I do something like this in one app...
>
> Frank, fzlists and Frank Zametti are stuttering again...
> --
> derek
>
---
Alternatively, if you can live with an IE-only solution, you might consider the
contenteditable attribute of a tag. This does as it's name implies:
allows a user to edit the contents of the div, but more importantly, getting
the value of it results in HTML. You can actually create a whole ric
Re: Capturing input as html under the scenes
Alternatively, if you can live with an IE-only solution, you might consider the
contenteditable attribute of a tag. This does as it's name implies:
allows a user to edit the contents of the div, but more importantly, getting
the value of it results
I do something like this in one app...
I'm creating PDFs on-the-fly and then displaying them on the browser. I have a
directory named temp under my webapp that the PDFs get written to. The files
are named according the the user ID.
You have the Action writing out the file already... if we as
Re: Capturing input as html under the scenes
Alternatively, if you can live with an IE-only solution, you might consider the
contenteditable attribute of a tag. This does as it's name implies:
allows a user to edit the contents of the div, but more importantly, getting
the value of it results
Re: read local file in ActionStruts
I do something like this in one app...
I'm creating PDFs on-the-fly and then displaying them on the browser. I have a
directory named temp under my webapp that the PDFs get written to. The files
are named according the the user ID.
You have the Action wri
Makes sense, thanks. Somewhere along the line I got it in my head that
all static vars are bad. It makes sense that they wouldn't be, I guess I
just got it in my head that they are always bad and never really
questioned why. If nothing else, that quote you references says it all
quite clearly.
Today I find myself converting an existing webapp from using Log4J directly to
using JCL instead. As per the JCL User's Guide, I'm creating a private static
Log variable in all my classes, Struts Actions included.
My question is, why is this OK? Static variables in Actions are a Bad Thing,
th
While I absolutely acknowledge the cleverness of this solution, it's not one I
would personally employ. Making a server application dependent on another
server for startup configuration strikes me as quite a hack (albeit a clever
one!)
> It in fact does make sense to assume that a web service
The only thing with that is if you might need to change those constants while
the application is running, you won't be able to this way. Of course, you
could argue they aren't constants then, and i'd tend to agree! :)
For instance, in one application I wrote, I read in an application
configura
Configure an Action Mapping like so:
http://www.omnytex.com"; redirect="true"
/>
That's all. If you need it to be a little more dynamic, like I notice you said
it was on the same server, if it might be moved from server to server, than get
a reference to the forward above in your Action,
reload()... cool, didn't see that in my reference book. Everyone learns
something new every day! :)
(sure seemed like something that would be there, glad to know I just missed it)
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Thu, Jan
Well, you could either (a) create a form with an action of billpay.do and
submit it, or (b) you could do parent.location="billpay.do". That should
essentially do a refresh.
I'm not aware of any refresh method, unless you are OK with IE-only code... IE
has a number of "commands", as they are ca
Assume you have a form in the parent window that does your refresh, whether
it's visible to the user or not (i.e., has nothing but hidden fields).
Simply do:
parent.theForm.submit();
For that line you weren't sure about. Should do the trick.
--
Frank W. Zammetti
Founder and Chief Software Ar
There's probably a couple of ways to do this, here's one...
I think you can handle the submitting on the popup and closing the window no
problem, but before you do the close, call a Javascript function in the parent
of the popup that will submit a form to do the refresh of the main page.
That'
One possible solution to this "page X processes page X and then sets up page Y"
situation is to (a) have an Action that logically branches based on the URL and
(b) treat one Action as a delegate of another.
For instance, let's say I have Action Mappings PageXSetup, PageXPRocess,
PageYSetup, Pag
Are you saying that some other initialization class will call your setter to
initialize it? And you only want that class to be able to call it? If so,
there's no standard way to do it, but... you could pass in an instance of Class
to the setter, and check that it's only your initializer class.
Well, I guess I made an assumption here... I assumed you would have enough
information to construct a URL using localhost as the server name. I guess
that's not a safe assumption in this case.
So let me understand this scenario further... you are sending a WAR out to a
client, right? When the
You want a private variable and a public static accessor/mutator pair:
public class test {
private static int var;
public static void setVar(int i) {
var = i;
}
public static int getVar() {
return var;
}
}
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Te
I would personally couple this with the thread idea I mentioned earlier...
Spawn a thread to send through a request after a few seconds to check baseURL
or set it as appropriate. That would remove the user interaction aspect, and
probably would get everything set up quicker, at least in a known
Alternatively, you could create a batch file (or shell script for *nix systems)
that updates the WAR with a config file that contains nothing but the URL
(maybe just a .properties file in WEB-INF, nothing more). The plugin could use
that. Then you ship the batch/script file, WAR and config fil
Just thinking out loud here, but...
What if from your plug-in you spawn a thread that will:
(1) Wait a few second, to allow the app to otherwise initialize completely
(2) Make a request to a special Action that will do the rest of the
initialization that requires the URL (should be able to do
h
I thought of something similar too Jim, but my thought was that now they are
coding classes that don't truly adere to the general form of an Action. I
would rather have the basic structure remain the same and just make them have
to remember to call the setup code.
Think of it this way... the m
On Mon, January 24, 2005 12:37 pm, Gianpiero Caretti said:
> FYI, that's exactly what I am doing rigth now!
Great minds think alike :)
> The only think I don't like with this solution is that the JSP writer has
> to
> know the existence of the "command" attribute into request. Moreover if
> the
Good news! :)
FYI, all of my Actions call a common setup function at the start of execute(),
and one of the things it does is set an attribute "command" in the request with
the value of getPath() called on the ActionMapping. I use that in JSPs
sometimes as you are doing, but I didn't want to w
There will be a request attribute under the name
"org.apache.struts.action.mapping.instance". Call getPath() on that (after
casting to an ActionMapping). I'd take a look around to see if there's a
static method somewhere that gets this for you rather than coding the name of
the attribute becau
Another possible approach is to create a DefaultValues class, something along
these lines:
public class DefaultValues {
private HashMap defaultValues;
{
setDefaultValues();
}
public static HashMap getDefaultValues() {
return defaultValues;
}
private static void setDefaultValue
If your looking for something to run WHEN a session expires, the better choice
is probably a SessionListener. I'm not clear on if that's what you really want
though. Assuming it is, here's an example from one of my apps... this
basically updates a list of active users in a static member of a c
Jack,
I think any of the example filters posted should be good templates for what you
want... The question is, how would you detect an expired session now? You'd do
the same in the filter.
Ymight do something like this:
(1) When the user logs on, that is, when you have validated them through
Geez, I wish I'd have known that before! So are you saying that if the browser
doesn't recognize the target as one of the predefined types, it will assume it
should open a new window named according to the target value? That's cool, and
I didn't know it. It would have saved me some trouble a
For my own edification, can you expand on the ability to "...define whatever
target you like"? I've never heard that before, I'd be interested to know
more. I'm wondering specifically since the browser wouldn't know what anything
other than the defined targets you referenced meant, how would y
The two lines I think you want to validate first are:
String sqlQuery = ((ExecuteQueryForm) form).getSQLQuery();
and
session.setAttribute("query",form);
Since they are not within your catch, they could cause problems. If your form
is null, as someone else said, you'd be in trouble.
Also, i
This should probably be an answer on the Wiki since I see this asked quite a
bit...
No, you cannot open a new window from an Action. Not directly anyway. Opening
a window is strictly a client-side activity. Therefore, you have two choices:
(1) Submit a form to _blank, as you said (actually,
On Tue, January 18, 2005 1:56 pm, Peter Wu said:
>> With Struts, there is no separation of page prep and control events. In
>> other words, if you want to submit to the server to update your
>> calendar,
>> you will be responsible for rendering the rest of the page, including
>> any input the use
Sure, I understand completely now. You aren't doing anything unusual at all :)
I think because you came from an ASP.Net background, you have some expectations
that don't apply with Struts (I too came from an MS background, although before
.Net appeared, so I've fought the "why doesn't it work T
You'll have to pry UltraEdit and batch files from my cold, dead hands before I
use any IDE :)
Ok, I'm not really quite THAT extreme. :)
But it has been my experience that no IDE adds anything big enough to deal with
the little annoyances that they all seem to have (most of them seem to have the
On Fri, January 7, 2005 4:11 pm, Jim Barrows said:
> I've never found it onerous. Java works with directory structures.
> Eclipse uses the same directory strucutre that Java would require, and
> makes it extraordinarily easy to refactor your code if you want to.
> I'm not sure what you mean by p
You know, my experience with "Eclipse" has been WSAD, which I've been far less
than impressed with. Maybe I should try plain Eclipse, especially hearing how
all you guys are always singing it's praises. I'm not sure it would be any
better for me personally, but it could be. Worth some time th
Eh, you guys and your fancy IDE's :)
I'm a "by-hand" guy, gimme UltraEdit and a command line and I'm happy (and more
productive than most of the guys here using WSAD frankly), but I have to admit,
plug-ins like that make it tougher to stay that course!
--
Frank W. Zammetti
Founder and Chief So
I always include the following method in all my ActionForms... I'm sure you can
do the same in whatever bean you have, or adapt it to be able to pass the bean
to it if you can't modify the bean itself... This will actually show you all
fields AND their values, but you can of course hack it as yo
To the best of my knowledge, struts does NOT handle this. I have faced this
issue, as I'm sure many have. Here's the code I use to solve it... This is
simply a static method of a Helpers class I reuse throughout most of my
projects... I don't for a second claim it is the best answer, but it do
Wasn't sure this posted the first time, apologies if this winds up a
double-post...
To the best of my knowledge, struts does NOT handle this. I have faced this
issue, as I'm sure many have. Here's the code I use to solve it... This is
simply a static method of a Helpers class I reuse througho
Depends... Do you want this all to happen on the client only, or do you want a
round-trip to the server?
If client-only, just wrap the optional elements in a tag, then use the
onChange event of the element to show the appropriate group (you'll
need to hide eerything else of course... I usuall
There's no way to do it that is Struts-specific, uhh, unless I'm wrong :)
You have to think about what is happening on the browser when PlanAction.java
completes and fowards...
The response is returned to the browser, Offerings.jsp. This page loads
content, Plan.jsp. So, as far as the browser
On Thu, December 23, 2004 9:49 am, Paul McCulloch said:
> Frank,
>
> Although your solution would work I'd be apprehensive about any solution
> which involves doing anything manually at the start of each action. I'd
> suggest that anything that needs to happen for each & every action is
> better
>
> Lord, Frank --- no worries. One of the worst things is people who
> take things too seriously and read jots and tiddles on these lists.
> Relax with me. Sounds like therapy? LOL ;-)
Therapy... I could use that :)
> I did not mean that it was in the response object but accessed within
> the
On Thu, December 23, 2004 9:36 am, Paul McCulloch said:
> I didn't notice this in the thread - but I didn't read it in depth as it
> was
> pretty long.
A long thread?? With Jack and I involved?!? Surely you jest... :)
We're probably the two most verbose guys around these parts!
> I see more r
On Thu, December 23, 2004 9:13 am, Donie Kelly said:
> [Donie Kelly] Hi Guys
>
> OK, I ran through most of what your are telling me and must first thank
> you
> all for the detailed responses.
You spawned an interesting thread! The seemingly simple questions are usually
the ones that do that th
That's what one of my solutions was too, although I wasn't 100% sure the
mapping instance was actually in request (I thought I remembered seeing it, but
wasn't sure).
The argument against doing that though is that the attribute name could
conceivably be changed down the road, breaking your code
Another consideration is that, I believe, .htc's are IE-only. At least, I
think that was the case when I built an app using them a year or two ago. Has
that changed? If not, is being tied to IE an issue for you?
I'd be interested to know if this is across-browser solution, just for my own
kn
Interesting... The latest O'Reilly Dynamic HTML book, which is usually
exceptional in it's completeness and quality, doesn't seem to mention that.
Maybe it's just not layed out how I would have expected and it's in another
part of the book.
In any case, thanks for the info, and for the gentle
You DID put me on to one answer though... I can pass this.innerText, that
works. I'd still like to know what the nodeValue was though, I've never seen
that...
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, December 22, 2004 3:25 p
Hmm, gotta admit you lost me Jeff... is nodeValue a property of an anchor tag?
I don't see it in my references...
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, December 22, 2004 3:16 pm, Jeff Beal said:
> How about:
>
> property
That's indeed what I suspected, but I was hoping...
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, December 22, 2004 3:14 pm, Jeff Beal said:
> The filtering in probably only escapes characters that
> have significance in HTML, not
Hello all... I have a situation where I have to insert a path into a Javascript
call, like so:
");">
Problem is, on Windows anyway, the path includes a backslash, so when rendered
you get for example:
A:\
Solution: Don't use the Struts tags. :)
Seriously, people tend to forget (or don't know to begin with) that they are
NOT required to use Struts.
Alternatively, limit the input via Javascript as an onKeyDown event handler.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Techno
On Wed, December 22, 2004 1:56 pm, Dakota Jack said:
> Plasma TV? Not a new copy of Java Today? LOL ;-)
No self-respecting geek would choose the magazine! :)
(self-respecting geek... talk about an oxymoron!)
> The form has a name from the mapping. Whatever servlet, html, etc.
> you have is g
Yes, if the enjoyment I cause my wo-workers was worth money, I'd be a rich man
indeed. My wife would have her new car and I'd have my 60-inch plasma TV. Oh
well, back to reality :(
The way I read the original post is that he wanted to have some common code in
header.jsp access the form associ
Since the form you'd need to retrieve is named depending on the main page
content, you won't know that information in the header (not easily anyway).
I mean, think of it this way... when your page is converted to a servlet, the
header code is included in with the main page, and then the footer,
I too only develop on XP, but one point I wanted to mention... I generally just
put j2ee.jar in my classpath for build purposes. That gives you the equivalent
of servlet-api.jar and jsp-api.jar, plus just about anything else you might
need. There could concievably be version mismatch issues, b
There is no direct conversion between Java and Javascript objects (I hear tell
of some libraries to do this though...)
What you'll need to do otherwise is iterate over the List and construct
Javascript from it, something like this:
test
myArray = new Array();
<%
int i = 0;
for (Iterator it
Is the path to the config file something you can hard-code? If so, how about
simply a class with a static initializer block to read the config file, then
expose the values through a static getConfig() method returning a static
HashMap? That's about as simple, light-weight and environment-agnos
You might consider doing it all on the client...
test
function preview() {
lyrPreview.innerHTML = "";
lyrPreview.innerHTML += "Some message text...
";
lyrPreview.innerHTML += "
";
}
Select file, then click button to preview:
Preview:
Presumably you would want such a construct to work regardless of what path a
user took to get to a specific page (assuming there ARE multiple paths in your
app, maybe there aren't). So, if it was me, I'd be thinking a linked list
stored in session. Each page that is presented would append itse
Well, certainly a dishonest company in any case is a bad thing. If there is a
law on the book, as there is in my sector, that requires certain things of
them, then there's not much you can complain about as far as the company goes,
but complain all you want to your government representatives of
If I'm understanding your question properly, the easiest way is just to add the
attribute target="_new" in your tag. I don't know how that translates
to the Struts tag as I tend to not use Struts tags, but for a plain-jane
tag, it should get the job done.
I have heard that the target attrib
PLEASE do not take offense from what I am about to say. I do not mean to be
anything but constructive and helpful...
I am concerned that you are trying to build an example for those you will be
teaching because I can see some fundamental misunderstandings, or gaps in your
knowledge. I'd be wi
On Tue, December 7, 2004 10:31 am, Derek Broughton said:
> If you're going to do something that makes it worthwhile putting the JS in
> the
> frame, you probably should be using a script file - in which case it is
> cached anyway and you get the same savings.
What is caching it? The browser? In
I have faced this situation on a number of ocassions. Speaking as someone who
has done it just about every which way, I offer this "best practice"...
I suggest storing them on the file system OUTSIDE the webapp directory. I then
suggest creating an action specifically for returning images. Al
I'm a big believer in simplicity. To that end, the way we work here at my
behest, at least during development, is that applications are simply zipped up
when they need to be moved somewhere and deployed in exploded form. All
developers have Tomcat on their desktop, set up identically, so they
I'm not sure how tricky it is in JavaScript...
function doit(obj) {
obj = obj.form;
i = 0;
while (obj.elements[i] != null) {
if (obj.elements[i].type.toLowerCase() != "button") {
obj.elements[i].value = "";
}
i++;
}
}
Attach this to the onClick event of a button in the f
Argh, just realized my messages haven't been getting through to the list.
Should be working now though
Anyway...
First, I don't think this got to anyone... Ken I think is right (I say I
*think* he's right because I don't really remember writing that comment!).
Reading it back now I suspect I
test
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Access is a file-based database, and really it's just a data file in the end,
the driver is what services queries and such. So, as Lee said, you'll need
something to service the requests in between your client (i.e., your
application) and the .MDB file. A remote server process could do this a
That's a good point, I forgot that. I've added code to handle that situation.
I know that wasn't it though based on the stack trace (the exception is thrown
about 20 lines after the check we're talking about), but I can imagine this
might have come up too, so it made sense to add. Thanks Bria
Hello all. I'm cross-posting this to the Tomcat and Struts lists because I'm
not sure where is more appropriate to post it.
I have an application that is throwing the following sporadic, but thankfully
infrequent, exceptions:
stack trace: java.lang.illegalstateexception: setattribute: session
On Mon, November 1, 2004 3:26 pm, Gary S. Cuozzo said:
>> The forward attribute of your action mappings can point to another
>> action mapping. Would that do the trick for you?
> I suppose it would. How would struts know which mapping I wanted to go
> to in the case of validation errors? Would I
On Mon, November 1, 2004 2:14 pm, Gary S. Cuozzo said:
> Is there a way to make struts forward back to an action (instead of just
> the jsp page) when validation issues are detected?
The forward attribute of your action mappings can point to another action mapping.
Would that do the trick for yo
I think there's some disagreement because they kind of straddle the line.
ActionForms can be simplistically thought of as Data Transfer Objects (DTO's) between
the view and the controller. I say that's simplistic because of things like
validation, which arguably makes them more than just DTO's,
That's a very interesting thought, one I can't say has ocurred to me before... I'm not
aware of any existing code to do that, and if nothing exists I think it's ripe for
being created. I wouldn't mind working on it myself!
The idea of essentially being able to serialize a Javascript object and
You'll probably want to write a Struts plug-in. There's not much to it... Add an
entry to your struts-config.xml file, something like so:
And then write a class along these lines:
package com.company.app.plugins;
public class AppInit implements PlugIn {
public void init(ActionServlet servle
Thanks for the heads-up Ben! Most of my time is spent in IE though... I use HTTPWatch
to do the same thing. The problem though is that I've never once been able to
replicate this problem, so it wouldn't help me any. I suppose I could have all my
users install HTTPWatch, but that wouldn't go o
That's an interesting thought Craig... I actually was very much aware of that
behavior, having been burnt in the past... A lot of my GUI design does in fact disable
elements because it's hard to get disabled elements to look exactly like Windows
elements do when disabled by just manipulating rea
I should point out, before anyone calls me on it, that this is strictly an internal
app that is IE-specific (as per the overlords of the company's orders). Therefore,
there's no chance that user disabled scripting or anything, and indeed they wouldn't
have been able to even log in if they had.
Hello all... I've got a strange situation that's been bugging me for a while. First,
some quick background:
I wrote an application about two years ago that was based on a proprietary framework
that has now been converted to Struts. One of the things this proprietary framework
was missing was
Here's a concrete example of why it's not a good idea...
I had a Struts-based application that I was recently asked to expose (some functions
of) as Web Services. Well, this started me down my whole Struts Web Service Enablment
Project route, but the point is that because it had to be quick, qu
Nothing exists in the taglibs or Struts itself to do this as far as I know, so you'll
have to roll your own.
I have done this in a number of applications, so I'll save you some time... I do not
know how cross-browser this is, most of my work is IE-only (not using much IE-only
functionality, but
I'm not sure I still have the code in my archives, I will look, but I actually had
cause to tackle a problem just like this.
We had an application written by a consultant that is now long gone. He did it in MS
technologies, using XSLT to transform XML to HTML to generate the output to the
brow
Bill, how is it that you write an entire message in surfer-speak, but then at the very
end use a hood term like "word"?!?
POSER! :)
On Tue, October 19, 2004 12:54 pm, Bill Siggelkow said:
> Duude,
>
> Like, man ... no question is stupid ... some of th
Can you smiply have all the forms named the same thing (say, "theForm"), and then on
your links, do:
onClick="theForm.submit();"
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Thu, October 14, 2004 10:59 am, Karsten Krieg said:
> Hi!
>
The problem is that you are calling a method of the class itself, which can only be
static, instead of calling a method of an INSTANCE of the class.
For instance, do this:
SelectRecipientsForm myForm = (SelectRecipientsForm)form;
where form is the form object passed into your Action's execute
Well, if you do decide to go the frames rate, feel free to contact me directly
(probably no need to keep this on the mailing list) with any questions you may have.
I've done three large and rather complex apps, all frames-based, so I've probably
dealt with whatever issues you may run in to.
[
Frames probably would in fact be your "path of least resistance". Frames have, for
some reason, gotten a very bad rap, probably because it's so easy to abuse them (or
architect them poorly and have all sorts of trouble because of it). However, when
used properly, I fail to see why anyone has a
There might be some debate about this, but a daemon thread would be my suggestion.
I know the rule about no spawning threads in a servlet container, but I've always
thought that rule was a bit nebulous... Does it literally mean don't spwan any
threads, or does it mean don't spawn any threads to
In fact it did help because it answered some question for me. I spent the last hour
searching for the RIGHT answer... This looked like it, but for whatever reason it
would never work for me when I tried to do the exact same thing in my own project.
So, I went ahead and hacked together my own s
That will take care of the presentation side, true enough. But the problem I'm still
trying to solve is how to deal with all the parameters when the form submission
happens.
For instance, let's say I dynamically construct names for each drop-down along the
lines of "dropdown" where is
1 - 100 of 111 matches
Mail list logo