You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RajiR <ra...@yahoo.com> on 2008/03/03 05:28:35 UTC

Re: HOw to send form parameters to dao in struts2 with hibernate?

Hi,

I have a field in my jsp page to enter emailaddress. Inorder to validate it
i have used the<field-validator type="email"> but its not validating.Its
only validating for strings(type=requiredstring) and if type="required"  and
page is submitting .What may b the reason?
            Also,If I have inserted details into the database with a
particular primary key value.I should not again insert the same id and shud
throw a custom validation msg that "UserId already registered".How to throw
custom validations in struts2?

Thanks.


Randy Burgess-3 wrote:
> 
> If you have your service and DAO defined in a Spring application context
> you
> would normally have the DAO as a property of your service or you would
> have
> a constructor-ref for it. Spring has to be bootstrapped somehow so use
> either the spring plugin and define your action as a spring bean and
> reference the service bean as a property of your action or you need to
> instantiate Spring using ClassPathXmlApplicationContext or one of the
> other
> Spring context objects.
> 
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
> 
> 
> 
>> From: RajiR <ra...@yahoo.com>
>> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
>> Date: Wed, 27 Feb 2008 22:23:26 -0800 (PST)
>> To: <us...@struts.apache.org>
>> Subject: HOw to send form parameters to dao in struts2 with hibernate?
>> 
>> 
>>  Hi,
>> 
>> By implementing Preparable,ModelDriven,ServletRequestAware interfaces,am
>> able to get the form details and sent those details to service
>> implementation layer from an action class.From service implementation i
>> have
>> called dao.Since DAO is not injected any where in struts.xml,its throwing
>> nullpointerexception.I have used only hibernate.Is it required to use
>> springs inorder to inject dao?Or,can I inject using hibernate and struts2
>> alone??
>> 
>> And what is the use of interceptor concept?Does it help to do dao
>> injection
>> without using spring?If so,how to use it?
>> 
>> Plzzzzzzz reply as early as possible.......
>> 
>> Thanks.
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/HOw-to-send-form-parameters-to-dao-in-struts2-with-hiber
>> nate--tp15730459p15730459.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
> 
> 
> 
> 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@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HOw-to-send-form-parameters-to-dao-in-struts2-with-hibernate--tp15730459p15797569.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: HOw to send form parameters to dao in struts2 with hibernate?

Posted by RajiR <ra...@yahoo.com>.
Hi,
Here is my another problem!! 
I have a register page called "userRegister.jsp" and its success page
"registersuccess.jsp".Also,the users who have registered should login from
page "userlogin.jsp" and its success page is "loginsuccess.jsp".After
logging in, user is given a privilege to update his/her profile by means of
a hyperlink.After clicking on this link he/she should be forwarded to
userRegister.jsp along with previously registered values.Here my problem is:
After clicking on hyper link am forwarding to corresponding page but with
validations as userId and password as required,as all the field values in
the page has become null and it is forwarding to that page i.e.,
userRegister.jsp(as input result is declared in struts.xml) even before
calling my action method.

why this happens?Any help...........?

Thanks..

RajiR wrote:
> 
> Hi,
> 
> I have a field in my jsp page to enter emailaddress. Inorder to validate
> it i have used the<field-validator type="email"> but its not
> validating.Its only validating for strings(type=requiredstring) and if
> type="required"  and page is submitting .What may b the reason?
>             Also,If I have inserted details into the database with a
> particular primary key value.I should not again insert the same id and
> shud throw a custom validation msg that "UserId already registered".How to
> throw custom validations in struts2?
> 
> Thanks.
> 
> 
> Randy Burgess-3 wrote:
>> 
>> If you have your service and DAO defined in a Spring application context
>> you
>> would normally have the DAO as a property of your service or you would
>> have
>> a constructor-ref for it. Spring has to be bootstrapped somehow so use
>> either the spring plugin and define your action as a spring bean and
>> reference the service bean as a property of your action or you need to
>> instantiate Spring using ClassPathXmlApplicationContext or one of the
>> other
>> Spring context objects.
>> 
>> Regards,
>> Randy Burgess
>> Sr. Web Applications Developer
>> Nuvox Communications
>> 
>> 
>> 
>>> From: RajiR <ra...@yahoo.com>
>>> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
>>> Date: Wed, 27 Feb 2008 22:23:26 -0800 (PST)
>>> To: <us...@struts.apache.org>
>>> Subject: HOw to send form parameters to dao in struts2 with hibernate?
>>> 
>>> 
>>>  Hi,
>>> 
>>> By implementing Preparable,ModelDriven,ServletRequestAware interfaces,am
>>> able to get the form details and sent those details to service
>>> implementation layer from an action class.From service implementation i
>>> have
>>> called dao.Since DAO is not injected any where in struts.xml,its
>>> throwing
>>> nullpointerexception.I have used only hibernate.Is it required to use
>>> springs inorder to inject dao?Or,can I inject using hibernate and
>>> struts2
>>> alone??
>>> 
>>> And what is the use of interceptor concept?Does it help to do dao
>>> injection
>>> without using spring?If so,how to use it?
>>> 
>>> Plzzzzzzz reply as early as possible.......
>>> 
>>> Thanks.
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/HOw-to-send-form-parameters-to-dao-in-struts2-with-hiber
>>> nate--tp15730459p15730459.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>> 
>> 
>> 
>> 
>> 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@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/HOw-to-send-form-parameters-to-dao-in-struts2-with-hibernate--tp15730459p15798465.html
Sent from the Struts - User mailing list archive at Nabble.com.


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