我有一个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>
创建-DEST-code.jsp
String value=request.getParameter("varname");
out.println(value);
答案 0 :(得分:0)
最后我在其他话题中找到了解决方案!!检查以上评论的链接!