将函数返回传递到另一个jsp页面

时间:2021-01-01 13:40:29

i have an jsp code (create-dest.jsp) and i need to pass a variable (return of count() function) into create-dest-code.jsp , i am doing the below but it doesnt work can you help? In other words i need to pass the return of count() to the other jsp page...

我有一个jsp代码(create-dest.jsp),我需要将一个变量(返回count()函数)传递给create-dest-code.jsp,我正在做以下但是它不起作用你能帮忙吗?换句话说,我需要将count()的返回传递给另一个jsp页面......

>   <form name="createdest" method="post"
> action="../jsp/create-dest-code.jsp">
>             Country: <input type="text"  required  name="id8" /> <br>
>             City: <input type="text"  required  name="id9" /> <br>
>             URL Video: <input type="url"  required  name="id10" /> <br> <br>
>             <i><ins>Categorize the destination (max 2): </ins></i>  <br> <br>
>             <input type="checkbox" name="dest1" value="2" onClick="return KeepCount()" >Christmas<br>
>             <input type="checkbox" name="dest2" value="1" onClick="return KeepCount()" >Winter <br>
>             <input type="checkbox" name="dest3" value="3" onClick="return KeepCount()" >Summer <br> <br>
>             
>             <input type="submit" class="button" value="CREATE DESTINATION" onClick="document.createdest.varname.value = Count();"> 
> /> 
>            <input type="hidden" name="varname" value="" />
>             </form>
>              
>             
>             <br>
>             
>             
>             
>            
>         </form>
>            <SCRIPT LANGUAGE="javascript">
>     
>     function KeepCount() {
>     
>     var NewCount = 0;
>     
>     if (document.createdest.dest1.checked)
>     {NewCount = NewCount + 1;}
>     
>     if (document.createdest.dest2.checked)
>     {NewCount = NewCount + 1;}
>     
>     if (document.createdest.dest3.checked)
>     {NewCount = NewCount + 1;}
>     
>     if (NewCount == 3)
>     {
>     alert('Pick Just Two Please');
>     document.createdest; return false;
>     }
>     
>         
>     }
>      
>     function Count() {
>     
>     var NewCount = 0;
>     
>     if (document.createdest.dest1.checked)
>     {NewCount = NewCount + 1;}
>     
>     if (document.createdest.dest2.checked)
>     {NewCount = NewCount + 1;}
>     
>     if (document.createdest.dest3.checked)
>     {NewCount = NewCount + 1;}
>     
>     }
>     if (NewCount==2) {
>         return "two";
>     }
>     
>     
>     
>      
>        
>         
>         </SCRIPT>

create-dest-code.jsp

String value=request.getParameter("varname");
out.println(value);

1 个解决方案

#1


0  

finally i found the solution in other topic!! check above comment for link!

最后我在其他话题中找到了解决方案!!检查上面的评论链接!

#1


0  

finally i found the solution in other topic!! check above comment for link!

最后我在其他话题中找到了解决方案!!检查上面的评论链接!