Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 28 Mar 2008 08:17:11 -0000 Issue 7948

user-digest-help

2008-03-28


Author LoginPost Reply

user Digest 28 Mar 2008 08:17:11 -0000 Issue 7948

Topics (messages 184728 through 184756):

Re: submit and cssStyle
 184728 by: Brian Relph

Re: Message surviving redirect
 184729 by: Jiang, Jane (NIH/NCI) [C]
 184741 by: stanlick.gmail.com
 184750 by: Laurie Harper

Re: @ExpressionValidator - how to set the expression correctly ? (amount either greater than 0 or null? )
 184730 by: xianwinwin
 184732 by: xianwinwin

Re: Struts 1 Javascript Question
 184731 by: Laurie Harper

Action attribute getting set to input content value incorrectly
 184733 by: ryangr
 184735 by: ryangr

Re: s:submit and cssStyle
 184734 by: Okan Özeren

ExceptionMappingInterceptor
 184736 by: stanlick.gmail.com
 184737 by: Dave Newton
 184738 by: stanlick.gmail.com
 184740 by: stanlick.gmail.com

Re: Actions/DAO interaction getting messy...
 184739 by: Adam Hardy

How to get access to session scoped bean in Struts?
 184742 by: simpi
 184743 by: diogo pontual

mapped back property equivalent in struts2
 184744 by: Niral Trivedi
 184745 by: Cheng Wei Lee

Help On Migration
 184746 by: vj,sandeep
 184751 by: Laurie Harper
 184753 by: vj,sandeep

Re: Struts constants
 184747 by: Jeromy Evans

Re: FormFile to Next Page
 184748 by: Laurie Harper

Re: Another select-option question
 184749 by: Laurie Harper

Re: Please answer this struts basic qtn
 184752 by: pannar
 184755 by: Al Sutton

S2/Sitemesh: How to set the title in a freemarker template?
 184754 by: me
 184756 by: stanlick.gmail.com

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_184728.ezm (zipped)
that does work, thanks for the idea

On Thu, Mar 27, 2008 at 2:04 PM, Michael Gagnon <
mgagnon@(protected):

> Would:
>
>
> <s:url id="editSmall" value="/images/edit-small.png" />
>
> <s:submit value="%{getText('healthe.admin.edit.template')}"
> cssClass="previewToggle" cssStyle="background: #F6F6F6 url(%{editSmall})
> no-repeat;" action="cancelPreview"
> onclick="skipAlert(this);" />
>
>
> not work?
>
> -----Original Message-----
> From: Brian Relph [mailto:relphie@(protected)]
> Sent: Thursday, March 27, 2008 2:33 PM
> To: Struts Users Mailing List
> Subject: s:submit and cssStyle
>
> Hello,
>
> I am trying to add a cssStyle to my <s:submit> button - that includes an
> <s:url> :
>
> <s:submit value="%{getText('healthe.admin.edit.template')}"
> cssClass="previewToggle" cssStyle="background: #F6F6F6 url(<s:url
> value="/images/edit-small.png" />) no-repeat;" action="cancelPreview"
> onclick="skipAlert(this);" />
>
> However, it appears that the <s:submit> tag does not like the <s:url>
> inside
> the cssStyle property ... if this is the case, could anyone point me to
> the
> where i would modify the tag to support this?
>
> --
> Brian
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Brian

Attachment: user_184729.ezm (zipped)
Instead of type="redirect-action", did you try "chain"?

-----Original Message-----
From: chubi [mailto:chubi-shuki@(protected)]
Sent: Thursday, March 27, 2008 4:05 PM
To: user@(protected)
Subject: Message surviving redirect


Hello,
----I have posted the same problem in a previous thread, yet got no
reply,
but I'm really stuck with it and spending days trying to solve it, in
vain... ----

I have two actions: editFeature and saveFeature. Whereas editFeature
should
submit successfuly to saveFeature the latter performs and redirects
transparently to editFeature again. This is ok using redirect-action.

But in case when validation fails after submission, I get back to
editFeature with all error messages lost.
I read a previous thread talkin about the same problem and giving a
satisfying solution with the store interceptor, though I could not come
to
solve my problem.
Here is my struts actions:
pst: the store interceptor tags do not show correctly in this thread.

<action name="editFeature"
class="com.intelligile.lms.webapp.action.FeatureAction" method="edit">
               <interceptor-ref name="defaultStack" />
               <interceptor-ref name="store">
                    RETRIEVE
               </interceptor-ref>
       <result>/WEB-INF/pages/featureForm.jsp</result>
       <result name="error">/WEB-INF/pages/featureList.jsp</result>

    </action>

    <action name="saveFeature"
class="com.intelligile.lms.webapp.action.FeatureAction" method="save">
               <interceptor-ref name="defaultStack" />
               <interceptor-ref name="store">
                    STORE
               </interceptor-ref>
       <result name="success"
type="redirect">features.html</result>
       <result name="input" type="redirect-action">
                    editFeature.html
                    true
                    ${feature.dkey}
               </result>
    </action>

Please help me figure out where the problem exists.
Thank you for your support.
Best regards.
--
http://www.nabble.com/Message-surviving-redirect-tp16332404p16332404.htm
l
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


Attachment: user_184741.ezm (zipped)
Since "chain" can be a bad design practice, you might want to look at the store
<http://struts.apache.org/2.x/docs/message-store-interceptor.html>interceptor.
I have used it successfully.

On Thu, Mar 27, 2008 at 4:02 PM, Jiang, Jane (NIH/NCI) [C] <
jiangja@(protected):

> Instead of type="redirect-action", did you try "chain"?
>
> -----Original Message-----
> From: chubi [mailto:chubi-shuki@(protected)]
> Sent: Thursday, March 27, 2008 4:05 PM
> To: user@(protected)
> Subject: Message surviving redirect
>
>
> Hello,
> ----I have posted the same problem in a previous thread, yet got no
> reply,
> but I'm really stuck with it and spending days trying to solve it, in
> vain... ----
>
> I have two actions: editFeature and saveFeature. Whereas editFeature
> should
> submit successfuly to saveFeature the latter performs and redirects
> transparently to editFeature again. This is ok using redirect-action.
>
> But in case when validation fails after submission, I get back to
> editFeature with all error messages lost.
> I read a previous thread talkin about the same problem and giving a
> satisfying solution with the store interceptor, though I could not come
> to
> solve my problem.
> Here is my struts actions:
> pst: the store interceptor tags do not show correctly in this thread.
>
> <action name="editFeature"
> class="com.intelligile.lms.webapp.action.FeatureAction" method="edit">
>                <interceptor-ref name="defaultStack" />
>                <interceptor-ref name="store">
>                     RETRIEVE
>                </interceptor-ref>
>        <result>/WEB-INF/pages/featureForm.jsp</result>
>        <result name="error">/WEB-INF/pages/featureList.jsp</result>
>
>     </action>
>
>     <action name="saveFeature"
> class="com.intelligile.lms.webapp.action.FeatureAction" method="save">
>                <interceptor-ref name="defaultStack" />
>                <interceptor-ref name="store">
>                     STORE
>                </interceptor-ref>
>        <result name="success"
> type="redirect">features.html</result>
>        <result name="input" type="redirect-action">
>                     editFeature.html
>                     true
>                     ${feature.dkey}
>                </result>
>     </action>
>
> Please help me figure out where the problem exists.
> Thank you for your support.
> Best regards.
> --
> View this message in context:
> http://www.nabble.com/Message-surviving-redirect-tp16332404p16332404.htm
> l
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Scott
stanlick@(protected)

Attachment: user_184750.ezm (zipped)
He *is* using the store interceptor :-), though apparently it's not
working. I haven't used it myself but perhaps you can see what's wrong
in the configuration he posted?

L.

stanlick@(protected):
> Since "chain" can be a bad design practice, you might want to look at the store
> <http://struts.apache.org/2.x/docs/message-store-interceptor.html>interceptor.
> I have used it successfully.
>
> On Thu, Mar 27, 2008 at 4:02 PM, Jiang, Jane (NIH/NCI) [C] <
> jiangja@(protected):
>
>> Instead of type="redirect-action", did you try "chain"?
>>
>> -----Original Message-----
>> From: chubi [mailto:chubi-shuki@(protected)]
>> Sent: Thursday, March 27, 2008 4:05 PM
>> To: user@(protected)
>> Subject: Message surviving redirect
>>
>>
>> Hello,
>> ----I have posted the same problem in a previous thread, yet got no
>> reply,
>> but I'm really stuck with it and spending days trying to solve it, in
>> vain... ----
>>
>> I have two actions: editFeature and saveFeature. Whereas editFeature
>> should
>> submit successfuly to saveFeature the latter performs and redirects
>> transparently to editFeature again. This is ok using redirect-action.
>>
>> But in case when validation fails after submission, I get back to
>> editFeature with all error messages lost.
>> I read a previous thread talkin about the same problem and giving a
>> satisfying solution with the store interceptor, though I could not come
>> to
>> solve my problem.
>> Here is my struts actions:
>> pst: the store interceptor tags do not show correctly in this thread.
>>
>> <action name="editFeature"
>> class="com.intelligile.lms.webapp.action.FeatureAction" method="edit">
>>                <interceptor-ref name="defaultStack" />
>>                <interceptor-ref name="store">
>>                     RETRIEVE
>>                </interceptor-ref>
>>        <result>/WEB-INF/pages/featureForm.jsp</result>
>>        <result name="error">/WEB-INF/pages/featureList.jsp</result>
>>
>>     </action>
>>
>>     <action name="saveFeature"
>> class="com.intelligile.lms.webapp.action.FeatureAction" method="save">
>>                <interceptor-ref name="defaultStack" />
>>                <interceptor-ref name="store">
>>                     STORE
>>                </interceptor-ref>
>>        <result name="success"
>> type="redirect">features.html</result>
>>        <result name="input" type="redirect-action">
>>                     editFeature.html
>>                     true
>>                     ${feature.dkey}
>>                </result>
>>     </action>
>>
>> Please help me figure out where the problem exists.
>> Thank you for your support.
>> Best regards.
>> --
>> View this message in context:
>> http://www.nabble.com/Message-surviving-redirect-tp16332404p16332404.htm
>> l
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>


Attachment: user_184730.ezm (zipped)

thanks, this throws an exception

FreeMarker template error!

Method public java.util.List
org.apache.struts2.components.Form.getValidators(java.lang.String) threw an
exception when invoked on org.apache.struts2.components.Form@(protected)
The problematic instruction:





Randy Burgess-3 wrote:
>
> Did you try
> @ExpressionValidator(expression = "(amount > 0) || (amount == null)",
> message = "err message")
>
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
>
>
>
>> From: xianwinwin <xianwinwin@(protected)>
>> Reply-To: Struts Users Mailing List <user@(protected)>
>> Date: Wed, 26 Mar 2008 16:34:48 -0700 (PDT)
>> To: <user@(protected)>
>> Subject: @ExpressionValidator - how to set the expression correctly ?
>> (amount
>> either greater than 0 or null? )
>>
>>
>> Hi,
>>
>> I have the following Expression Validator:
>>
>> @ExpressionValidator(expression = "amount > 0", message = "err message")
>>
>> what should come in the expression if amount can be either greater than 0
>> or
>> null?
>>
>> thank you!
>> --
>> View this message in context:
>> http://www.nabble.com/%40ExpressionValidator---how-to-set-the-expression-corre
>> ctly---%28amount-either-greater-than-0-or-null--%29-tp16319035p16319035.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
>
>
> This email and any attachments ("Message") may contain legally privileged
> and/or confidential information. If you are not the addressee, or if this
> Message has been addressed to you in error, you are not authorized to
> read, copy, or distribute it, and we ask that you please delete it
> (including all copies) and notify the sender by return email. Delivery of
> this Message to any person other than the intended recipient(s) shall not
> be deemed a waiver of confidentiality and/or a privilege.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184732.ezm (zipped)

WAIT!!!!!

you were right!!! i was too quick - this solved it. THANK YOU!!!!



Randy Burgess-3 wrote:
>
> Did you try
> @ExpressionValidator(expression = "(amount > 0) || (amount == null)",
> message = "err message")
>
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
>
>
>
>> From: xianwinwin <xianwinwin@(protected)>
>> Reply-To: Struts Users Mailing List <user@(protected)>
>> Date: Wed, 26 Mar 2008 16:34:48 -0700 (PDT)
>> To: <user@(protected)>
>> Subject: @ExpressionValidator - how to set the expression correctly ?
>> (amount
>> either greater than 0 or null? )
>>
>>
>> Hi,
>>
>> I have the following Expression Validator:
>>
>> @ExpressionValidator(expression = "amount > 0", message = "err message")
>>
>> what should come in the expression if amount can be either greater than 0
>> or
>> null?
>>
>> thank you!
>> --
>> View this message in context:
>> http://www.nabble.com/%40ExpressionValidator---how-to-set-the-expression-corre
>> ctly---%28amount-either-greater-than-0-or-null--%29-tp16319035p16319035.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
>
>
> This email and any attachments ("Message") may contain legally privileged
> and/or confidential information. If you are not the addressee, or if this
> Message has been addressed to you in error, you are not authorized to
> read, copy, or distribute it, and we ask that you please delete it
> (including all copies) and notify the sender by return email. Delivery of
> this Message to any person other than the intended recipient(s) shall not
> be deemed a waiver of confidentiality and/or a privilege.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184731.ezm (zipped)
bhaarat Sharma wrote:
> Hello
>
> I am using struts 1 to show a link to the user like this
> <html:link
>              page="/editProjectMonitor.do" paramId="report_id"
> paramName="report"
>              paramProperty="reportId" target="_blank">
>           Edit</html:link>
>
> However I want this link to open up from Javascript instead! For javascript
> I have a code like the following
>
> function openPopup() {
> windowReference = window.open('/cmrs/editProjectMonitor.do?report_id=<%=WHAT
> TO PUT HERE? SO I CAN GETT report_id value%>','windowName');
> if (!windowReference.opener)
> windowReference.opener = self;
> }
>
> what can i pass so that report_id value will come. I know in struts2 I could
> have used the s:property tag...is there something similar in struts1?

Antonio is right, the onclick attribute is probably the easiest way to
do this, but to answer the question: you can use an EL expression if you
have them available, as in:

 ...window.open('...?report_id=${report.reportId}'

or, if you don't have JSTL available in your container, you can use the
bean:write tag:

 ...window.open('...?report_id=<bean:write name="report"
   property="reportId"/>'

L.


Attachment: user_184733.ezm (zipped)

Sorry for the confusing title...I couldn't think of a more succinct
description.

Basically what is happening is that I have a standard CRUD setup in my app
to manage my own User objects.

When I edit a user and submit the changes back to the Action, the "id"
attribute (just a standard UUID string) gets duplicated when being set.

For example, in the <form> the value of the id input tag shows
"0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c" but the ParametersInterceptor is
receiving: "user.id => [
0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c,
0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c ]" according to the devMode logs....it
looks like it is turning into an array with the value concatenated to each
other in position 0 and the value again in position 1.

I've verified the value in the <input> object is correct and the value in
the actual request is correct...no other interceptors fire before the
ParametersInterceptor except the "checkbox" one, so it seems the "params"
interceptor is somehow fubar'ing the data....

Does anyone have ANY clue what might be going on that would cause this?
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184735.ezm (zipped)

Sorry for the confusing title...I couldn't think of a more succinct
description.

Basically what is happening is that I have a standard CRUD setup in my app
to manage my own User objects.

When I edit a user and submit the changes back to the Action, the "id"
attribute (just a standard UUID string) gets duplicated when being set.

For example, in the <form> the value of the id input tag shows
"0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c" but the ParametersInterceptor is
receiving: "user.id => [
0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c,
0fb2fb5c-df7e-4497-ab6a-b60a2cfd7c7c ]" according to the devMode logs....it
looks like it is turning into an array with the value concatenated to each
other in position 0 and the value again in position 1.

I've verified the value in the <input> object is correct and the value in
the actual request is correct...no other interceptors fire before the
ParametersInterceptor except the "checkbox" one, so it seems the "params"
interceptor is somehow fubar'ing the data....

Does anyone have ANY clue what might be going on that would cause this?
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184734.ezm (zipped)
Try this:
<s:url id="*myUrl*" value="/images/edit-small.png" />
<s:submit value="%{getText('healthe.admin.edit.template')}"
cssClass="previewToggle" cssStyle="background: #F6F6F6 url(*%{myUrl}*)
no-repeat;" action="cancelPreview"
onclick="skipAlert(this);" />

On Thu, Mar 27, 2008 at 8:32 PM, Brian Relph <relphie@(protected):

> Hello,
>
> I am trying to add a cssStyle to my <s:submit> button - that includes an
> <s:url> :
>
> <s:submit value="%{getText('healthe.admin.edit.template')}"
> cssClass="previewToggle" cssStyle="background: #F6F6F6 url(<s:url
> value="/images/edit-small.png" />) no-repeat;" action="cancelPreview"
> onclick="skipAlert(this);" />
>
> However, it appears that the <s:submit> tag does not like the <s:url>
> inside
> the cssStyle property ... if this is the case, could anyone point me to
> the
> where i would modify the tag to support this?
>
> --
> Brian
>

Attachment: user_184736.ezm (zipped)
How would you go about retrieving this ExceptionHolder from the value stack
from within an action? I can't figure out what "key" to specify when trying
to find it.

  /**
  * Default implementation to handle ExceptionHolder publishing. Pushes
given ExceptionHolder on the stack.
  * Subclasses may override this to customize publishing.
  *
  * @param invocation The invocation to publish Exception for.
  * @param exceptionHolder The exceptionHolder wrapping the Exception to
publish.
  */
  protected void publishException(ActionInvocation invocation,
ExceptionHolder exceptionHolder) {
    invocation.getStack().push(exceptionHolder);
  }

--
Scott
stanlick@(protected)

Attachment: user_184737.ezm (zipped)
--- stanlick@(protected):
> How would you go about retrieving this ExceptionHolder from the value stack
> from within an action? I can't figure out what "key" to specify when
> trying to find it.

It's pushed; AFAIK there is no key, just like there's no key for a pushed
action (unless somebody added the #action thing).

Dave


Attachment: user_184738.ezm (zipped)
Hmmmm

Any idea why this would return null?

ActionContext.getContext().getValueStack().findValue("exception")



On Thu, Mar 27, 2008 at 7:11 PM, Dave Newton <newton.dave@(protected):

> --- stanlick@(protected):
> > How would you go about retrieving this ExceptionHolder from the value
> stack
> > from within an action? I can't figure out what "key" to specify when
> > trying to find it.
>
> It's pushed; AFAIK there is no key, just like there's no key for a pushed
> action (unless somebody added the #action thing).
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Scott
stanlick@(protected)

Attachment: user_184740.ezm (zipped)
Never mind d! I was using action redirectAction when I needed chain.

Scott

On Thu, Mar 27, 2008 at 7:39 PM, <stanlick@(protected):

> Hmmmm
>
> Any idea why this would return null?
>
> ActionContext.getContext().getValueStack().findValue("exception")
>
>
>
>
> On Thu, Mar 27, 2008 at 7:11 PM, Dave Newton <newton.dave@(protected)>
> wrote:
>
> > --- stanlick@(protected):
> > > How would you go about retrieving this ExceptionHolder from the value
> > stack
> > > from within an action? I can't figure out what "key" to specify when
> > > trying to find it.
> >
> > It's pushed; AFAIK there is no key, just like there's no key for a
> > pushed
> > action (unless somebody added the #action thing).
> >
> > Dave
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
> --
> Scott
> stanlick@(protected)




--
Scott
stanlick@(protected)

Attachment: user_184739.ezm (zipped)
Eric D Nielsen on 26/03/08 15:31, wrote:
> Adam Hardy on 26/03/08 00:28:43
>> Eric D Nielsen on 25/03/08 14:29, wrote:
>>> Its a Struts2/Spring2/JPA(Hibernate) based project. I'm using a slightly
>>> modified version of the Generic DAO pattern shown in the Java persistence
>>> with Hibernate book and/or the IBM ThoughtWorks very similar example.
>>> (Modified to allow Spring Based Injection of the JPA EntityManger, while
>>> falling back to a native Hibernate session inside the DAOs to allow a few
>>> more optimizations).
>>>
>>> So its basically
>>> Business Objects (POJOs) <---1:1---> DAOs
>>> which is a relatively normal pattern I beleive.
>> Is it normal with that Generic DAO pattern to name the DAOs 'services'? In the
>> Domain-Driven-Design paradigm that I generally follow, the services are objects
>> which carry out operations that you don't want to specifically assign to one
>> domain object.
>
> I'm willing to admit a LOT of confusion about DAOs v (Services | Managers) v
> business logic on POJOs. I will say that my Actions are taking things named
> "services" but typed as DAOs since I thought I would eventually migrate towards
> this extra tier, but have let to really understand what belongs there. I think
> a large part of my confusion comes from most examples I've seen where just
> about 100% of the method in the vast majority of service classes are proxied
> calls from the DAO. With only 1-2 methods added to a small percentage of the
> services. However we are getting quite far afield for Struts matters here.....
> I'd be very happy to receive further enlightenment, but if its better to move
> this part of the discussion elswhere, please let me know...

I guess you want the Spring design paradigm. It's relatively straight-forward
although you're right - in alot of cases, the managers just wrap the dao calls
with no added functionality.

>>> just use POJOs there. I believe this approach would work with the
>>> Model-Driven idea, but it feels a little odd to me to mark up the domain
>>> object with HTTP-specific details....
>> Yes it would do, but what do you mean by 'mark up the domain object with
>> HTTP-specific details'? I don't think you have to touch the domain objects to
>> code the re-construction of your incoming Bug POJO.
>
> Yay! Back to Struts matters...  I haven't written any type converters yet, but
> from the examples I'd been seeing I thought you had to add a @TypeConversion
> annotation to accessors that wanted custom type conversion.
> http://struts.apache.org/2.x/docs/typeconversion-annotation.html
> So if I was using Model Driven, would this mean putting these annotation on the
> model. (much like the Vistor pattern for Validation)

You don't have to use annotations if you don't want to. You can use property
files instead.

Attachment: user_184742.ezm (zipped)

I need to access session scope bean in my java action class which will insert
data from all session beans to the Database.

I know I can access I all session beans in JSP using:
<jsp:useBean id="aa" scope="session" class="package.A" />

How to access this bean in Java Action Class?

Please Help me !!! :(
-----
In JSF people do it :
FacesContext facesContext = FacesContext.getCurrentInstance();
ApplicationFactory appFactory =
(ApplicationFactory)FactoryFinder.findFactory(FactoryFinder.APPLICATION_FACTORY);
Application app = appFactory.getApplication();
AppState appState =
(AppState)app.getValueBinding("appState").getValue(facesContext);
:working:
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184743.ezm (zipped)
Try to implement the org.apache.struts2.interceptor.SessionAware
interface. It defines a method called setSession(java.util.Map
session).

[]',s

Diogo

On Thu, Mar 27, 2008 at 10:39 PM, simpi <simpigill@(protected):
>
> I need to access session scope bean in my java action class which will insert
> data from all session beans to the Database.
>
> I know I can access I all session beans in JSP using:
> <jsp:useBean id="aa" scope="session" class="package.A" />
>
> How to access this bean in Java Action Class?
>
> Please Help me !!! :(
> -----
> In JSF people do it :
> FacesContext facesContext = FacesContext.getCurrentInstance();
> ApplicationFactory appFactory =
> (ApplicationFactory)FactoryFinder.findFactory(FactoryFinder.APPLICATION_FACTORY);
> Application app = appFactory.getApplication();
> AppState appState =
> (AppState)app.getValueBinding("appState").getValue(facesContext);
> :working:
> --
> View this message in context: http://www.nabble.com/How-to-get-access-to-session-scoped-bean-in-Struts--tp16343878p16343878.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
Diogo Dauster Pontual
diogopontual@(protected)
61.81588922

Attachment: user_184744.ezm (zipped)
Hi All,

Is there anyway we can implement mapped back property ActionForm
implementation from Struts1.x in to Struts2? We've been using mapped back
property feature so easily to create and populate dynamic property
name/value using Struts 1.x that we are not sure how to implement that in
Struts2?

Any help is greatly appreciated.

TIA.

Attachment: user_184745.ezm (zipped)
Hi,

I asked the same question a few weeks ago. Do search the archive for more
details. Anyway, take a look at the ParameterAware interface. By
implementing it, you have access to all the request parameters. Should be
similar to mapped back.

Cheers!

On Fri, Mar 28, 2008 at 11:56 AM, Niral Trivedi <niral22@(protected):

> Hi All,
>
> Is there anyway we can implement mapped back property ActionForm
> implementation from Struts1.x in to Struts2? We've been using mapped back
> property feature so easily to create and populate dynamic property
> name/value using Struts 1.x that we are not sure how to implement that in
> Struts2?
>
> Any help is greatly appreciated.
>
> TIA.
>

Attachment: user_184746.ezm (zipped)
Hi All,



I am migrating an existing FrameWork(classes which are extending from some
of the Struts classes like FormTag,TextTag etc) from struts 1 to struts 2.
It uses MessageResources. I found out that the replacement for the same in
struts2 (2.0.11)is WrapperMessageResources which extends from the
MessageResources.

But to use the WrapperMessageRessource I need to use the struts
1.3.5-core.jar provided along with the struts 2.0.11 release otherwise I get
a compilation error as "MessageResources class not found. It is used
indirectly by one of the class files". So is it proper to use the struts
1.3.5-core.jar? If not Pls suggest a replacement for MessageResources.







Thanks,



Sandeep




Attachment: user_184751.ezm (zipped)
vj,sandeep wrote:
> Hi All,
>
> I am migrating an existing FrameWork(classes which are extending from some
> of the Struts classes like FormTag,TextTag etc) from struts 1 to struts 2.
> It uses MessageResources. I found out that the replacement for the same in
> struts2 (2.0.11)is WrapperMessageResources which extends from the
> MessageResources.
>
> But to use the WrapperMessageRessource I need to use the struts
> 1.3.5-core.jar provided along with the struts 2.0.11 release otherwise I get
> a compilation error as "MessageResources class not found. It is used
> indirectly by one of the class files". So is it proper to use the struts
> 1.3.5-core.jar? If not Pls suggest a replacement for MessageResources.

As Antonio told you, it isn't really a question of 'replacements'.
Although conceptually similar, Struts 1 and Struts 2 are entirely
different codebases. You should think in terms of what you need to
achieve in Struts 2, not in terms of what APIs you used to achive
something similar in Struts 1.

That said, I have no idea what WrapperMessageResources is. It's not part
of the Struts 1, Struts 2 or XWork APIs as far as I can tell. You
certainly don't need to include Struts 1 jars in a Struts 2 application
to access message resources though.

If you can explain what it is you are trying to achieve we may be able
to offer better guidance.

L.


Attachment: user_184753.ezm (zipped)
Hi Laurie,

I understand what you are trying to say. What I exactly have is a set of
classes which extend from the FormTag, TextTag, ActionError and ActionErrors
and do some business Logic implementation. Here They have used the
MessageResource for holding the error messages. Now I need to do the same
thing in struts 2. When I saw the javadoc it said the WrapperMessageResource
was a wrapper over the struts1 MessageResource in struts2 and the
WrapperMessageResource extends from the MessageResource.

Also I need to migrate classes which are extending from ActionError and
ActionErrors and have the business Logic implemented. I know that struts-2
is not providing ActionErrors nor the ActionError. Instead in the
application we have to use addActionError() method provided by the
ActionSupport class if I am right. It's easy to do this in an application
migration. But I am wondering how to migrate the classes in the framework to
struts-2.

Looking Forward For ur help.  

Thanks,
Sandeep
-----Original Message-----
From: news [mailto:news@(protected)
Sent: Friday, March 28, 2008 11:22 AM
To: user@(protected)
Subject: Re: Help On Migration

vj,sandeep wrote:
> Hi All,
>
> I am migrating an existing FrameWork(classes which are extending from some
> of the Struts classes like FormTag,TextTag etc) from struts 1 to struts 2.
> It uses MessageResources. I found out that the replacement for the same in
> struts2 (2.0.11)is WrapperMessageResources which extends from the
> MessageResources.
>
> But to use the WrapperMessageRessource I need to use the struts
> 1.3.5-core.jar provided along with the struts 2.0.11 release otherwise I
get
> a compilation error as "MessageResources class not found. It is used
> indirectly by one of the class files". So is it proper to use the struts
> 1.3.5-core.jar? If not Pls suggest a replacement for MessageResources.

As Antonio told you, it isn't really a question of 'replacements'.
Although conceptually similar, Struts 1 and Struts 2 are entirely
different codebases. You should think in terms of what you need to
achieve in Struts 2, not in terms of what APIs you used to achive
something similar in Struts 1.

That said, I have no idea what WrapperMessageResources is. It's not part
of the Struts 1, Struts 2 or XWork APIs as far as I can tell. You
certainly don't need to include Struts 1 jars in a Struts 2 application
to access message resources though.

If you can explain what it is you are trying to achieve we may be able
to offer better guidance.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



Attachment: user_184747.ezm (zipped)
If you want the value of a constant, use @Inject on a setter. This is
available only to objects instantiated by the Struts2 Container (actions
or beans in the config)

Example:

import com.opensymphony.xwork2.inject.Inject;

@Inject("struts.devMode")
public void setDeveloperMode(String value) {}


---
To access them elsewhere you'll have to get a reference to the
com.opensymphony.xwork2.inject.Container instance which may be available
from your DI framework (Guice/Spring). I'm not sure how much luck you'll
have with that.

---
If you just want a list of the standard Struts2 constants, see
StrutsConstants.class

Hope that helps,
Jeromy Evans

Matthew Seaborn wrote:
>
> How can you get hold of the constants defined in the struts.xml?
>
>
>
>
> Matthew Seaborn
>
> Software Architect
> t +44(0) 208 484 0729
> m +44(0) 7949 465 142
>
> e matthew.seaborn@(protected)
> <mailto:matthew.seaborn@(protected)>
>
>  
>
>
> Sussex House
> Plane Tree Crescent
> Feltham, Middlesex, TW13 7HE
> United Kingdom
> http://www.performgroup.com/
>
>
> ________________________________________________________________________
>
> CONFIDENTIALITY - This email and any files transmitted with it, are
> confidential, may be legally privileged and are intended solely for
> the use of the individual or entity to whom they are addressed. If
> this has come to you in error, you must not copy, distribute, disclose
> or use any of the information it contains. Please notify the sender
> immediately and delete them from your system.
>
> SECURITY - Please be aware that communication by email, by its very
> nature, is not 100% secure and by communicating with Perform Group by
> email you consent to us monitoring and reading any such correspondence.
>
> VIRUSES - Although this email message has been scanned for the
> presence of computer viruses, the sender accepts no liability for any
> damage sustained as a result of a computer virus and it is the
> recipient’s responsibility to ensure that email is virus free.
>
> AUTHORITY - Any views or opinions expressed in this email are solely
> those of the sender and do not necessarily represent those of Perform
> Group.
>
> COPYRIGHT - Copyright of this email and any attachments belongs to
> Perform Group, Companies House Registration number 6324278.
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.22.1/1345 - Release Date: 26/03/2008 6:50 PM
>  


Attachment: user_184748.ezm (zipped)
Storing the FormFile reference into the request wont help; request
attributes are discarded at the end of request processing, so by the
time the next page submits the first request has gone away. To keep
something from one request available to the next request, you would have
to put it into the session.

However, storing a FormFile reference in the session probably wont help
either. A FormFile is just a chunk of meta data that allows the physical
file to be found on disk. If the physical file is deleted, having a
reference to where it used to be isn't very useful...

You will either need to read the whole file in the first request and
cache the data somewhere (e.g. in the session), or make a copy the file
to load in the second request. You need to make a copy (of the file, or
the data in it) as Struts will automatically delete the original file at
the end of the request in which it was received.

L.

Tom Holmes Jr. wrote:
> Ok ..... maybe what I'll do in this case is put the FormFile into the
> request manually, so I can pass it from one page to the next.
> I'm not so much concerned with the FormFile.getInputStream since I can
> use FormFile.getFileData to get the byte array data.
>
> Thanks!
>
> Antonio Petrelli wrote:
>> 2008/3/27, Tom Holmes Jr. <tom@(protected)>:
>>
>>> Anyway, my question is after I upload my file and look at the data, I
>>> want to hold onto that file to the next page.
>>>  
>>
>> ...
>>
>>> Can I do this, or do I need to parse the entire file after the first
>>> page, and then how would I persist this without writing it to a
>>> database.
>>>  
>>
>>
>>
>> You need to parse the input stream as it comes. The reason why the
>> FormFile
>> does not return an input stream at the following request is that the
>> input
>> stream is connected to the previous HTTP request.
>> How you can persist it is a problem of yours, Struts cannot help in this.
>> But anyway, I suggest to parse that file and "remember" only the portions
>> you really need.
>>
>> Antonio
>>
>>  
>> ------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.1/1346 -
>> Release Date: 3/27/2008 10:03 AM
>>  


Attachment: user_184749.ezm (zipped)
Tom Holmes Jr. wrote:
> I've created numerous pages with multiple combo-dropdown boxes that
> captured the label and value of a select box.
> The formbean for these was always clear cut and simple.
>
> Now, I have a select like the following:
> <select name="test" multiple="true">
>   <option value="selection a">A</option>
>   <option value="selection b">B</option>
>   <option value="selection c">C</option>
> </select>
> As I understand it, when I submit, this will submit back a string array
> (String[] test) which is defined in my form bean ... right?
>
> Now lets say I have the following single select
> <select name="test">
>   <option value="selection a">A</option>
>   <option value="selection b">B</option>
>   <option value="selection c">C</option>
> </select>
> <select name="test">
>   <option value="selection d">D</option>
>   <option value="selection e">E</option>
>   <option value="selection f">F</option>
> </select>
> So now there are two with the same name ... I am guessing that I will
> still get back a string array (String[] test) which is defined in my
> form bean ... right?
>
> What I'd really like is a little different. I'd like the first
> selection test to be test[0] = A,B, or C (since it is single select) AND
> I'd like the second selection test to be test[1] = D,E, or F (since it
> is single select)
> Or even better yet:
> I'd like the first selection test to be test["first_letter"] = A,B, or C
> (since it is single select) AND
> I'd like the second selection test to be test["second_letter"] = D,E, or
> F (since it is single select)
>
> So, how would I setup the form bean for this?
> The way it is setup now, I have a Collection for test, and it comes back
> with an argument type mismatch.
>
> Any help would be much appreciated, and I will keep working on this.
> Thanks!

You're on the right lines; you need a Map rather than a Collection if
you want key indexing. Your select's name would be test["a"] for the
first, test["b"] for the second, etc.

L.


Attachment: user_184752.ezm (zipped)

If u know the answer, please share with us.. I haven't worked on struts
much..

We have to override execute method to forward from one page to another page
by using mapping.findForward("testAction") some thing like that..
DB/business logic should be inside of execute () method? is there any other
way to invoke methods without using execute()..
i dont know , thats the reason i am asking you people to clarify this ok..

Awaiting for your clear cut answer and thanak you for ur kindness

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184755.ezm (zipped)
Here is clear cut answer; "READ THE TUTORIALS".

We're not going to do you homework for you, and we're certainly not going to
help you pass an interview which is designed to look for peoplewho have
worked on struts much.

Al.

----- Original Message -----
From: "pannar" <nsveera2000@(protected)>
To: <user@(protected)>
Sent: Friday, March 28, 2008 5:55 AM
Subject: Re: Please answer this struts basic qtn


>
> If u know the answer, please share with us.. I haven't worked on struts
> much..
>
> We have to override execute method to forward from one page to another
> page
> by using mapping.findForward("testAction") some thing like that..
> DB/business logic should be inside of execute () method? is there any
> other
> way to invoke methods without using execute()..
> i dont know , thats the reason i am asking you people to clarify this ok..
>
> Awaiting for your clear cut answer and thanak you for ur kindness
>
> --
> View this message in context:
> http://www.nabble.com/Please-answer-this-struts-basic-qtn-tp16324821p16346313.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>


Attachment: user_184754.ezm (zipped)
Hi,

I'm running struts2 with sitemesh. There is a freemarker template
defined in the decorators and this template
has both variables $title and $body. The body is filled autmatically
which is okay. But I want to set the title
from the action I've called because I wanted to have the content and the
title having a relation to each other
(which makes sense, I believe... :) )

Thanks for your help.

Marc

Attachment: user_184756.ezm (zipped)
Hey Marc --

copy that FreeMarker template into your <webroot>/template folder and modify
it with your desired changes. Struts 2 will grab yours for rendering.


On Fri, Mar 28, 2008 at 2:14 AM, me <mlists@(protected):

> Hi,
>
> I'm running struts2 with sitemesh. There is a freemarker template
> defined in the decorators and this template
> has both variables $title and $body. The body is filled autmatically
> which is okay. But I want to set the title
> from the action I've called because I wanted to have the content and the
> title having a relation to each other
> (which makes sense, I believe... :) )
>
> Thanks for your help.
>
> Marc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Scott
stanlick@(protected)
©2008 gg3721.com - Jax Systems, LLC, U.S.A.