| Author |
sending a Collection from JSP to Servlet
|
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Can i send this to a servlet ??
|
Save India From Corruption - Anna Hazare.
|
 |
jack wenttohill
Greenhorn
Joined: Apr 26, 2009
Posts: 9
|
|
Then in servlet use
And please study the scope of jsp/servlet you will better understand more.
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
This is not possible . Is this possible with getParameter()??
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Can i send this to a servlet ??
yes you can , but shouldn't. What you achieve by calling servlet from JSP. ( it should be other way around)
|
 |
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
|
posted

0
|
|
What do you mean by "send"? A JSP generates HTML which is then sent to the browser. Where does a servlet enter the picture?
|
Android apps – ImageJ plugins – Java web charts
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
sorry for the confusion , i thought tha question is clear :
The question is :
JSP is submitting form data :
<form method="post" action="/MySevlet">
<input type=hidden name="name" value="al"/>
</form>
|
 |
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
|
posted

0
|
|
Now it's clear. You can't use Java objects in HTML forms; you'll need to add all list items individually as hidden form fields.
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Thank you ulf ,
I just wanted to try but this is not even compiling "
Then how to send a java array to servlet from jsp ?
|
 |
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
|
posted

0
|
By doing what I suggested before.
Check the javadocs of HttpServletRequest for the reason why you're getting a compiler error.
|
 |
Mohamed Inayath
Ranch Hand
Joined: Nov 22, 2004
Posts: 124
|
|
Yes it will give compilation error.
To be precise a Class Cast Exception.
getParameter() api returns String and you are trying to cast with ArrayList.
Regarding to the question, one cannot pass the Array object as part of input as it will take only Strings
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Thank you ulf and Mohamed for the explanations .
Please tell me
How can i send this Array to a Servlet .
|
 |
Eshwar Prasad
Ranch Hand
Joined: Mar 21, 2008
Posts: 191
|
|
|
You can comma separate array and send it to servlet using AJAX..
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
|
Other than that is there any other way ?
|
 |
 |
|
|
subject: sending a Collection from JSP to Servlet
|
|
|