• Post Reply Bookmark Topic Watch Topic
  • New Topic

Function Declaration in jsp

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need some help.How can i use a function in jsp.
Example,

need to verify user entry at a submit jsp page.
without a function i can't verify the data.
If anyone can help i would be grateful.

thnx!!!
 
Logan Owen
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Java, you will have to do it in two steps...one have the action of the form go to an intermediate page, like so...



You can look that up in an HTML tutorial or resource.

Next on the page inputCheck.jsp, you would have something like this...



Then you can operate on the input, and check it as you need to. If you need simpler input checking you might try Javascript, because the request won't have to make a round trip to the server to verify the input. Hope this helps some.
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It solved a couple of my problems.

Thnx man.
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now that i tried it it doesn't really work.
how can i get the values from the fields at the new jsp page??

 
M. Gagnon
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aris Doxakis:
how can i get the values from the fields at the new jsp page??



<%
String yourVar = request.getParameter("yourFieldName");
// Do something with yourVar here
%>

or, if you want to display the values in the page:

<%= request.getParameter("yourFieldName") %>

Is that what you were asking?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!