Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 31 Jan 2008 07:06:11 -0000 Issue 7834

user-digest-help

2008-01-31


Author LoginPost Reply

user Digest 31 Jan 2008 07:06:11 -0000 Issue 7834

Topics (messages 181998 through 182014):

Re: struts1 and struts2 together
 181998 by: Alberto A. Flores

Re: [S2] Where should I save the I18N properties file?
 181999 by: hezjing

Re: Error messages is repeated Using Struts 2 Annotation validation
 182000 by: Randy Burgess

session or interceptor initialization / configuration problem
 182001 by: jspring

Struts, Interceptor error message customization
 182002 by: Mike J. M.

Question about Struts 2 Flow Control
 182003 by: claym
 182004 by: Musachy Barroso
 182007 by: WongTseng

Re: #request scope
 182005 by: Dave Newton
 182006 by: stanlick.gmail.com

dojo script for DATEPICKER tag
 182008 by: Naveen Kumar M
 182009 by: Wes Wannemacher

Re: Struts 2 onchange event to get values from databases
 182010 by: Johnson nickel
 182011 by: Johan Snyman
 182012 by: Johnson nickel
 182014 by: Johan Snyman

Re: [S2.1] dojo widget dialog
 182013 by: Jeromy Evans

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_181998.ezm (zipped)
I have been migrating code from struts 1.x to 2.x and depending on how
decoupled your presentation logic is, you should expect significant
amount of work. The results have been very successful thus far (3 of 4
modules were migrated completely).

Definitely less code to maintain afterwards and sure it's more readable
(in my opinion), however the migration is not as trivial and you may
find some "gotchas" along the way depending on how you have used Struts
1.x (tags, servlet, dispatchers, etc). Expect a decent learning curve as
well due to some new features (value stack, thread-safety, OGNL notation)

The one thing I would recommend is to absolutely understand your need to
migrate. We determined it was the right move based on some of the new
features that Struts 2 provided out of the box, and we needed for our
application (We were writing more code just to make Struts 1 look like
Struts 2 basically).

Hope this help


Otto, Frank wrote:
> no problem.
>
> I haven't migrate our project, because I have realized a new topic with struts2 in our project. It's a configurator with ajax (YUI). the rest is still struts1.
>
>
> kind regards,
>
> frank
>
> -----Ursprüngliche Nachricht-----
> Von: nagendrabvvs [mailto:nagendrabvvs@(protected)]
> Gesendet: Mittwoch, 30. Januar 2008 14:10
> An: user@(protected)
> Betreff: Re: AW: struts1 and struts2 together
>
>
>
> Thanks a lot for quick reply, frank.
>
> Can i ask you one question?
> That, Were you able to moigrate your proj successfully with out any
> problems?
>
>

--

Alberto A. Flores
http://www.linkedin.com/in/aflores


Attachment: user_181999.ezm (zipped)
Hi

The problem is solved by saving the properties in

src/main/resources/com/dummy/action/package.properties
src/main/resources/com/dummy/action/MyAction.properties


Thank you!

On Jan 30, 2008 6:05 PM, hezjing <hezjing@(protected):
> Hi
>
> I have an action in src/main/java/com/dummy/action/MyAction.java
> and the locale messages defined in MyAction.properties and package.properties.
>
> I saved these properties files in src/main/java/com/dummy/action directory.
>
> When run (e.g. mvn jetty:run), the locale messages are not displayed.
> Maybe the properties files are not loaded?
>
> Where should I save the properties files in Maven project directory?
>
>
> --
>
> Hez
>



--

Hez

Attachment: user_182000.ezm (zipped)
The documentation covers using images in submit buttons.

http://struts.apache.org/2.0.11/docs/submit.html

  * input: renders as html <input type="submit"...>
  * image: renders as html <input type="image"...>
  * button: renders as html <button type="submit"...>

<s:submit type="image" src="whatever.gif"/>

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: Johnson nickel <saravanan@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Tue, 29 Jan 2008 23:28:42 -0800 (PST)
> To: <user@(protected)>
> Subject: Re: Error messages is repeated Using Struts 2 Annotation validation
>
>
> Thanks for your quick response,
>
> In my Login.jsp,
>  <s:textfield name="username" label="UserName" />
>  <s:password name="spassword" label="Password" />
>  <input type="image" src="../images/Login.gif" value="Login">
>
> Instead of using <s:submit value="Login"/>, I used html image tag .
> If i used <s:submit> it works fine.
>      
>
>
>
>
> newton.dave wrote:
>>
>> --- Johnson nickel <saravanan@(protected):
>>>
>> @RequiredFieldValidator(type=ValidatorType.SIMPLE,fieldName="username",messag
>> e="UserName
>>> is required")
>>
>> For a string field you'll probably want to use the
>> @RequiredStringValidator:
>> a text field will return an empty string, whereas @RequiredFieldValidator
>> only checks for null-ness (different from blank-ness).
>>
>>> Same as For password also ,
>>
>> *Exactly* the same? (You put the right "fieldName" for the password field,
>> right?)
>>
>>> When i have submit the Login button, the Error messages is displaying
>> Repeated.
>>
>> You'll need to provide some JSP and possibly configuration in order to
>> help
>> diagnose the problem.
>>
>> Where are the duplicated messages appearing?
>>
>> Dave
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Error-messages-is-repeated-Using-Struts-2-Annotation-val
> idation-tp15157319p15176802.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_182001.ezm (zipped)

I have an intermittent problem possibly related to session creation or
Interceptor configuration. In a few words, when a browser is first opened
and a valid action is requested, an exception is returned. After I request
the base application name with no action, a successful response is returned,
and then I can request any action.

In detail:

- When following a hyperlink to a page with or without parameters, error
- when closing / opening browser and going directly to any valid action, get
error
- when closing / opening browser and going directly to anything that would
invoke the default action, get error

- after trying these things, there is no error when requesting the
application by base name alone, with no action in the URL
- once this has been done, the above things that didn't work, now work

- I have a customer interceptor before 'prepare'. when request.getSession()
is called, a session object is returned (as expected)
- this interceptor calls session.setAttribute() to set various parameters
- my action class implements SessionAware (and Preparable) to obtain the
sessionMap object
- following the above actions that result in errors, sessionMap is empty
when called in the Preparable method
- when the application is working, sessionMap is not empty as expected

My interceptor configuration in struts.xml looks like:
   <interceptors>
       <interceptor name="mySpecificLocale"
class="com.mndigi.notes.util.LocaleInterceptor" />
      <interceptor-stack name="defaultLocaleStack">
       <interceptor-ref name="exception"/>
          <interceptor-ref name="alias"/>          
          <interceptor-ref name="i18n"/>
       <interceptor-ref name="mySpecificLocale" />        
       <interceptor-ref name="servletConfig"/>  
          <interceptor-ref name="prepare"/>
          <interceptor-ref name="chain"/>
          <interceptor-ref name="debugging"/>
          <interceptor-ref name="profiling"/>
          <interceptor-ref name="scopedModelDriven"/>
          <interceptor-ref name="modelDriven"/>
       <interceptor-ref name="fileUpload">
        <!-- struts.properties value is checked first. these are set the same
-->
        20971520
       </interceptor-ref>                
          <interceptor-ref name="checkbox"/>
          <interceptor-ref name="staticParams"/>
          <interceptor-ref name="params">
           dojo\..*
          </interceptor-ref>
          <interceptor-ref name="conversionError"/>
          <interceptor-ref name="validation">
            input,back,cancel,browse
          </interceptor-ref>
          <interceptor-ref name="workflow">
            input,back,cancel,browse
          </interceptor-ref>
                 
       </interceptor-stack>        
    </interceptors>
   
    <default-interceptor-ref name="defaultLocaleStack"/>


Also, here is a debug stack trace when there is a problem:

10:24:46,453 DEBUG ConfigurationManager:156 - Checking
ConfigurationProviders for reload.
10:24:46,453 DEBUG InstantiatingNullHandler:72 - Entering nullPropertyValue
[target=[com.opensymphony.xwork2.DefaultTextProvider@(protected)],
property=struts]
10:24:46,453 DEBUG ConfigurationManager:156 - Checking
ConfigurationProviders for reload.
10:24:46,453 DEBUG DefaultActionProxy:65 - Creating an DefaultActionProxy
for namespace / and action name home
10:24:46,468 DEBUG I18nInterceptor:97 - intercept '//home' {
10:24:46,468 DEBUG I18nInterceptor:110 - requested_locale=null
10:24:46,468 DEBUG I18nInterceptor:140 - before Locale=en_US
10:24:46,468 INFO LocaleInterceptor:38 - url:
http://localhost:8080/TechNotes
10:24:46,468 DEBUG LocaleInterceptor:57 - locale language (based on url) =
technotes
10:24:46,468 DEBUG LocaleInterceptor:59 - application name (based on
corresponding properties file): TechNotes
10:24:46,468 DEBUG PrefixMethodInvocationUtil:141 - cannot find method
[prepareHome] in action [com.wamnet.notes.webactions.NoteAction@(protected)]
10:24:46,468 DEBUG PrefixMethodInvocationUtil:141 - cannot find method
[prepareDoHome] in action [com.wamnet.notes.webactions.NoteAction@(protected)]
10:24:46,468 ERROR [default]:253 - Servlet.service() for servlet default
threw exception
java.lang.NullPointerException
 at com.wamnet.notes.webactions.NoteAction.prepare(NoteAction.java:163)
 at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept (PrepareInterceptor.java:118)
 at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:86)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
 at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile (UtilTimerStack.java:455)
 at
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:221)
 at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept (ServletConfigInterceptor.java:170)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
 at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile (UtilTimerStack.java:455)
 at
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:221)
 at
com.mndigi.notes.util.LocaleInterceptor.intercept(LocaleInterceptor.java:65)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
 at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile (UtilTimerStack.java:455)
 at
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:221)
 at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept (I18nInterceptor.java:143)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
 at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile (UtilTimerStack.java:455)
 at
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:221)
 at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept (AliasInterceptor.java:123)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
 at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile (UtilTimerStack.java:455)
 at
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:221)
 at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept (ExceptionMappingInterceptor.java:176)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
 at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
 at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile (UtilTimerStack.java:455)
 at
com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:221)
 at
org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java:50)
 at
org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:504)
 at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java:419)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:215)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:188)
 at
org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:213)
 at
org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:174)
 at
org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:127)
 at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
 at
org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:108)
 at
org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:151)
 at
org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:874)
 at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
 at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket (PoolTcpEndpoint.java:528)
 at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt (LeaderFollowerWorkerThread.java:81)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
 at java.lang.Thread.run (Thread.java:619)
10:24:46,484 DEBUG [/TechNotes]:185 - servletPath=/error.jsp, pathInfo=null,
queryString=null, name=null
10:24:46,484 DEBUG [/TechNotes]:375 - Path Based Forward
10:24:46,484 DEBUG JspServlet:248 - JspEngine --> /error.jsp
10:24:46,484 DEBUG JspServlet:249 -     ServletPath: /error.jsp
10:24:46,484 DEBUG JspServlet:250 -       PathInfo: null
10:24:46,484 DEBUG JspServlet:251 -       RealPath: C:\Documents and
Settings\jeremy\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\notesproject\error.jsp
10:24:46,484 DEBUG JspServlet:252 -      RequestURI: /TechNotes/error.jsp
10:24:46,484 DEBUG JspServlet:253 -     QueryString: null
10:24:46,484 DEBUG JspServlet:254 -   Request Params:
10:24:46,484 DEBUG [/TechNotes]:412 - Disabling the response for futher
output
10:24:46,859 DEBUG ConfigurationManager:156 - Checking
ConfigurationProviders for reload.



And here is the log when there is no problem:
10:24:01,484 DEBUG ConfigurationManager:156 - Checking
ConfigurationProviders for reload.
10:24:01,484 DEBUG InstantiatingNullHandler:72 - Entering nullPropertyValue
[target=[com.opensymphony.xwork2.DefaultTextProvider@(protected)]
10:24:01,484 DEBUG JspServlet:248 - JspEngine --> /index.jsp
10:24:01,500 DEBUG JspServlet:249 -     ServletPath: /index.jsp
10:24:01,500 DEBUG JspServlet:250 -       PathInfo: null
10:24:01,500 DEBUG JspServlet:251 -       RealPath: C:\Documents and
Settings\jeremy\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\notesproject\index.jsp
10:24:01,500 DEBUG JspServlet:252 -      RequestURI: /TechNotes/
10:24:01,500 DEBUG JspServlet:253 -     QueryString: null
10:24:01,500 DEBUG JspServlet:254 -   Request Params:
10:24:01,515 DEBUG ConfigurationManager:156 - Checking
ConfigurationProviders for reload.
10:24:01,515 DEBUG InstantiatingNullHandler:72 - Entering nullPropertyValue
[target=[com.opensymphony.xwork2.DefaultTextProvider@(protected)],
property=struts]
10:24:01,515 DEBUG ConfigurationManager:156 - Checking
ConfigurationProviders for reload.
10:24:01,515 DEBUG DefaultActionProxy:65 - Creating an DefaultActionProxy
for namespace / and action name home
10:24:01,515 DEBUG I18nInterceptor:97 - intercept '//home' {
10:24:01,515 DEBUG I18nInterceptor:110 - requested_locale=null
10:24:01,515 DEBUG I18nInterceptor:140 - before Locale=en_US
10:24:01,515 INFO LocaleInterceptor:38 - url:
http://localhost:8080/TechNotes
10:24:01,515 DEBUG LocaleInterceptor:57 - locale language (based on url) =
technotes
10:24:01,531 DEBUG LocaleInterceptor:59 - application name (based on
corresponding properties file): TechNotes
10:24:01,531 DEBUG PrefixMethodInvocationUtil:141 - cannot find method
[prepareHome] in action [com.wamnet.notes.webactions.NoteAction@(protected)]
10:24:01,531 DEBUG PrefixMethodInvocationUtil:141 - cannot find method
[prepareDoHome] in action [com.wamnet.notes.webactions.NoteAction@(protected)]
Hibernate:
  /* criteria query */ select
    this_.category_id as category1_0_0_,
    this_.name as name0_0_,
    this_.serial_version_u_i_d as serial3_0_0_,
    this_.application_name as applicat4_0_0_
  from
    tb_category this_
  where
    this_.application_name=?
  order by
    this_.name asc
10:24:02,015 DEBUG InstantiatingNullHandler:72 - Entering nullPropertyValue
[target=[com.wamnet.notes.webactions.NoteAction@(protected),
com.opensymphony.xwork2.DefaultTextProvider@(protected)]
10:24:02,015 DEBUG FileUploadInterceptor:204 - Bypassing // home
10:24:02,015 DEBUG StaticParametersInterceptor:83 - Setting static
parameters {}
10:24:02,015 DEBUG ParametersInterceptor:148 - Setting params
10:24:02,031 DEBUG AnnotationValidationInterceptor:134 - Validating //home
with method home.
10:24:02,031 INFO ActionValidatorManagerFactory:29 - Detected
AnnotationActionValidatorManager, initializing it...
10:24:02,078 DEBUG DefaultWorkflowInterceptor:183 - Invoking validate() on
action com.wamnet.notes.webactions.NoteAction@(protected)
10:24:02,078 DEBUG PrefixMethodInvocationUtil:141 - cannot find method
[validateHome] in action [com.wamnet.notes.webactions.NoteAction@(protected)]
10:24:02,078 DEBUG PrefixMethodInvocationUtil:141 - cannot find method
[validateDoHome] in action [com.wamnet.notes.webactions.NoteAction@(protected)]
10:24:02,078 DEBUG DefaultActionInvocation:383 - Executing action method =
home
10:24:02,578 WARN QueryTranslatorImpl:328 - firstResult/maxResults
specified with collection fetch; applying in memory!
Hibernate:
...

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


Attachment: user_182002.ezm (zipped)
Hello,


So I am currently using Struts, including an action that has a fileUpload
Interceptor that checks for files that are too large and certain allowable
file types. Right now if either of these conditions are met, the system will
throw a generic HTTP 500 error up. What I am wondering is how to customize
this.


in the docs:
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/FileUploadInterceptor.html

i found these messages that i can supposedly customize. however, the doc
does not specify WHERE i am supposed to put these error messages at, and
furthermore, after looking at the source code for FileUploadInterceptor, I
found that these messages are printed to the log file, and it doesn't look
like it prints to the actual HTML.


* struts.messages.error.uploading - a general error that occurs when the
file could not be uploaded


* struts.messages.error.file.too.large - occurs when the uploaded file is
too large


* struts.messages.error.content.type.not.allowed - occurs when the uploaded
file does not match the expected content types specified


The doc says that these error messages originate from
struts-messages.properties. I'm guessing that's in the struts.jar itself
because I don't see it anywhere else, so am I supposed to modify that
directly? I'm a little bit iffy about doing that.




So, in a nutshell, how do I catch an Interceptor error and make it redirect
to a nice page instead of the generic HTTP 500 page? Actually, what would be
better is to redirect to an action while passing into it a parameter
"message" that will contain error messages. Then, in the JSP i want to do
<s:property ...> to grab that message.


thank you!

Attachment: user_182003.ezm (zipped)

One of the things I really liked about Spring MVC was the fact that it was
very easy to control the flow of a request. You could use referenceData() to
add data that was needed on the page but not necessarily form related, then
formBackingObject() for the actual pre-submission form population, and then
control the processing of pre-submit and post-submit with showForm() and
onSubmit()

It was also smart enough to repopulate things like referenceData if there
was an invalid submission.

Part of this was due to the fact that there were lots of different types of
controllers - all the referenceData and formBackingObject wasn't necessary
if you're just displaying a non-form page, but you could always use
SimpleFormController if you needed it.

I'm not seeing that kind of behavior in Struts 2. I'm not saying it's
required functionality, but I certainly appreciated it in Spring MVC.

Is it there and I'm not seeing it? How would you control the request like
this?
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_182004.ezm (zipped)
I am feeling really dumb now, that doesn't sound "very easy" at all
:). Could you re-write your question for non-spring mvc users?

musachy

On Jan 30, 2008 2:36 PM, claym <clay@(protected):
>
> One of the things I really liked about Spring MVC was the fact that it was
> very easy to control the flow of a request. You could use referenceData() to
> add data that was needed on the page but not necessarily form related, then
> formBackingObject() for the actual pre-submission form population, and then
> control the processing of pre-submit and post-submit with showForm() and
> onSubmit()
>
> It was also smart enough to repopulate things like referenceData if there
> was an invalid submission.
>
> Part of this was due to the fact that there were lots of different types of
> controllers - all the referenceData and formBackingObject wasn't necessary
> if you're just displaying a non-form page, but you could always use
> SimpleFormController if you needed it.
>
> I'm not seeing that kind of behavior in Struts 2. I'm not saying it's
> required functionality, but I certainly appreciated it in Spring MVC.
>
> Is it there and I'm not seeing it? How would you control the request like
> this?
> --
> View this message in context: http://www.nabble.com/Question-about-Struts-2-Flow-Control-tp15190024p15190024.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)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment: user_182007.ezm (zipped)
actually, S2 have a equivelent to spring's command object. S2 can
populate the model object for you, if you get right interceptor. and
when a invalid submissiom comes in, s2 action can forward you back to
the input page with error messages. s2 also has an oblivious advantage
against spring mvc, that is s2 can do whatever spring mvc can do with
only one type of action.

2008/1/30, Musachy Barroso <musachy@(protected)>:
> I am feeling really dumb now, that doesn't sound "very easy" at all
> :). Could you re-write your question for non-spring mvc users?
>
> musachy
>
> On Jan 30, 2008 2:36 PM, claym <clay@(protected):
> >
> > One of the things I really liked about Spring MVC was the fact that it was
> > very easy to control the flow of a request. You could use referenceData()
> to
> > add data that was needed on the page but not necessarily form related,
> then
> > formBackingObject() for the actual pre-submission form population, and
> then
> > control the processing of pre-submit and post-submit with showForm() and
> > onSubmit()
> >
> > It was also smart enough to repopulate things like referenceData if there
> > was an invalid submission.
> >
> > Part of this was due to the fact that there were lots of different types
> of
> > controllers - all the referenceData and formBackingObject wasn't necessary
> > if you're just displaying a non-form page, but you could always use
> > SimpleFormController if you needed it.
> >
> > I'm not seeing that kind of behavior in Struts 2. I'm not saying it's
> > required functionality, but I certainly appreciated it in Spring MVC.
> >
> > Is it there and I'm not seeing it? How would you control the request like
> > this?
> > --
> > View this message in context:
> http://www.nabble.com/Question-about-Struts-2-Flow-Control-tp15190024p15190024.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)
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Best Regards
Wong Tseng

Attachment: user_182005.ezm (zipped)
--- stanlick@(protected):
> Parameters and it contains the value immediately before entering the
> iterator, as I am printing it out. Seems goofy to have to set a var just
> to use it in the loop two lines later.

#request is attributes. #parameters is parameters.

I can't dupe the issue with attributes.

d.

>
> On Jan 29, 2008 5:10 PM, Dave Newton <newton.dave@(protected):
>
> > --- stanlick <stanlick@(protected):
> > > I have a weird situation where I am losing a request
> > > parameter inside a loop!
> > > [...]
> > > <s:property value="#request.model.parentId" />
> >
> > Doesn't "#request" retrieve request *attributes*?
> >
> > Dave
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
> --
> Scott
> stanlick@(protected)
>


Attachment: user_182006.ezm (zipped)
Yeah, that's what I thought too! I'm passing the parameter via:

          <s:url id="url" action="%{actionClass}_show">
            <s:param name="model.parentId" value="id"/>
          </s:url>

and the tag <s:property value="#request.model.parentId" /> outputs the
number to the top of the page just fine. In fact, if I use
#parameters.model.parentId I get nothing. The problem is that I don't get
anything from the tag once inside the iterator.

On Jan 30, 2008 3:11 PM, Dave Newton <newton.dave@(protected):

> --- stanlick@(protected):
> > Parameters and it contains the value immediately before entering the
> > iterator, as I am printing it out. Seems goofy to have to set a var
> just
> > to use it in the loop two lines later.
>
> #request is attributes. #parameters is parameters.
>
> I can't dupe the issue with attributes.
>
> d.
>
> >
> > On Jan 29, 2008 5:10 PM, Dave Newton <newton.dave@(protected):
> >
> > > --- stanlick <stanlick@(protected):
> > > > I have a weird situation where I am losing a request
> > > > parameter inside a loop!
> > > > [...]
> > > > <s:property value="#request.model.parentId" />
> > >
> > > Doesn't "#request" retrieve request *attributes*?
> > >
> > > Dave
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > > For additional commands, e-mail: user-help@(protected)
> > >
> > >
> >
> >
> > --
> > Scott
> > stanlick@(protected)
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Scott
stanlick@(protected)

Attachment: user_182008.ezm (zipped)
Hi,

We have a reqierment to control startdate and enddate of the datepicker dynamically, so i have tried out for controlling it by a dojo script, which is breaking up the appearance of datepicker. So can any one suggest how to control it dyanimcally.

thanks in advance


regards,
minchu

   
---------------------------------
Unlimited freedom, unlimited storage. Get it now

Attachment: user_182009.ezm (zipped)
Have you tried the startDate and endDate parameters for the tag and
received an error?

http://struts.apache.org/2.x/docs/datetimepicker.html

-Wes

On Thu, 2008-01-31 at 05:24 +0000, Naveen Kumar M wrote:
> Hi,
>
> We have a reqierment to control startdate and enddate of the datepicker dynamically, so i have tried out for controlling it by a dojo script, which is breaking up the appearance of datepicker. So can any one suggest how to control it dyanimcally.
>
> thanks in advance
>
>
> regards,
> minchu
>
>    
> ---------------------------------
> Unlimited freedom, unlimited storage. Get it now


Attachment: user_182010.ezm (zipped)


I am very new to Struts 2 and Ajax. If u have any samples please send it.

Johan Snyman wrote:
>
> Hi Johnson (and others),
> I'm not really as retarded as I sound in the previous mail, just
> distracted
> while I was composing the mail. Please contact me if you find it as
> difficult to follow as I did after reading the first reply...
>
> Jo
>
>
>
>
> -----Original Message-----
> From: Johan Snyman [mailto:jsnyman@(protected)]
> Sent: 30 January 2008 03:43 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Struts 2 onchange event to get values from databases
>
> Hi Johnson,
>
> I'm no Struts expert but from my experience you have two ways of
> implementing what you want to achieve.
>
> 1. You can populate your dropdown box and have the fields empty. On your
> element you can set the onchange to call a javascript function that calls
> the same action, but passing it the content of your combobox, to do your
> database lookup on the server side and then pass the info to your
> userdetails.jsp where you can set your fields.
>
> 2. You can use AJAX to do the call asynchrononously, that is the value is
> passed to an action on the server and without the values passed back and
> filled into your fields. Nowadays you'll find plenty of tutorials and
> examples out there. Check out the following:
>
> http://struts.apache.org/2.x/docs/ajax.html
> (the official Struts AJAX guide)
>
> http://www.roseindia.net/struts/struts2/struts2ajax/index.shtml
> (easy login example)
>
> http://www.javaworld.com/javaworld/jw-08-2007/jw-08-ajaxtables.html?fsrc=rss
> -index
> (although is a rather tough example to follow if you're new to AJAX)
>
> http://www.planetstruts.org/struts2-showcase/showcase.action
> (showcase examples)
>
> Hope this helps
>
> Jo
>
>
>
> -----Original Message-----
> From: Johnson nickel [mailto:saravanan@(protected)]
> Sent: 30 January 2008 03:26 PM
> To: user@(protected)
> Subject: Struts 2 onchange event to get values from databases
>
>
> Hi All,
>
>       I am using Struts 2 application, i have userdetails.jsp its
> contains five text fields.
> two buttons save and update. In my action i have written save() method and
> update() method.  
>
> In my jsp one drop down box its contains users. At the time of onchange
> event to populate the text fileds values from databases.
>   can u give me any solutions how to do this?
>
> --
> View this message in context:
> http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
> p15182158p15182158.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)
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
>
> ---------------------------------------------------------------------
> 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_182011.ezm (zipped)
Dude,

Me thinks you're lazy for not going through the tutorials supplied on the
documentation site: http://struts.apache.org/2.x/docs/home.html

You'll have to set up 'n struts.xml file (saved in WEB-INF/classes folder)
that looks something like this:

<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
  <!-- <constant name="struts.devMode" value="false" /> -->
  <constant name="struts.enable.DynamicMethodInvocation" value="false" />
 
  <package name="mypackage " extends="struts-default">

  <action name="display" class="com.imlazy.DisplayUserDetails">
   <result>userdetails,jsp</result>
  </action>
</struts>

You'll have to implement the action class, which has the values you want to
pass to your jsp declared with getters and setter for each of them (JavaBean
style):

package com.imlazy;

import ******;

@SuppressWarnings("serial")
public class DisplayUserDetails extends ActionSupport {

 private String userName;
 private String userAddress;
 private List<String> userNameList;
 // etc

@Override
public String execute() throws Exception {
  // HERE YOU DO YOUR DB ACCESS AND WHATEVER TO POPULATE YOUR FIELDS
}

public String getUserName() {
  return userName;
}

public void setUsername(String userName) {
  this.userName = username;
}

// Other getters and setters
}

And finally your jsp that will be displaying the fields:

<%@(protected)" %>
<%@(protected)" %>

<html>
<head>
   <titleUser Details</title>
</head>

<body>
  <s:form>
   <s:combobox label="Users" list="HERE YOU MUST DEFINE THE LIST"
headerKey="-1" />
   
 <s:textfield key="userName">
   <!-- HERE FOLLOWS YOUR OTHER FIELD -->
  </s:form>
</body>
</html>



This is just touching what you need to do and know. Most important is to
understand. Go through the tutorial, know what you need to get an action to
display what you want to display (choose one user and just display the
values for that user). Only then start thinking about AJAX and how you
should be changing what is displayed as the combobox is changed.



Jo





-----Original Message-----
From: Johnson nickel [mailto:saravanan@(protected)]
Sent: 31 January 2008 07:35 AM
To: user@(protected)
Subject: RE: Struts 2 onchange event to get values from databases



I am very new to Struts 2 and Ajax. If u have any samples please send it.

Johan Snyman wrote:
>
> Hi Johnson (and others),
> I'm not really as retarded as I sound in the previous mail, just
> distracted
> while I was composing the mail. Please contact me if you find it as
> difficult to follow as I did after reading the first reply...
>
> Jo
>
>
>
>
> -----Original Message-----
> From: Johan Snyman [mailto:jsnyman@(protected)]
> Sent: 30 January 2008 03:43 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Struts 2 onchange event to get values from databases
>
> Hi Johnson,
>
> I'm no Struts expert but from my experience you have two ways of
> implementing what you want to achieve.
>
> 1. You can populate your dropdown box and have the fields empty. On your
> element you can set the onchange to call a javascript function that calls
> the same action, but passing it the content of your combobox, to do your
> database lookup on the server side and then pass the info to your
> userdetails.jsp where you can set your fields.
>
> 2. You can use AJAX to do the call asynchrononously, that is the value is
> passed to an action on the server and without the values passed back and
> filled into your fields. Nowadays you'll find plenty of tutorials and
> examples out there. Check out the following:
>
> http://struts.apache.org/2.x/docs/ajax.html
> (the official Struts AJAX guide)
>
> http://www.roseindia.net/struts/struts2/struts2ajax/index.shtml
> (easy login example)
>
>
http://www.javaworld.com/javaworld/jw-08-2007/jw-08-ajaxtables.html?fsrc=rss
> -index
> (although is a rather tough example to follow if you're new to AJAX)
>
> http://www.planetstruts.org/struts2-showcase/showcase.action
> (showcase examples)
>
> Hope this helps
>
> Jo
>
>
>
> -----Original Message-----
> From: Johnson nickel [mailto:saravanan@(protected)]
> Sent: 30 January 2008 03:26 PM
> To: user@(protected)
> Subject: Struts 2 onchange event to get values from databases
>
>
> Hi All,
>
>       I am using Struts 2 application, i have userdetails.jsp its
> contains five text fields.
> two buttons save and update. In my action i have written save() method and
> update() method.  
>
> In my jsp one drop down box its contains users. At the time of onchange
> event to populate the text fileds values from databases.
>   can u give me any solutions how to do this?
>
> --
> View this message in context:
>
http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
> p15182158p15182158.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)
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
p15182158p15198502.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)

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date: 2008/01/29
10:20 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date: 2008/01/29
10:20 PM



Attachment: user_182012.ezm (zipped)

Thanks for your quick response.
       I have created Jsp and action and struts.xml. you are mistaken
me(imlazy), i'm not
asking the code for my requirement.

     I want to display the userdetails, at the time of Onchange event.
I don't want
to use javascript. My details are getting from db. If you provide some
examples in AJAX
than it will be helpful.

Johan Snyman wrote:
>
> Dude,
>
> Me thinks you're lazy for not going through the tutorials supplied on the
> documentation site: http://struts.apache.org/2.x/docs/home.html
>
> You'll have to set up 'n struts.xml file (saved in WEB-INF/classes folder)
> that looks something like this:
>
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>   "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
>   <!-- <constant name="struts.devMode" value="false" /> -->
>   <constant name="struts.enable.DynamicMethodInvocation" value="false"
> />
>  
>   <package name="mypackage " extends="struts-default">
>
>   <action name="display" class="com.imlazy.DisplayUserDetails">
>     <result>userdetails,jsp</result>
>   </action>
> </struts>
>
> You'll have to implement the action class, which has the values you want
> to
> pass to your jsp declared with getters and setter for each of them
> (JavaBean
> style):
>
> package com.imlazy;
>
> import ******;
>
> @SuppressWarnings("serial")
> public class DisplayUserDetails extends ActionSupport {
>
>   private String userName;
>   private String userAddress;
>   private List<String> userNameList;
>   // etc
>
>  @Override
>  public String execute() throws Exception {
>   // HERE YOU DO YOUR DB ACCESS AND WHATEVER TO POPULATE YOUR FIELDS
>  }
>
>  public String getUserName() {
>   return userName;
>  }
>
>  public void setUsername(String userName) {
>   this.userName = username;
>  }
>
>  // Other getters and setters
> }
>
> And finally your jsp that will be displaying the fields:
>
> <%@(protected)" %>
> <%@(protected)" %>
>
> <html>
>  <head>
>     <titleUser Details</title>
>  </head>
>
>  <body>
>   <s:form>
>     <s:combobox label="Users" list="HERE YOU MUST DEFINE THE LIST"
> headerKey="-1" />
>    
>  <s:textfield key="userName">
>     <!-- HERE FOLLOWS YOUR OTHER FIELD -->
>   </s:form>
>  </body>
> </html>
>
>
>
> This is just touching what you need to do and know. Most important is to
> understand. Go through the tutorial, know what you need to get an action
> to
> display what you want to display (choose one user and just display the
> values for that user). Only then start thinking about AJAX and how you
> should be changing what is displayed as the combobox is changed.
>
>
>
> Jo
>
>
>
>
>
> -----Original Message-----
> From: Johnson nickel [mailto:saravanan@(protected)]
> Sent: 31 January 2008 07:35 AM
> To: user@(protected)
> Subject: RE: Struts 2 onchange event to get values from databases
>
>
>
> I am very new to Struts 2 and Ajax. If u have any samples please send it.
>
> Johan Snyman wrote:
>>
>> Hi Johnson (and others),
>> I'm not really as retarded as I sound in the previous mail, just
>> distracted
>> while I was composing the mail. Please contact me if you find it as
>> difficult to follow as I did after reading the first reply...
>>
>> Jo
>>
>>
>>
>>
>> -----Original Message-----
>> From: Johan Snyman [mailto:jsnyman@(protected)]
>> Sent: 30 January 2008 03:43 PM
>> To: 'Struts Users Mailing List'
>> Subject: RE: Struts 2 onchange event to get values from databases
>>
>> Hi Johnson,
>>
>> I'm no Struts expert but from my experience you have two ways of
>> implementing what you want to achieve.
>>
>> 1. You can populate your dropdown box and have the fields empty. On your
>> element you can set the onchange to call a javascript function that calls
>> the same action, but passing it the content of your combobox, to do your
>> database lookup on the server side and then pass the info to your
>> userdetails.jsp where you can set your fields.
>>
>> 2. You can use AJAX to do the call asynchrononously, that is the value is
>> passed to an action on the server and without the values passed back and
>> filled into your fields. Nowadays you'll find plenty of tutorials and
>> examples out there. Check out the following:
>>
>> http://struts.apache.org/2.x/docs/ajax.html
>> (the official Struts AJAX guide)
>>
>> http://www.roseindia.net/struts/struts2/struts2ajax/index.shtml
>> (easy login example)
>>
>>
> http://www.javaworld.com/javaworld/jw-08-2007/jw-08-ajaxtables.html?fsrc=rss
>> -index
>> (although is a rather tough example to follow if you're new to AJAX)
>>
>> http://www.planetstruts.org/struts2-showcase/showcase.action
>> (showcase examples)
>>
>> Hope this helps
>>
>> Jo
>>
>>
>>
>> -----Original Message-----
>> From: Johnson nickel [mailto:saravanan@(protected)]
>> Sent: 30 January 2008 03:26 PM
>> To: user@(protected)
>> Subject: Struts 2 onchange event to get values from databases
>>
>>
>> Hi All,
>>
>>       I am using Struts 2 application, i have userdetails.jsp its
>> contains five text fields.
>> two buttons save and update. In my action i have written save() method
>> and
>> update() method.  
>>
>> In my jsp one drop down box its contains users. At the time of onchange
>> event to populate the text fileds values from databases.
>>   can u give me any solutions how to do this?
>>
>> --
>> View this message in context:
>>
> http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
>> p15182158p15182158.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)
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
> p15182158p15198502.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)
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
>
> ---------------------------------------------------------------------
> 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_182014.ezm (zipped)
I implemented straight AJAX:

I have a element that has a onclick event defined. The onclick event calls a
JavaScript function.

So my element looks like this:

<span onclick=" addToExpandedNodeList(this.id)" />


And the Javascript functions (one is used the get the XmlHttpObject needed
to make AJAX calls):


// Get the XmlHttpObject to use for making AJAX calls
function getXmlHttpObject() {
var xmlHttp = null;
try {
// Firefox, Opera 8.0+, Safari
  xmlHttp = new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
  try {
   xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e) {
   try
   {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch (e) {
    alert("Your browser does not support AJAX!");
    return false;
   }
  }
}
return xmlHttp;
}

function addToExpandedNodeList(id) {
var xmlHttpObj = getXmlHttpObject();
if (xmlHttpObj) {
  var d = new Date();
  var t = d.getTime();
  xmlHttpObj.open("GET","display/display.action?idToChange=" + id +
"&time=" + t);
  xmlHttpObj.onreadystatechange = function() {
   if (xmlHttpObj.readyState == 4) {
    //alert("returned");
   }
  };
  xmlHttpObj.send();
} else {
  alert("Could not get the XmlHttpObj!!");
}
}


The XmlHttpObject is used to do the call to the server. I use it to open the
display action (with namespace display, that is why display/display.action)
and pass it an id. You'll also notice that I pass the time across as without
it, the browser does not want to refresh (can't remember which one, think it
was IE).

When the action returns a result, you will handle it with:
  xmlHttpObj.onreadystatechange = function() {
   if (xmlHttpObj.readyState == 4) {
    //alert("returned");
   }
  };

You'll see that I commented a line there where I have an alert. I don't have
to set anything when the action returns the result, so I don't use this.

You might want to think of using the AJAX theme on your components though.
For that you will have to read the tutorials on the pages I sent you
originally.

Jo





-----Original Message-----
From: Johnson nickel [mailto:saravanan@(protected)]
Sent: 31 January 2008 08:42 AM
To: user@(protected)
Subject: RE: Struts 2 onchange event to get values from databases


Thanks for your quick response.
       I have created Jsp and action and struts.xml. you are mistaken
me(imlazy), i'm not
asking the code for my requirement.

     I want to display the userdetails, at the time of Onchange event.
I don't want
to use javascript. My details are getting from db. If you provide some
examples in AJAX
than it will be helpful.

Johan Snyman wrote:
>
> Dude,
>
> Me thinks you're lazy for not going through the tutorials supplied on the
> documentation site: http://struts.apache.org/2.x/docs/home.html
>
> You'll have to set up 'n struts.xml file (saved in WEB-INF/classes folder)
> that looks something like this:
>
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>   "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
>   <!-- <constant name="struts.devMode" value="false" /> -->
>   <constant name="struts.enable.DynamicMethodInvocation" value="false"
> />
>  
>   <package name="mypackage " extends="struts-default">
>
>   <action name="display" class="com.imlazy.DisplayUserDetails">
>     <result>userdetails,jsp</result>
>   </action>
> </struts>
>
> You'll have to implement the action class, which has the values you want
> to
> pass to your jsp declared with getters and setter for each of them
> (JavaBean
> style):
>
> package com.imlazy;
>
> import ******;
>
> @SuppressWarnings("serial")
> public class DisplayUserDetails extends ActionSupport {
>
>   private String userName;
>   private String userAddress;
>   private List<String> userNameList;
>   // etc
>
>  @Override
>  public String execute() throws Exception {
>   // HERE YOU DO YOUR DB ACCESS AND WHATEVER TO POPULATE YOUR FIELDS
>  }
>
>  public String getUserName() {
>   return userName;
>  }
>
>  public void setUsername(String userName) {
>   this.userName = username;
>  }
>
>  // Other getters and setters
> }
>
> And finally your jsp that will be displaying the fields:
>
> <%@(protected)" %>
> <%@(protected)" %>
>
> <html>
>  <head>
>     <titleUser Details</title>
>  </head>
>
>  <body>
>   <s:form>
>     <s:combobox label="Users" list="HERE YOU MUST DEFINE THE LIST"
> headerKey="-1" />
>    
>  <s:textfield key="userName">
>     <!-- HERE FOLLOWS YOUR OTHER FIELD -->
>   </s:form>
>  </body>
> </html>
>
>
>
> This is just touching what you need to do and know. Most important is to
> understand. Go through the tutorial, know what you need to get an action
> to
> display what you want to display (choose one user and just display the
> values for that user). Only then start thinking about AJAX and how you
> should be changing what is displayed as the combobox is changed.
>
>
>
> Jo
>
>
>
>
>
> -----Original Message-----
> From: Johnson nickel [mailto:saravanan@(protected)]
> Sent: 31 January 2008 07:35 AM
> To: user@(protected)
> Subject: RE: Struts 2 onchange event to get values from databases
>
>
>
> I am very new to Struts 2 and Ajax. If u have any samples please send it.

>
> Johan Snyman wrote:
>>
>> Hi Johnson (and others),
>> I'm not really as retarded as I sound in the previous mail, just
>> distracted
>> while I was composing the mail. Please contact me if you find it as
>> difficult to follow as I did after reading the first reply...
>>
>> Jo
>>
>>
>>
>>
>> -----Original Message-----
>> From: Johan Snyman [mailto:jsnyman@(protected)]
>> Sent: 30 January 2008 03:43 PM
>> To: 'Struts Users Mailing List'
>> Subject: RE: Struts 2 onchange event to get values from databases
>>
>> Hi Johnson,
>>
>> I'm no Struts expert but from my experience you have two ways of
>> implementing what you want to achieve.
>>
>> 1. You can populate your dropdown box and have the fields empty. On your
>> element you can set the onchange to call a javascript function that calls
>> the same action, but passing it the content of your combobox, to do your
>> database lookup on the server side and then pass the info to your
>> userdetails.jsp where you can set your fields.
>>
>> 2. You can use AJAX to do the call asynchrononously, that is the value is
>> passed to an action on the server and without the values passed back and
>> filled into your fields. Nowadays you'll find plenty of tutorials and
>> examples out there. Check out the following:
>>
>> http://struts.apache.org/2.x/docs/ajax.html
>> (the official Struts AJAX guide)
>>
>> http://www.roseindia.net/struts/struts2/struts2ajax/index.shtml
>> (easy login example)
>>
>>
>
http://www.javaworld.com/javaworld/jw-08-2007/jw-08-ajaxtables.html?fsrc=rss
>> -index
>> (although is a rather tough example to follow if you're new to AJAX)
>>
>> http://www.planetstruts.org/struts2-showcase/showcase.action
>> (showcase examples)
>>
>> Hope this helps
>>
>> Jo
>>
>>
>>
>> -----Original Message-----
>> From: Johnson nickel [mailto:saravanan@(protected)]
>> Sent: 30 January 2008 03:26 PM
>> To: user@(protected)
>> Subject: Struts 2 onchange event to get values from databases
>>
>>
>> Hi All,
>>
>>       I am using Struts 2 application, i have userdetails.jsp its
>> contains five text fields.
>> two buttons save and update. In my action i have written save() method
>> and
>> update() method.  
>>
>> In my jsp one drop down box its contains users. At the time of onchange
>> event to populate the text fileds values from databases.
>>   can u give me any solutions how to do this?
>>
>> --
>> View this message in context:
>>
>
http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
>> p15182158p15182158.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)
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
>> 2008/01/29
>> 10:20 PM
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
> --
> View this message in context:
>
http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
> p15182158p15198502.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)
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date:
> 2008/01/29
> 10:20 PM
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
http://www.nabble.com/Struts-2-onchange-event-to-get-values-from-databases-t
p15182158p15199062.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)

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date: 2008/01/29
10:20 PM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.19.16/1250 - Release Date: 2008/01/29
10:20 PM



Attachment: user_182013.ezm (zipped)
Your code likes fine so it appears that dojo has not parsed the html for
widgets.
I think there's an attribute on sx:head to enable this in Struts2.1
(parseContent=true or something like that)

Desbois Arnaud wrote:
> I'm using Struts 2.1.0, and I want to use the dojo widget dialog.
>
>
>
> I try this simple code:
>
> <%@(protected)" %>
>
> <html>
>
> <head>
>
> <sx:head debug="true"/>
>
> <script type="text/javascript">
>
> dojo.require("dojo.widget.Dialog");
>
> var dlg;
>
> function init() {
>
>  dlg = dojo.widget.byId("dialogContent");
>
>  dojo.debug("dlg="+dlg);
>
>  alert(dlg+" "+document.getElementById("dialogContent"));
>
> }
>
> dojo.addOnLoad(init);
>
> </script>
>
> </head>
>
>
>
> <body>
>
> <a href="javascript:dlg.show()">Show</a>
>
> <div dojoType="Dialog" id="dialogContent" bgColor="grey" bgOpacity="0.5"
> toggle="fade" toggleDuration="250" closeOnBackgroundClick="true">
>
> Hello World!
>
> </div>
>
> </body>
>
> </html>
>
>
>
> But the variable dlg is always undefined (but with the
> document.getElementById("dialogContent"), the div is correctly present)
>
>
>
> How I can correctly use the widget dialog into Struts 2.1.0 ?
>
>
>
> Best regards
>
> Arnaud
>
>
>
>
>  
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.15/1249 - Release Date: 29/01/2008 9:51 AM
>  

©2008 gg3721.com - Jax Systems, LLC, U.S.A.