You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by gollinger <go...@libero.it> on 2005/09/07 08:13:53 UTC
Re: Problem with a Frameset and Struts (replacing frameset with tiles?)
Hi!
thank you very much for your answer.
Do you think it would generally be better
to use Tiles instead of frameset?
We would like to use the validador-framework
but when we have to use javascript in any case
do you think it would be better not to do this?
Ciao
---------- Initial Header -----------
>From : "Frank W. Zammetti" fzlists@omnytex.com
To : "Struts Users Mailing List" user@struts.apache.org
Cc : "user" user@struts.apache.org
Date : Tue, 6 Sep 2005 10:21:08 -0400 (EDT)
Subject : Re: Problem with a Frameset and Struts
> Hi,
>
> This isn't really a Struts issue per se, it's a frames issue.
>
> When you set the target of the form to display, the response from the
> server is going to go into the bottom frame, regardless of what the
> outcome is (i.e., whether there are errors or not). This is just how
> frames work.
>
> You can do what you want, but it will require client-side coding.
>
> I would suggest having a third frame with a size of 0 (making it hidden)
> and direct your response to it. Add some Javascript to the page that is
> returned that fires in response to the onLoad event. If errors came back,
> copy them over to the search frame, otherwise copy the whole page to
> display. Let's assume you call the hidden frame "hiddenFrame", and let's
> assume there is a <div> with an ID of "errorDiv" in both the returned page
> and what's in the search frame... Here's what I would do:
>
> <html>
> <head>
> <script>
> function loadHandler() {
> if (errorDiv.innerHTML != '') {
> window.top.search.errorDiv.innerHTML =
> window.top.hiddenFrame.errorDiv.innerTML;
> } else {
> window.top.display.document.open();
> window.top.display.document.write(
> window.top.hiddenFrame.document.documentElement.outerHTML);
> window.top.display.document.close();
> }
> </script>
> </head>
> <body onLoad="loadHandler();">
> ...
> </body></html>
>
> So, if errors are present in the <div> on the returned page, they will be
> copied over to the <div> in the search frame. If the <div> is empty on
> the returned page, meaning no errors occurred, the entire page is copied
> over to the display frame.
>
> I'm not sure this is 100% cross-browser, you probably need to use
> getElementById() to make it so, but the basic theory works (I know because
> I do this in a prod app I have).
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Tue, September 6, 2005 8:32 am, gollinger said:
> > I have a frameset with two included jsp's.
> >
> > <frameset rows="15%,85%">
> > <html:frame frameName="search" page="/jsp/awp/search.jsp" />
> > <html:frame frameName="display" page="/jsp/awp/empty.jsp" />
> > </frameset>
> > </head>
> > </html>
> >
> >
> > this is the first jsp inside the frameset with validation
> >
> > and errors should be displayed there:
> >
> > <html:form action="/show" target="display" >
> > <tr>
> > <td width="100">
> > <html:link page="/jsp/index.jsp">Home</html:link>
> > </td>
> > <td colspan="3" align="center"><b>show group</b></td>
> > </tr>
> > <tr>
> > <td><html:text property="abt_id" size="3" value="32"/>
> > </td>
> > <td><html:submit/></td>
> > </tr>
> > <html:errors/>
> > </html:form>
> >
> > the large problem that I have is that I want the errors to be displayed in
> > the first jsp (in the part of the frameset above),
> > where the submit button original is!
> > But the effect is that the original page gets duplicated on the screen und
> > the errors were displayed there!
> >
> >
> > Who can give me an advice?
> >
> > Thanks Antonio
> >
> >
> >
> >
> >
> >
> >
> >
> > ____________________________________________________________
> > 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
> > Scaricalo su INTERNET GRATIS 6X http://www.libero.it
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
____________________________________________________________
Libero Flat, sempre a 4 Mega a 19,95 euro al mese!
Abbonati subito su http://www.libero.it
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Overlaying a propery definition with > 1 ApplicationResources.properties
file
Posted by Gareth Evans <ga...@msoft.co.uk>.
Hi Adam,
You can do this by extending the default MessageResourceFactory to load these files. I use this
approach in my application to load the messages in from a database.
Use the following in your struts-config
<message-resources parameter="ApplicationResources" null="true"
factory="com.your.MessageResourceFactory" />
Regards,
Gareth
Adam Lipscombe wrote:
> Folks,
>
>
> We have a standard ApplicationResources.properties file. If customers want
> customised labels I want to be able to include a 2nd
> ApplicationResources.properties file that contains only those labels that
> have been customised. The 2nd label definition should override the 1st (i.e.
> standard) definition.
> If no customisations have been specified the 2nd file would be empty.
>
>
> E.g.
>
> ApplicationResources.properties
>
> global.greeting=Hello World
> global.message=how are you?
>
>
> CustomApplicationResources.properties
>
> global.greeting=Hi There!
>
>
>
> In the above case using global.greeting would result in "Hi There!" and
> global.message "how are you?"
>
>
> Looking at the Struts documentation it seems that if > 1 properties files
> are used one must give them a key in the struts-config file. This key must
> then be used by the bean:message tags. This wont work in this context 'cos
> the bean:message tags will not be aware of which file the definition
> resides.
>
>
> Is it possible to overlay properties definitions in a second file like this
> without changing the bean:message tags?
>
>
> TIA -Adam
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Gareth Evans
MSoft eSolutions Limited
Technology Centre
Inward Way
Rossmore Business Park
Ellesmere Port
Cheshire
CH65 3EN
--
Tel: +44 (0)870 0100 704
Fax: +44 (0)870 9010 705
E-Mail: gareth@msoft.co.uk
Web: www.msoft.co.uk
----------------------------------------------
Terms:
Please note that any prices quoted within this e-mail are subject to VAT.
All program details and code described in this e-mail are subject to
copyright © of MSoft eSolutions Limited and remain the intellectual
property of MSoft eSolutions Limited.
Any proposal or pricing information contained within this e-mail are
subject to MSoft eSolutions' Terms and Conditions
----------------------------------------------
Disclaimer:
This message is intended only for use of the addressee. If this message
was sent to you in error, please notify the sender and delete this
message. MSoft eSolutions Limited cannot accept responsibility for viruses,
so please scan attachments. Views expressed in this message do not
necessarily reflect those of MSoft eSolutions Limited who will not
necessarily be bound by its contents.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Overlaying a propery definition with > 1 ApplicationResources.properties file
Posted by Adam Lipscombe <ad...@expensys.com>.
Folks,
We have a standard ApplicationResources.properties file. If customers want
customised labels I want to be able to include a 2nd
ApplicationResources.properties file that contains only those labels that
have been customised. The 2nd label definition should override the 1st (i.e.
standard) definition.
If no customisations have been specified the 2nd file would be empty.
E.g.
ApplicationResources.properties
global.greeting=Hello World
global.message=how are you?
CustomApplicationResources.properties
global.greeting=Hi There!
In the above case using global.greeting would result in "Hi There!" and
global.message "how are you?"
Looking at the Struts documentation it seems that if > 1 properties files
are used one must give them a key in the struts-config file. This key must
then be used by the bean:message tags. This wont work in this context 'cos
the bean:message tags will not be aware of which file the definition
resides.
Is it possible to overlay properties definitions in a second file like this
without changing the bean:message tags?
TIA -Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with a Frameset and Struts (replacing frameset with
tiles?)
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Tiles and frames are not at all equivalent, so it's not a simple either-or
answer. It really depends on what your application needs are.
I have done a lot of work with frames and am completely comfortable
developing with them. This is not so for everyone, and there are some
good reasons for it. Given my affection (well, acceptance anyway!) of
frames, I would *still* say that if you don't truly need what they give
you then you probably *don't* want to use them. There are indeed added
complexities with frames, and sometimes some very subtle problems come up
that will give you fits if you don't have a lot of experience with frames,
so if you don't truly need them, Tiles will probably be the better choice.
Of course, you probably should ask whether you need Tiles or not too...
Tiles does have some benefits, but it also adds complexity. I don't want
to overstate it, Tiles is *not* difficult, but you may not even ned that
added complexity, however little it may be.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
On Wed, September 7, 2005 2:13 am, gollinger said:
> Hi!
>
> thank you very much for your answer.
> Do you think it would generally be better
> to use Tiles instead of frameset?
> We would like to use the validador-framework
> but when we have to use javascript in any case
> do you think it would be better not to do this?
>
> Ciao
>
>
>
>
>
>
> ---------- Initial Header -----------
>
>>>From : "Frank W. Zammetti" fzlists@omnytex.com
> To : "Struts Users Mailing List" user@struts.apache.org
> Cc : "user" user@struts.apache.org
> Date : Tue, 6 Sep 2005 10:21:08 -0400 (EDT)
> Subject : Re: Problem with a Frameset and Struts
>
>
>
>
>
>
>
>> Hi,
>>
>> This isn't really a Struts issue per se, it's a frames issue.
>>
>> When you set the target of the form to display, the response from the
>> server is going to go into the bottom frame, regardless of what the
>> outcome is (i.e., whether there are errors or not). This is just how
>> frames work.
>>
>> You can do what you want, but it will require client-side coding.
>>
>> I would suggest having a third frame with a size of 0 (making it hidden)
>> and direct your response to it. Add some Javascript to the page that is
>> returned that fires in response to the onLoad event. If errors came
>> back,
>> copy them over to the search frame, otherwise copy the whole page to
>> display. Let's assume you call the hidden frame "hiddenFrame", and
>> let's
>> assume there is a <div> with an ID of "errorDiv" in both the returned
>> page
>> and what's in the search frame... Here's what I would do:
>>
>> <html>
>> <head>
>> <script>
>> function loadHandler() {
>> if (errorDiv.innerHTML != '') {
>> window.top.search.errorDiv.innerHTML >
>> window.top.hiddenFrame.errorDiv.innerTML;
>> } else {
>> window.top.display.document.open();
>> window.top.display.document.write(
>> window.top.hiddenFrame.document.documentElement.outerHTML);
>> window.top.display.document.close();
>> }
>> </script>
>> </head>
>> <body onLoad="loadHandler();">
>> ...
>> </body></html>
>>
>> So, if errors are present in the <div> on the returned page, they will
>> be
>> copied over to the <div> in the search frame. If the <div> is empty on
>> the returned page, meaning no errors occurred, the entire page is copied
>> over to the display frame.
>>
>> I'm not sure this is 100% cross-browser, you probably need to use
>> getElementById() to make it so, but the basic theory works (I know
>> because
>> I do this in a prod app I have).
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Tue, September 6, 2005 8:32 am, gollinger said:
>> > I have a frameset with two included jsp's.
>> >
>> > <frameset rows="15%,85%">
>> > <html:frame frameName="search" page="/jsp/awp/search.jsp" />
>> > <html:frame frameName="display" page="/jsp/awp/empty.jsp" />
>> > </frameset>
>> > </head>
>> > </html>
>> >
>> >
>> > this is the first jsp inside the frameset with validation
>> >
>> > and errors should be displayed there:
>> >
>> > <html:form action="/show" target="display" >
>> > <tr>
>> > <td width="100">
>> > <html:link page="/jsp/index.jsp">Home</html:link>
>> > </td>
>> > <td colspan="3" align="center"><b>show group</b></td>
>> > </tr>
>> > <tr>
>> > <td><html:text property="abt_id" size="3" value="32"/>
>> > </td>
>> > <td><html:submit/></td>
>> > </tr>
>> > <html:errors/>
>> > </html:form>
>> >
>> > the large problem that I have is that I want the errors to be
>> displayed in
>> > the first jsp (in the part of the frameset above),
>> > where the submit button original is!
>> > But the effect is that the original page gets duplicated on the screen
>> und
>> > the errors were displayed there!
>> >
>> >
>> > Who can give me an advice?
>> >
>> > Thanks Antonio
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ____________________________________________________________
>> > 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
>> > Scaricalo su INTERNET GRATIS 6X http://www.libero.it
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> ____________________________________________________________
> Libero Flat, sempre a 4 Mega a 19,95 euro al mese!
> Abbonati subito su http://www.libero.it
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org