passing value fron script to scriplet

Ads

 
 

Share on Google+Share on Google+

selvan
passing value fron script to scriplet
2 Answer(s)      8 years ago
Posted in : JSP-Servlet
Ads
View Answers

November 10, 2008 at 6:37 AM


Hi friend,


if you want to pass something from the client (javaScript) to the server (java), you have to submit a form, or use a the name/value query string.

your first should look something like:

<form action="loginPage.jsp">
Enter you value here: <input type="text" name="_value" value="">
Then click the button to Check <input type="Submit" value="Click Me">
</form>

you use that to transfer (or pass if you want) the string value of the _value variable to the loginPage.jsp page on the server.

The loginPage,jsp should something like this:
<%
String value = request.getParameter( "_value" ); // get the parameter passed from the client

WebValidiator webValidiator = new WebValidiator(); // create a validator object

// do validation
if( webValidiator.validate( value ) )
{
response.writeln( value + " is a valid value" );
}
else
{
response.writeln( value + " is not a valid value" );
}
%>

---------------------------------

Thanks.


November 10, 2008 at 6:39 AM


Hi friend,


if you want to pass something from the client (javaScript) to the server (java), you have to submit a form, or use a the name/value query string.

your first should look something like:

<form action="loginPage.jsp">
Enter you value here: <input type="text" name="_value" value="">
Then click the button to Check <input type="Submit" value="Click Me">
</form>

you use that to transfer (or pass if you want) the string value of the _value variable to the loginPage.jsp page on the server.

The loginPage,jsp should something like this:
<%
String value = request.getParameter( "_value" ); // get the parameter passed from the client

WebValidiator webValidiator = new WebValidiator(); // create a validator object

// do validation
if( webValidiator.validate( value ) )
{
response.writeln( value + " is a valid value" );
}
else
{
response.writeln( value + " is not a valid value" );
}
%>

--------------------------

Visit for more information.

http://www.roseindia.net/jsp/


Thanks.

Ads









Related Tutorials/Questions & Answers:
passing value fron script to scriplet - JSP-Servlet
passing value fron script to scriplet  how to pass value from Java script to Scriplet in jsp  Hi friend, if you want to pass something..., or use a the name/value query string. your first should look something like
passing value of radio button
passing value of radio button  hi,i have 3 jframe built using the GUi editor in net beans 6.9. i have two radio button in the first jframe.i have to get the selected item appear on the 3rd frame after passing through the second
Advertisements
passing value from javascript popup
passing value from javascript popup  How to take user input and pass that input value using popup in Javascript
Passing value in hyperlink - JSP-Servlet
Passing value in hyperlink  How to pass value in anchor tag or HTML......, Retrive value from database Retrive data from database User   Hi...*,java.text.*" %><html><head><title>Retrive value from
passing value from javascript to jsp - JSP-Servlet
passing value from javascript to jsp  Hi... Is there any way to get the value from the javascript and print it on the current jsp page or print an array onto the current jsp page using javascript  Hi Friend, We
How to pass javascript variable in Scriplet of JSP?
How to pass javascript variable in Scriplet of JSP?  How can I assign the value of a javascript variable to a variable declared in jsp scriplet? Is it possible
passing text value from pop up to parent page
passing text value from pop up to parent page  i want to pass value of a textbox of one pop up window to its parent page(html). that parent page contain a table. And i want to pass that text value to one cell in table of parent
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>">...);%> since url print a common.jsp?param=Arts but attr return a null value
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>">...);%> since url print a common.jsp?param=Arts but attr return a null value
java script display value - Java Beginners
java script display value  my code is below: my problem is: the value 'firstname' is not showed with getparameter in .jsp file? (when click submit button in form) Main file: Name: file java
Pass value from JSP to JavaScript
which is passing value to the java script as follows: PassJSP.jsp... script as we have done in our previous example of passing values to the java...; In our this example of passing values from jsp page to java script we have created
Using Scriplet in JSP - JSP-Servlet
Using Scriplet in JSP  Hi, I need to display suitable fields in my jsp but this should be done upon suitable condition becomes true for eg: there is an interface which contains constant values public interface ProjConstant
passing textbox value from one page to another page using html n javascript
passing textbox value from one page to another page using html n javascript  on button onclick event pass text box value and i want to pass value...;/td> </tr> <tr> <td colspan=2><input type=submit value
How to display content in same page while selecting fron dropdown list
How to display content in same page while selecting fron dropdown list  Hai frnds, I am beginner of java.i have doubt in codings.I am using dropdownlist in jsp page.If i select any value in that list(for eg-rollno
How to display content in same page while selecting fron dropdown list
How to display content in same page while selecting fron dropdown list  Thanks for your suggesstion.but Please provide me coding by using only one dropdownlist in javascript or jquery.Thanks in advance
how to fetch data fron facebbok using spring batch and hibernate ?
how to fetch data fron facebbok using spring batch and hibernate ?  how to fetch data from facebbok using spring batch and hibernate ? Means i have to get all details of data from one source like facebook using id ans save all
Passing variable
Passing variable  How to pass variable to HTTP object in HTMl or PHP
Argument Passing
Passing Argument in Java  hi this is my code class Test { void meth(int i, int j) { i *= 2; j /= 2... and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value
Passing array element
Passing array element  What about passing an element of an array? If I have array of objects and pass functionA(arr[2]); Then functionA() will get arr[2] as a value type or a reference type
Java Pass Value Example
can also pass the value from a JSP page to the java script as we have done in our previous example of passing values to the java script from the HTML page. Since... script.     Example program to pass value from Html
Example program to pass value from Html to java script
Example program to pass value from Html to java script... which will pass the value to the java script function and this value... value from HTML to JavaScript </TITLE> <script language="JavaScript
passing values on button click
passing values on button click  Please help me to solve this issue.I want to pass a value assigned to button to another view upon button click in xcode
Argument Passing
, the method takes the arguments 15 and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value of b 20 by 2 to produce the output 30 and 10
Argument Passing
, the method takes the arguments 15 and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value of b 20 by 2 to produce the output 30 and 10
Argument Passing
, the method takes the arguments 15 and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value of b 20 by 2 to produce the output 30 and 10
Argument Passing
, the method takes the arguments 15 and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value of b 20 by 2 to produce the output 30 and 10
Argument Passing
, the method takes the arguments 15 and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value of b 20 by 2 to produce the output 30 and 10
Argument Passing
, the method takes the arguments 15 and 20 as a result it multiply the value of a i.e 15 by 2 and divide the value of b 20 by 2 to produce the output 30 and 10
passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance
passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance
passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads