aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
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
Ranch Hand

Joined: Nov 09, 2011
Posts: 42

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: 61010
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 61010
    
  65

Have you not read the replies?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to send data from JSP based on a condition to Controller