This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSP and the fly likes how to send data from JSP based on a condition to Controller Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "how to send data from JSP based on a condition to Controller" Watch "how to send data from JSP based on a condition to Controller" New topic
Author

how to send data from JSP based on a condition to Controller

Manu ravi
Greenhorn

Joined: Aug 15, 2012
Posts: 16
Hi,
When a user enters data in a table, I want to send unique data to controller.
I have used javascript to get the values of each row in table. I have compared each row with every other row to ensure that there are no duplicates. Using the data is being sent to controller. However this sends all the data to the controller.
My question is how do I send only the valid data that I find through javascript to the controller? I am using spring framework.
Jack Numen
Greenhorn

Joined: Nov 09, 2011
Posts: 27

Seprate the Unique data you wanna send in other form.


Call the required submission function in Javascipt


Code might not be exaclty like this but the idea is submitting only required values based on some check parameter..Ita can be a checkbox or some condition which you can frame in your Javascript
Manu ravi
Greenhorn

Joined: Aug 15, 2012
Posts: 16
My problem is that I got what you are saying but I doubt the architecture of the application would let me do that...
I have a table in jsp that goes like:


I am using javascript to get each row in the table. I am displaying existing rows in table and allowing user to add new rows. When I add new rows, onsubmit it calls javascript function:

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

What the JSP does is irrelevant. That happens on the server long before the JavaScript runs. It's what gets sent as the response to the browser that matters.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Manu ravi
Greenhorn

Joined: Aug 15, 2012
Posts: 16
so is there no way where i can stop the original data from getting passed to controller?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Have you not read the replies?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to send data from JSP based on a condition to Controller
 
Similar Threads
counting rows in javascript
Addressing dynamic table elements
How to detect form element change
counting rows in javascript
Getting Content of Table Cells into an Array