You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by 白鹏 <bi...@gmail.com> on 2009/04/13 07:15:15 UTC

hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Has anyone use the validation framework of struts 2.1.6??

??

Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by Paweł Wielgus <po...@gmail.com>.
Hi,
mabe You should try to run struts blank app, the one that comes from
downloaded zip file,
there evrything should work fine and You will have a chance to see
what differs from Your app.

Best greetings,
Paweł Wielgus.

2009/4/13 白鹏 <bi...@gmail.com>:
> Has anyone use the validation framework of struts 2.1.6??
>
> ??
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


struts2.1.6 dojo ajax tags conflict with fileupload interceptor?

Posted by Eric Zhao <zh...@utsc.utoronto.ca>.
Hello:

I am trying to use struts2.1.6 dojo tags (<%@ taglib prefix="sx" 
uri="/struts-dojo-tags" %>) within a multipart form which also uses 
fileupload interceptor, but  with no success.

My dojo tags is to populate a second drop down based on selection of 
first dropdown. This works fine on regular form. But once the form 
becomes mulitpart with file uploads, dojo tags stop working. Core 
elements from the form looks like this:

<%@ taglib prefix="s" uri="/struts-tags" %>
 <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
 <jsp:include page="/includes/struts2/header.jsp"/>
   <head>
       <sx:head parseContent="true"/>   
  </head>
  <script language="JavaScript">
    function show_courses() {    
      document.a_form.selected_userid.value = 
document.getElementById("for_id_list").value;
      dojo.event.topic.publish("show_courses");
  }
</script>

<s:form action="%{actionName}" method="post" 
enctype="multipart/form-data" theme="simple" id="a_form" name="a_form">
<s:select list="mygroup" name="for_id_list" id="for_id_list" 
listKey="key" listValue="value" name="scheduledFor" value="scheduledFor"   
     onchange="show_courses();return false;"/>
<s:file label="attach file" name="upload" value="uploadFileNames"/>
    <s:hidden name="selected_userid"/>
    <s:url id="d_url" action="CourseAction"/>
    <sx:div  id="course_list" href="%{d_url}" 
listenTopics="show_courses" formId="a_form" >
    </sx:div>
</s:form>

There is the normal fileupload code in Action class like below:

private List<File> uploads = new ArrayList<File>();
private List<String> uploadFileNames = new ArrayList<String>();
private List<String> uploadContentTypes = new ArrayList<String>();
private void uploadFiles() {
        try {
            if (uploads != null) {
                for (int i = 0; i < uploads.size(); i++) {
                    File theFile = new File(getFileSavingPath()  + 
uploadFileNames.get(i));
                    FileUtils.copyFile(uploads.get(i), theFile);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Does anyone have experience using dojo tags successfully with file 
upload interceptor? Any suggestions and pointers are greatly appreciated!

Have a good day!

-- 
Eric Zhao					     
Application Developer    
IITS, University of Toronto Scarborough	
Office#: 416-208-2676			     




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by 白鹏 <bi...@gmail.com>.
Oh , I have fixed it.  :)
The bug is  in the login.jsp , I wrote
<s:form action="*login.action*" validate="true" namespace="/logreg">
..
*login.action is a Url .. So the client side validation did not work. *

2009/4/14 白鹏 <bi...@gmail.com>

> I try to use the validation framework  in the *client side* But failed.
>
> It is a  ' login' scenario. In the html source , I find
> <script type="text/javascript" src="/LearnDataProject/struts/xhtml/*
> validation.js*"></script>
>     <script type="text/javascript" src="/LearnDataProject/struts*/utils.js
> *"></script>
> <form id="login" onsubmit="return *validateForm_login();*"
> action="login.action" method="post"
> onreset="clearErrorMessages(this);clearErrorLabels(this);"
> >
> but there isn't the function *validateForm_login(); in the validation.js
> or utils.js.  *
>  The browser told me that there was something wrong with *the
> validateForm_login(); No such an object ! *.
>
> 2009/4/13 Dave Newton <ne...@yahoo.com>
>
> ?? wrote:
>>
>>> Has anyone use the validation framework of struts 2.1.6??
>>>
>>
>> Yes.
>>
>> Dave
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by 白鹏 <bi...@gmail.com>.
I try to use the validation framework  in the *client side* But failed.

It is a  ' login' scenario. In the html source , I find
<script type="text/javascript" src="/LearnDataProject/struts/xhtml/*
validation.js*"></script>
    <script type="text/javascript" src="/LearnDataProject/struts*/utils.js*
"></script>
<form id="login" onsubmit="return *validateForm_login();*"
action="login.action" method="post"
onreset="clearErrorMessages(this);clearErrorLabels(this);"
>
but there isn't the function *validateForm_login(); in the validation.js or
utils.js.  *
 The browser told me that there was something wrong with *the
validateForm_login(); No such an object ! *.

2009/4/13 Dave Newton <ne...@yahoo.com>

> ?? wrote:
>
>> Has anyone use the validation framework of struts 2.1.6??
>>
>
> Yes.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by Dave Newton <ne...@yahoo.com>.
?? wrote:
> Has anyone use the validation framework of struts 2.1.6??

Yes.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by Dave Newton <ne...@yahoo.com>.
Martin Gainty wrote:
> Original Op: feel free to ping me offline for specific details ..

It's better to keep Struts-related topics on the mailing list/forum, 
that way everybody benefits. To quote from the JavaRanch FAQ:

"The whole point of [it] is that the whole community can benefit from 
public discussion - everyone can contribute to anyone's knowledge and 
learn something along the way. And even when a topic has stopped being 
discussed, people will still read it and perhaps find the answer to 
their pressing question."

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by Martin Gainty <mg...@hotmail.com>.
Great Answer!

Original Op: feel free to ping me offline for specific details ..

Thanks
Martin Gainty 
______________________________________________ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité 
This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.






> Date: Tue, 14 Apr 2009 07:00:17 -0400
> From: Terry.Gardner@Sun.COM
> Subject: Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6	.
> To: user@struts.apache.org
> 
> yes.
> 
> On Apr 13, 2009, at 1:15 AM, 白鹏 wrote:
> 
> > Has anyone use the validation framework of struts 2.1.6??
> >
> > ??
> 
> 
> ======
> 
> 
> Terry.Gardner@Sun.COM
> Blog: http://blogs.sun.com/terrygardner
> Blog: http://dtfar.blogspot.com
> Twitter: http://twitter.com/tgardner
> SLAMD: http://slamd2.dev.java.net
> Skype: Terry_J_Gardner
> 
> "The best things in life are not things."
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Rediscover Hotmail®: Now available on your iPhone or BlackBerry
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Mobile1_042009

Re: hi,guys! I wonder the validation framework is ok in the Struts 2.1.6 .

Posted by Terry Gardner <Te...@Sun.COM>.
yes.

On Apr 13, 2009, at 1:15 AM, 白鹏 wrote:

> Has anyone use the validation framework of struts 2.1.6??
>
> ??


======


Terry.Gardner@Sun.COM
Blog: http://blogs.sun.com/terrygardner
Blog: http://dtfar.blogspot.com
Twitter: http://twitter.com/tgardner
SLAMD: http://slamd2.dev.java.net
Skype: Terry_J_Gardner

"The best things in life are not things."










---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org