iFrames

I want to get data for insertion into DB from iFrame

<!--iFrame containx the following html-->

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

<input type=text name="aa">

for getting simple values we are using

String[] aa=req.getParameterValues("aa");

but am facing the difficuilty to get values from iFrame. please solve my problem

thanks

[772 byte] By [farakha] at [2007-10-3 6:45:26]
# 1

Hi,

Using my local development environment, I put your form in an <iframe>, and after hitting submit, I had a servlet send back the info that was entered, and I was successfully able to display all the data using your code:

String[] aa=req.getParameterValues("aa");

So, there is nothing inherent in an iframe that prevents you from doing that. An <iframe> is just a browser window like any other, and it makes requests to the server--it just happens to be imbedded in another browser window.

Are you getting any compiler errors? What are they? Are you getting any servlet errors when you submit the form?

I suggest you try to get a simple app working, like I did. Create a simple html page with an iframe that displays a form in the iframe. Then, code a servlet that just displays in the iframe what was entered

7studa at 2007-7-15 1:35:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]<form action="http://localhost:5050/examples/servlet/post_register" method=post>

<span class=gull>Registration</span>

<table border=0 cellspacing=0 cellpadding=2 width=653 align=center>

<tr><td colspan=2><br><font color=blue size=2 face=verdana><b>Registrant Info</b></td></tr>

<tr><td class=khan width=158>Name</td><td><input type=text name=rname maxlength=50 class=khan></td></tr>

<tr><td class=khan>Job title</td><td><input type=text name=jtitle maxlength=50 class=khan></td></tr>

<tr><td class=khan>Gender</td><td class=khan>Male<input type=radio name=gender value="male">

Female<input type=radio name=gender value="female"></td></tr>

<tr><td><b class=khan>Date of Birth</td>

<td><select name=day class=khan>

<option>Day</option>

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

<option>5</option>

<option>6</option>

<option>7</option>

<option>8</option>

<option>9</option>

<option>10</option>

<option>11</option>

<option>12</option>

<option>13</option>

<option>14</option>

<option>15</option>

<option>16</option>

<option>17</option>

<option>18</option>

<option>19</option>

<option>20</option>

<option>21</option>

<option>22</option>

<option>23</option>

<option>24</option>

<option>25</option>

<option>26</option>

<option>27</option>

<option>28</option>

<option>29</option>

<option>30</option>

<option>31</option>

</select>

<select name=month class=khan>

<option>Month</option>

<option>January</option>

<option>Feburary</option>

<option>March</option>

<option>April</option>

<option>May</option>

<option>June</option>

<option>July</option>

<option>August</option>

<option>September</option>

<option>October</option>

<option>November</option>

<option>December</option>

</select><br>

<b class=khan> Year 19</b>

<select name=year1 class=khan>

<option>0</option>

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

<option>5</option>

<option>6</option>

<option>7</option>

<option>8</option>

<option>9</option>

</select>

<select name=year2 class=khan>

<option>0</option>

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

<option>5</option>

<option>6</option>

<option>7</option>

<option>8</option>

<option>9</option>

</select></td></tr>

<tr><td valign=top width=158><div class=khan><font color=green>Products Detail</font></div>

<font size=1>(If applicable then please insert Each Product in New cell)</font></td>

<td class=khan>

<iframe name="prodIFrame" src="http://localhost:5050/examples/servlets/prod.html" marginwidth=0 marginheight=0 width=500 height=95 frameborder=0 scrolling=yes>

</iframe></td></tr><tr>

<tr><td colspan=2 class=khan align=center><br><input type=checkbox name=terms> I accpet the agreement <a href=#><u>View</u></a><br><br></td></tr>

<tr><td colspan=2 align=center><input type=submit value=" Submit " class=khan></td></tr></table>

In this senario what u suggest cos in this way its getting none[/nobr]

farakha at 2007-7-15 1:35:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

>>I want to get data for insertion into DB from iFrame

1) Then why is the form you posted relevant? It's not displayed in the <iframe>?

2) You don't call servlets like this:

action="http://localhost:5050/examples/servlet/post_register"

For the action attribute, you use a made up name and extension, like "ParisHilton.do". Then you use servlet mapping in the web.xml file to map the made up name to your servlet, which should be located in the WEB-INF/classes directory.

What book are you studying?

7studa at 2007-7-15 1:35:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

> For the action attribute, you use a made up name and

> extension, like "ParisHilton.do". Then you use

> servlet mapping in the web.xml file to map the made

> up name to your servlet, which should be located in

> the WEB-INF/classes directory

Very honestly i am very new to servlet and trying to seek as much as I can and I learned a lot from java forums. very frankly I didn't understand that you said above due to lack of knowledge

please get me example by implementing codes

> What book are you studying?

Deitel & Deitel (but it has a small part of servlets. Can you please recomend any servlet book .

thanks

farakha at 2007-7-15 1:35:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

7stud

I also commit that am new as well but I can say that nobody can challenge that I am the one & only master

anyhow thanks for your replies

codes means to say that can u get me an example

you use a made up name and extension, like "ParisHilton.do". Then you use servlet mapping in the web.xml

TIA

farakha at 2007-7-15 1:35:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...