Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Where to write Validation

 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to web Application development. In jsp page am entering name PRAKASH ,
but the name already exists in database means where i have to write validations for this criteria.
 
Ranch Hand
Posts: 151
MyEclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
write in the DAO that is responsible for database communication...can write in the same jsp page to .. its up to your application architecture
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to write in the same jsp page.
 
akhter wahab
Ranch Hand
Posts: 151
MyEclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
again on your bussiness logic....... send the name parameter to the database get the value of the in the jsp page as boolean if it exists then get true ..if get true than show that it is already exists
 
Marshal
Posts: 73953
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to a more appropriate forum.
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand the logic which you said. I am new to development.
Can you say from which file you send request to database ( )
and which file you retrieve data
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
suppose am using jsp,servlet , struts , hibernate. From which file i send request to DB.
In which file i request data from DB
 
akhter wahab
Ranch Hand
Posts: 151
MyEclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well in more appropriate way jsp use only for geting info and receive perameter in the servlets and a simple java class is used for database connectivity and methods make the object of java class in servlet and send response back to jsp page
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rajendra Prakash wrote:suppose am using jsp,servlet , struts , hibernate. From which file i send request to DB.
In which file i request data from DB


A service class inside the action or the action form--it kind of depends.
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
previously i used following code to validate username and password.
But now i am using struts , how can i get username and pwd instead of reques.getParameter()
I know there is getUsername() and getPassword() in ActionForm.
My question is , i need single line how to assign getUsername() and getPassword() to string variable.



 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


there is a redundant casting. I think it is not a struts application,you have to get username in service method only like above.

I do the form(user fields) validation using methods in servlet. and business validation in DAO
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its not struts ok. Give me that single line, how to get username and pwd in service method
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rajendra Prakash wrote:Its not struts ok. Give me that single line, how to get username and pwd in service method


what do you mean by single line?
this is the way :
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to do the same in struts.If you use struts means there will be ActionForm(getUsername () , getPwd() )
which eliminates request.getParameter() method.


From the above code what is " x ".
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the x --> scope of the actionform in struts. if you want struts then switch to struts framework
 
What? What, what, what? What what tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic