0

Hello ,
I really need your help!
i created a textbox in a jsp page , but i want its value to change using another JSP page without using a submit button in the second page , i need it automatically if a certain condition applies..
Pleaaaase can anyone tell me
Thanks...

4
Contributors
5
Replies
7
Views
7 Years
Discussion Span
Last Post by Ghada Ibrahim
0

Hello ,
I really need your help!
i created a textbox in a jsp page , but i want its value to change using another JSP page without using a submit button in the second page , i need it automatically if a certain condition applies..
Pleaaaase can anyone tell me
Thanks...

Unfortunately, you will require a submit button to send the value to a jsp page.

Do you have any code that might be helpful to understanding your problem better??

0

Unfortunately, you will require a submit button to send the value to a jsp page.

No, you don't.
You could have some javascript submitting the form without the need to press a button, say on exiting the input control.

0

Thank you ..
lets say this page is called A.jsp
my code sends values to a jsp page :

<form onsubmit="return validateSelect()"action="Select.jsp" method="get">
<h2>Select:</h2>
<h3>Enter the URL of the publisher you perfer to publish your ads on: </h3> <br/>
<input type="text" name="SUrl" style="width: 250px;" />
<input TYPE="submit" value="Submit"/>
<input type="hidden" id ="v" name="is"/>
</form>

At the select.jsp page its is supposed to check certain conditions and one of them changes the value of the attribute V that is passed initially null then when doen redircts to A.jsp again with the Value of V changed and depending on the value of V a java script is to show a form in the A.jsp page..
Hope you got the idea
Cause I didn’t know how to change the value of V and resend it to the first page without any button it’s supposed to be done automatically when the select.jsp page is redirected to A.jsp
Thanks again

0

When A.jsp first loads the V is null. So you can do this:

<%
String V = request.getParamater("V");
if (V==null) {
%>

<form onsubmit="return validateSelect()"action="Select.jsp" method="get">
<h2>Select:</h2>
<h3>Enter the URL of the publisher you perfer to publish your ads on: </h3> <br/>
<input type="text" name="SUrl" style="width: 250px;" />
<input TYPE="submit" value="Submit"/>
<input type="hidden" name="V"/>
</form>

<%
} else {
.....
}
%>

There is method called: request.forward ,
if I remember; check it out. To send the V value through a url at the second page use:

String V = request.getParamater("V");
String url = "A.jsp";
if (V!=null) url = url + "?V="+V;

Also it is better not to have multiple forms in a jsp and if statements to determine which to display. Have different jsps, and at the second page, depending on the value of V decide which one to load.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.