struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sreekanth S. Nair" <sreekanth.n...@egovernments.org>
Subject Re: validation problem
Date Fri, 26 Dec 2014 06:54:08 GMT
I couldn't make your sample war run at all, please find the attached sample
war which is working for me in tomcat 7 (struts2 jars and other dep not
included). You can follow the directory structure and naming convention and
try to do the same in your project. Do not add @SkipValidation annotation
in your save or submit method (@SkipValidation will in fact ignore
validation for it)

-- 
Thanks & Regards

Sreekanth S Nair
Java Developer
-------------------------------------------
eGovernments Foundation <http://www.egovernments.org>
Ph : 9980078913
-------------------------------------------
<http://in.linkedin.com/pub/sreekanth-s-nair/b/946/5a0/>
<https://github.com/sreekanthsnair>   <sreekanthsnair@hotmail.co.uk>
<sreekanthsnyr@gmail.com>
-------------------------------------------

On Fri, Dec 26, 2014 at 11:32 AM, Sreekanth S. Nair <
sreekanth.nair@egovernments.org> wrote:

> Ok let me try and will get back to you...
>
>
> On Fri, Dec 26, 2014 at 11:26 AM, Yaragalla Muralidhar <
> yaragallamurali@gmail.com> wrote:
>
>> Hi Sreekanth,
>>       I think i cannot send attachements to the mailing list so i have
>> uploaded the project to my drive and sharing the link
>>
>>
>> https://drive.google.com/file/d/0B59LVhKQaKQYamZqbnc4NGtOQm8/view?usp=sharing
>>
>>
>> i am using tomcat 7.
>>
>> *Thanks and Regards,*
>> Muralidhar Yaragalla.
>>
>> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>>
>> On Fri, Dec 26, 2014 at 9:32 AM, Sreekanth S. Nair <
>> sreekanth.nair@egovernments.org> wrote:
>>
>> > Can you share a sample project which is not working, and just let me
>> know
>> > which server you are trying..?
>> >
>> > --
>> > Thanks & Regards
>> >
>> > Sreekanth S Nair
>> > Java Developer
>> > -------------------------------------------
>> > eGovernments Foundation <http://www.egovernments.org>
>> > Ph : 9980078913
>> > -------------------------------------------
>> > <http://in.linkedin.com/pub/sreekanth-s-nair/b/946/5a0/>
>> > <https://github.com/sreekanthsnair>   <sreekanthsnair@hotmail.co.uk>
>> > <sreekanthsnyr@gmail.com>
>> > -------------------------------------------
>> >
>> > On Fri, Dec 26, 2014 at 9:10 AM, Yaragalla Muralidhar <
>> > yaragallamurali@gmail.com> wrote:
>> >
>> > > Hi sreekanth,
>> > >            I have changed the names as u suggested but it did not
>> work. i
>> > > have read the link u posted and i did everything that the link says. i
>> > have
>> > > debugged as well. it is not throwing any error.
>> > >
>> > > *Thanks and Regards,*
>> > > Muralidhar Yaragalla.
>> > >
>> > > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>> > >
>> > > On Thu, Dec 25, 2014 at 10:43 PM, Sreekanth S. Nair <
>> > > sreekanth.nair@egovernments.org> wrote:
>> > >
>> > > > As Dave said, kindly show some patience.
>> > > >
>> > > > First of validation is nothing to do with theme so just leave the
>> theme
>> > > > alone.
>> > > >
>> > > > 1) Can you try renaming the action class name from SampleRegOne to
>> > > > SampleRegOneAction
>> > > > and same in struts.xml
>> > > >
>> > > > 2) If you give action alias name like below,
>> > > >  <action name="sampleRegOne"
>> > > > class="com.zedlabs.samplereg.action.SampleRegOne" >
>> > > >
>> > > > as far as i understood you need to use the alias name suffixed along
>> > with
>> > > > the action class name so in essence your validator xml name should
>> be
>> > > some
>> > > > thing like below
>> > > >
>> > > > SampleRegOne-sampleRegOne-validation.xml
>> > > >
>> > > > Since i don't have much knowledge in xml based validation i
>> recommend
>> > you
>> > > > to read upon struts2 xml based validation from the below link
>> > > >
>> > > >
>> > >
>> >
>> http://www.codejava.net/frameworks/struts/struts2-form-validation-basic-example-using-xml
>> > > >
>> > > > If the above solution is not working then try and figure out the
>> > problem
>> > > by
>> > > > debugging through struts2 source.
>> > > >
>> > > > If the above solutions couldn't resolve your problem then get some
>> > debug
>> > > > level log of struts2 while accessing that particular action and
>> post it
>> > > > over here.
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > On Thu, Dec 25, 2014 at 8:34 PM, Dave Newton <davelnewton@gmail.com
>> >
>> > > > wrote:
>> > > >
>> > > > > Unrelated to the technical issue: bear in mind the mailing list
>> is a
>> > > > > volunteer-"staffed" resource. Nobody is deliberately delaying
a
>> > > > > response. We already know you need help. In the US, at least,
>> it's a
>> > > > > fairly major holiday, and people are doing things besides trying
>> to
>> > > > > reproduce your environment and code to help out.
>> > > > >
>> > > > > With that in mind, please be patient.
>> > > > >
>> > > > >
>> > > > > On Thu, Dec 25, 2014 at 9:01 AM, Yaragalla Muralidhar
>> > > > > <yaragallamurali@gmail.com> wrote:
>> > > > > > kindly help me solve this issue
>> > > > > >
>> > > > > > *Thanks and Regards,*
>> > > > > > Muralidhar Yaragalla.
>> > > > > >
>> > > > > > *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>> > > > > >
>> > > > > > On Thu, Dec 25, 2014 at 8:02 PM, Yaragalla Muralidhar <
>> > > > > > yaragallamurali@gmail.com> wrote:
>> > > > > >
>> > > > > >> my struts config.xml is as below.kindly help me in solving
>> this.
>> > > > > >>
>> > > > > >> <?xml version="1.0" encoding="UTF-8" ?>
>> > > > > >> <!DOCTYPE struts PUBLIC
>> > > > > >> "-//Apache Software Foundation//DTD Struts Configuration
>> 2.3//EN"
>> > > > > >> "http://struts.apache.org/dtds/struts-2.3.dtd">
>> > > > > >>
>> > > > > >> <struts>
>> > > > > >>
>> > > > > >>     <constant name="struts.enable.DynamicMethodInvocation"
>> > > > > value="false" />
>> > > > > >>     <constant name="struts.devMode" value="true"
/>
>> > > > > >>
>> > > > > >>
>> > > > > >>
>> > > > > >>     <package name="sr" namespace="/" extends="struts-default">
>> > > > > >>
>> > > > > >>      <interceptors>
>> > > > > >>         <interceptor-stack name="appDefault">
>> > > > > >>           <interceptor-ref name="defaultStack" />
>> > > > > >>         </interceptor-stack>
>> > > > > >>     </interceptors>
>> > > > > >>
>> > > > > >>     <default-interceptor-ref name="appDefault" />
>> > > > > >>
>> > > > > >>         <global-results>
>> > > > > >>             <result name="error">/error.jsp</result>
>> > > > > >>         </global-results>
>> > > > > >>
>> > > > > >>         <global-exception-mappings>
>> > > > > >>             <exception-mapping exception="java.lang.Exception"
>> > > > > >> result="error"/>
>> > > > > >>         </global-exception-mappings>
>> > > > > >>
>> > > > > >>   <action name="start"
>> > > > > class="com.zedlabs.samplereg.action.InitialAction"
>> > > > > >> >
>> > > > > >>     <result name="success"
>> > > > > >/sampleReg/jsp/sampleRegTemplate.jsp</result>
>> > > > > >>
>> > > > > >>   </action>
>> > > > > >>
>> > > > > >>   <action name="sampleRegOne"
>> > > > > >> class="com.zedlabs.samplereg.action.SampleRegOne" >
>> > > > > >>     <result name="success"
>> > > > > >> >/sampleReg/jsp/sampleRegTwoTemplate.jsp</result>
>> > > > > >>     <result name="input"
>> > > > >/sampleReg/jsp/sampleRegTemplate.jsp</result>
>> > > > > >>
>> > > > > >>   </action>
>> > > > > >>   <action name="sampleRegTwo"
>> > > > > >> class="com.zedlabs.samplereg.action.SampleRegTwoAction"
>
>> > > > > >>     <result name="success"
>> > > > > >> >/sampleReg/jsp/sampleRegThreeTemplate.jsp</result>
>> > > > > >>   </action>
>> > > > > >>   <action name="sampleRegThree"
>> > > > > >> class="com.zedlabs.samplereg.action.SampleRegThreeAction"
>
>> > > > > >>     <result name="success"
>> > > > > >> >/sampleReg/jsp/sampleRegFourTemplate.jsp</result>
>> > > > > >>   </action>
>> > > > > >>
>> > > > > >>     </package>
>> > > > > >>
>> > > > > >>     <include file="mailreader-default.xml"/>
>> > > > > >>
>> > > > > >> </struts>
>> > > > > >>
>> > > > > >>
>> > > > > >> *Thanks and Regards,*
>> > > > > >> Muralidhar Yaragalla.
>> > > > > >>
>> > > > > >> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/
>> >*
>> > > > > >>
>> > > > > >> On Thu, Dec 25, 2014 at 7:47 PM, Yaragalla Muralidhar
<
>> > > > > >> yaragallamurali@gmail.com> wrote:
>> > > > > >>
>> > > > > >>> The following is my action class
>> > > > > >>>
>> > > > > >>> package com.zedlabs.samplereg.action;
>> > > > > >>>
>> > > > > >>> import java.util.HashMap;
>> > > > > >>> import java.util.Map;
>> > > > > >>>
>> > > > > >>> import org.apache.commons.logging.Log;
>> > > > > >>> import org.apache.commons.logging.LogFactory;
>> > > > > >>>
>> > > > > >>> import com.zedlabs.action.ZedActionSupport;
>> > > > > >>> import com.zedlabs.samplereg.dto.PDDto;
>> > > > > >>> import com.zedlabs.samplereg.service.SampleRegService;
>> > > > > >>> import com.zedlabs.samplereg.service.SampleRegServiceImpl;
>> > > > > >>>
>> > > > > >>> public class SampleRegOne extends ZedActionSupport
{
>> > > > > >>>
>> > > > > >>> private static final long serialVersionUID =
>> > -8621676046564513353L;
>> > > > > >>> private Log log=LogFactory.getLog(SampleRegOne.class);
>> > > > > >>> private SampleRegService sampleReg=new SampleRegServiceImpl();
>> > > > > >>>  private Map<String,String> sampledrawnBy=new
>> > > > HashMap<String,String>();
>> > > > > >>> private PDDto primaryDetails=new PDDto();
>> > > > > >>>  @Override
>> > > > > >>> public String execute() {
>> > > > > >>> try{
>> > > > > >>> sampledrawnBy.put("zedlabs", "Zedlabs");
>> > > > > >>> sampleReg.savePrimaryDetails(primaryDetails);
>> > > > > >>>  }catch(Exception e){
>> > > > > >>> log.error(e.getMessage(), e);
>> > > > > >>> }
>> > > > > >>> return SUCCESS;
>> > > > > >>> }
>> > > > > >>>
>> > > > > >>> public Map<String, String> getSampledrawnBy()
{
>> > > > > >>> return sampledrawnBy;
>> > > > > >>> }
>> > > > > >>>
>> > > > > >>> public void setSampledrawnBy(Map<String, String>
>> sampledrawnBy) {
>> > > > > >>> this.sampledrawnBy = sampledrawnBy;
>> > > > > >>> }
>> > > > > >>>
>> > > > > >>> public PDDto getPrimaryDetails() {
>> > > > > >>> return primaryDetails;
>> > > > > >>> }
>> > > > > >>>
>> > > > > >>> public void setPrimaryDetails(PDDto primaryDetails)
{
>> > > > > >>> this.primaryDetails = primaryDetails;
>> > > > > >>> }
>> > > > > >>>
>> > > > > >>>
>> > > > > >>> }
>> > > > > >>>
>> > > > > >>>
>> > > > > >>> *Thanks and Regards,*
>> > > > > >>> Muralidhar Yaragalla.
>> > > > > >>>
>> > > > > >>> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/
>> >*
>> > > > > >>>
>> > > > > >>> On Thu, Dec 25, 2014 at 6:30 PM, Yaragalla Muralidhar
<
>> > > > > >>> yaragallamurali@gmail.com> wrote:
>> > > > > >>>
>> > > > > >>>> if the validation works then i can think about
messages
>> > > > > >>>>
>> > > > > >>>> *Thanks and Regards,*
>> > > > > >>>> Muralidhar Yaragalla.
>> > > > > >>>>
>> > > > > >>>> *http://yaragalla.blogspot.in/ <
>> http://yaragalla.blogspot.in/>*
>> > > > > >>>>
>> > > > > >>>> On Thu, Dec 25, 2014 at 6:30 PM, Yaragalla Muralidhar
<
>> > > > > >>>> yaragallamurali@gmail.com> wrote:
>> > > > > >>>>
>> > > > > >>>>> I have changed the theme to css_xhtml  
so it should display
>> > > right?
>> > > > > >>>>>
>> > > > > >>>>> *Thanks and Regards,*
>> > > > > >>>>> Muralidhar Yaragalla.
>> > > > > >>>>>
>> > > > > >>>>> *http://yaragalla.blogspot.in/ <
>> http://yaragalla.blogspot.in/
>> > >*
>> > > > > >>>>>
>> > > > > >>>>> On Thu, Dec 25, 2014 at 6:28 PM, Dave Newton
<
>> > > > davelnewton@gmail.com>
>> > > > > >>>>> wrote:
>> > > > > >>>>>
>> > > > > >>>>>> Then you're doing something else wrong;
never mind.
>> > > > > >>>>>>
>> > > > > >>>>>> You still won't see the messages unless
you display them
>> > > manually.
>> > > > > >>>>>>
>> > > > > >>>>>> On Thu, Dec 25, 2014 at 6:56 AM, Yaragalla
Muralidhar
>> > > > > >>>>>> <yaragallamurali@gmail.com> wrote:
>> > > > > >>>>>> > in my case validations are not
happenening . Even though
>> > > > > validation
>> > > > > >>>>>> fails
>> > > > > >>>>>> > it is moving to succeess rather
than input jsp.
>> > > > > >>>>>> >
>> > > > > >>>>>> > *Thanks and Regards,*
>> > > > > >>>>>> > Muralidhar Yaragalla.
>> > > > > >>>>>> >
>> > > > > >>>>>> > *http://yaragalla.blogspot.in/
<
>> > http://yaragalla.blogspot.in/
>> > > >*
>> > > > > >>>>>> >
>> > > > > >>>>>> > On Thu, Dec 25, 2014 at 6:15 PM,
Dave Newton <
>> > > > > davelnewton@gmail.com>
>> > > > > >>>>>> wrote:
>> > > > > >>>>>> >
>> > > > > >>>>>> >> Please read up on the themes.
>> > > > > >>>>>> >>
>> > > > > >>>>>> >> Nutshell: validation happens
(this is trivially
>> provable),
>> > > > > >>>>>> validation
>> > > > > >>>>>> >> message display does not.
>> > > > > >>>>>> >>
>> > > > > >>>>>> >> On Thu, Dec 25, 2014 at 6:41
AM, Yaragalla Muralidhar
>> > > > > >>>>>> >> <yaragallamurali@gmail.com>
wrote:
>> > > > > >>>>>> >> > is it because of the simple
theam? In simple theam
>> > > > validations
>> > > > > >>>>>> dont
>> > > > > >>>>>> >> happen
>> > > > > >>>>>> >> > is it? if i dont use simple
theme view components are
>> > > > > generating
>> > > > > >>>>>> their
>> > > > > >>>>>> >> own
>> > > > > >>>>>> >> > decoration. Our custom
alignment is going wrong.
>> > > > > >>>>>> >> >
>> > > > > >>>>>> >> > *Thanks and Regards,*
>> > > > > >>>>>> >> > Muralidhar Yaragalla.
>> > > > > >>>>>> >> >
>> > > > > >>>>>> >> > *http://yaragalla.blogspot.in/
<
>> > > > http://yaragalla.blogspot.in/
>> > > > > >*
>> > > > > >>>>>> >> >
>> > > > > >>>>>> >> > On Thu, Dec 25, 2014 at
5:05 PM, Dave Newton <
>> > > > > >>>>>> davelnewton@gmail.com>
>> > > > > >>>>>> >> wrote:
>> > > > > >>>>>> >> >
>> > > > > >>>>>> >> >> Simple theme is simpler
than you think.
>> > > > > >>>>>> >> >> On Dec 25, 2014 4:46
AM, "Yaragalla Muralidhar" <
>> > > > > >>>>>> >> yaragallamurali@gmail.com
>> > > > > >>>>>> >> >> >
>> > > > > >>>>>> >> >> wrote:
>> > > > > >>>>>> >> >>
>> > > > > >>>>>> >> >> > I am using struts2.3.20
and using simple theme.
>> > > > > >>>>>> >> >> >
>> > > > > >>>>>> >> >> > *Thanks and Regards,*
>> > > > > >>>>>> >> >> > Muralidhar Yaragalla.
>> > > > > >>>>>> >> >> >
>> > > > > >>>>>> >> >> > *http://yaragalla.blogspot.in/
<
>> > > > > http://yaragalla.blogspot.in/
>> > > > > >>>>>> >*
>> > > > > >>>>>> >> >> >
>> > > > > >>>>>> >> >> > On Thu, Dec 25,
2014 at 4:08 PM, Yaragalla
>> Muralidhar
>> > <
>> > > > > >>>>>> >> >> > yaragallamurali@gmail.com>
wrote:
>> > > > > >>>>>> >> >> >
>> > > > > >>>>>> >> >> > > Hi i am
having problem in turning on
>> validations. I
>> > > have
>> > > > > >>>>>> written
>> > > > > >>>>>> >> >> > > "actionClass-validation.xml"
file in the same
>> > package
>> > > as
>> > > > > >>>>>> action
>> > > > > >>>>>> >> class.
>> > > > > >>>>>> >> >> > but
>> > > > > >>>>>> >> >> > > the validations
are not working. the following
>> is my
>> > > > > >>>>>> validation xml
>> > > > > >>>>>> >> >> file.
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > <!DOCTYPE
validators PUBLIC "-//Apache
>> Struts//XWork
>> > > > > >>>>>> Validator
>> > > > > >>>>>> >> >> 1.0.3//EN"
>> > > > > >>>>>> >> >> > >        
"
>> > > > > >>>>>> http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
>> > > > > >>>>>> >> >> > > <validators>
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > <field
name="primaryDetails.branchId">
>> > > > > >>>>>> >> >> > >      <field-validator
type="required">
>> > > > > >>>>>> >> >> > >        <message
key="
>> > > > error.additional.details.passport.no
>> > > > > >>>>>> ">Could
>> > > > > >>>>>> >> not
>> > > > > >>>>>> >> >> > find
>> > > > > >>>>>> >> >> > > error.additional.details.passport.no!</message>
>> > > > > >>>>>> >> >> > >      </field-validator>
>> > > > > >>>>>> >> >> > >      <field-validator
type="regex">
>> > > > > >>>>>> >> >> > >        
  <param
>> > > > > name="regex"><![CDATA[[1-9]{0,40}]]></param>
>> > > > > >>>>>> >> >> > >        <message
key="
>> > > > error.additional.details.pancard.no
>> > > > > ">Could
>> > > > > >>>>>> not
>> > > > > >>>>>> >> >> find
>> > > > > >>>>>> >> >> > > error.additional.details.pancard.no</message>
>> > > > > >>>>>> >> >> > >      </field-validator>
>> > > > > >>>>>> >> >> > > </field>
>> > > > > >>>>>> >> >> > >  <field
name="primaryDetails.patientName">
>> > > > > >>>>>> >> >> > >      <field-validator
type="required">
>> > > > > >>>>>> >> >> > >        <message
key="
>> > > > error.additional.details.passport.no
>> > > > > >>>>>> ">Could
>> > > > > >>>>>> >> not
>> > > > > >>>>>> >> >> > find
>> > > > > >>>>>> >> >> > > error.additional.details.passport.no!</message>
>> > > > > >>>>>> >> >> > >      </field-validator>
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > </field>
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > </validators>
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > do i have
to do something else to turn on
>> > validations?
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > *Thanks
and Regards,*
>> > > > > >>>>>> >> >> > > Muralidhar
Yaragalla.
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> > > *http://yaragalla.blogspot.in/
<
>> > > > > >>>>>> http://yaragalla.blogspot.in/>*
>> > > > > >>>>>> >> >> > >
>> > > > > >>>>>> >> >> >
>> > > > > >>>>>> >> >>
>> > > > > >>>>>> >>
>> > > > > >>>>>> >>
>> > > > > >>>>>> >>
>> > > > > >>>>>> >> --
>> > > > > >>>>>> >> e: davelnewton@gmail.com
>> > > > > >>>>>> >> m: 908-380-8699
>> > > > > >>>>>> >> s: davelnewton_skype
>> > > > > >>>>>> >> t: @dave_newton
>> > > > > >>>>>> >> b: Bucky Bits
>> > > > > >>>>>> >> g: davelnewton
>> > > > > >>>>>> >> so: Dave Newton
>> > > > > >>>>>> >>
>> > > > > >>>>>> >>
>> > > > > >>>>>>
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > >>>>>> >> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> > > > > >>>>>> >> For additional commands, e-mail:
>> > user-help@struts.apache.org
>> > > > > >>>>>> >>
>> > > > > >>>>>> >>
>> > > > > >>>>>>
>> > > > > >>>>>>
>> > > > > >>>>>>
>> > > > > >>>>>> --
>> > > > > >>>>>> e: davelnewton@gmail.com
>> > > > > >>>>>> m: 908-380-8699
>> > > > > >>>>>> s: davelnewton_skype
>> > > > > >>>>>> t: @dave_newton
>> > > > > >>>>>> b: Bucky Bits
>> > > > > >>>>>> g: davelnewton
>> > > > > >>>>>> so: Dave Newton
>> > > > > >>>>>>
>> > > > > >>>>>>
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > >>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > > > > >>>>>> For additional commands, e-mail:
>> user-help@struts.apache.org
>> > > > > >>>>>>
>> > > > > >>>>>>
>> > > > > >>>>>
>> > > > > >>>>
>> > > > > >>>
>> > > > > >>
>> > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > > e: davelnewton@gmail.com
>> > > > > m: 908-380-8699
>> > > > > s: davelnewton_skype
>> > > > > t: @dave_newton
>> > > > > b: Bucky Bits
>> > > > > g: davelnewton
>> > > > > so: Dave Newton
>> > > > >
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > > > > For additional commands, e-mail: user-help@struts.apache.org
>> > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
>
>

Mime
View raw message