A. 如何在jsp環境中讓form表中添加兩個跳轉頁面
首先,一次點擊form的提交只能跳轉一個頁面,你說的跳轉兩個頁面,應該是action的返回值設定的,如果你用的是servlet,想跳轉到不同的 頁面,就需要在servlet裡面做判斷,然後dispatch出來。
或者你的意思是一個form裡面配置兩個提交按鈕,對應不同的action,就能跳轉到兩個頁面,或者點擊提交,通過js,出發函數同時調用兩個action。簡而言之,一個action只能對應一個頁面。
B. jsp中如何獲取htmlfrom中的對象
樓主說得是... jsp中的 應該設計到傳值了吧
像樓上兩位說得一點兒都不錯 用js獲取了以後 再通過ajax傳值
或者就是提交form表單
<form method="post" action="ope.jsp">
<input type="text" name="username" />
<input type="password" name="pwd" />
<input type="submit" value="提交" />
</form>
這里 點提交以後 就會跳轉到ope.jsp裡面 在ope.jsp裡面
<%
//根據前一個頁面表單里的input的name屬性來接收數據 賦值給String型的username
String username = request.getParameter("username");
//根據前一個頁面表單里的input的name屬性來接收數據 賦值給String型的pwd
String pwd = request.getParameter("pwd");
out.println("用戶名:"+username);
out.println("<br />");
out.println("密碼:"+pwd);
%>
這樣 就可以把表單的數據接收過來 在第二個頁面輸出了的
C. 請問 java如何從Jsp的<from中得到值 在傳給一個JSP呢 代碼應該怎麼填寫
不太明白你說的問題。
如果 你的過程是 由 A.jsp 跳轉到 B.jsp,且 B.jsp 要獲取 A.jsp 中 的值的話,可以直接將 A.jsp中表單 的 action 指定為B.JSP ,然後在B.JSP 中通過 頁面上下文 獲取相應的欄位就可以了。
如果 你額過程是 A.JSP 提交 到 servlet,然後 servlet 跳轉到 B.JSP的話,
首先 A.JSP 跳轉到 servlet , servlet 設置 攜帶請求參數跳轉B.JSP , B.JSP 中 就可以通過 request 對象獲取 相應欄位。
D. jsp 頁面 調用 from
你要調用<form>表單,就要在提交的時候調用loadmycard(t)涵數,比如:
<from name="form1" action="me.jsp" method="post" onsubmit="return loadmycard(t)">
</form>
群:38534363
E. JSP中的from表單里。有兩個按鈕。都是向資料庫不同的表插入數據,該怎麼實現
做兩個表單,不同的按鈕在兩個表單裡面,這是針對表單裡面都有文本的情況。
<form action="abc.jsp" method="post">
<input type="text" name="word"/>
<input type="submit" value="提交1"/>
</form>
<form action="123.jsp" method="post">
<input type="text" name="word"/>
<input type="submit" value="提交2">
</form>
F. jsp傳值到from
<form action="******.jsp" method="post">
....
<input type="hidden" name="id" value="*********">
....
</form>
G. 關於JSP中form的get和post提交方式
當用戶向伺服器發送請求時,包括兩部分:請求首部和消息體。
get()方法把參版數放在請求首部權,而post()方法把參數放在消息體。
這就導致有兩點不一樣:第一,get()方法傳遞的參數可以被任何人在地址欄中看到,而post()方法不可以被看到。第二,由於請求首部的信息容量是有限的,所以get()方法傳遞的參數是有限的,而post()方法可以向伺服器傳遞任意多個參數。
另外,當你想要把當前頁面的內容建立書簽時,使用get()方法是可以的,而是用post方法是不可以的。
H. 在一個jsp頁面上如何存在多個from表單。
可以直接創建多個form即可,形式就是「<form></form><form></form>」,此時每個form中的內容就是獨立提交的部分。
舉例:
<form id='modify1' name="modify1" method="post" enctype="multipart/form-data" action="${ctx}/report/rate_exchange.jsp" >
<table class="table_common" id="table1" cellspacing="1" cellpadding="0">
<tr class='title_tr' >
<td style="white-space: nowrap; text-align: center;" colspan="4">
<input type="file" name="fileName" id="filePath">
<input type="button" style="white-space: nowrap; text-align: center;" class="List_Button2" value="<BOC:I18N name="submit"/>" onclick="submitForm1()" />
<input type="reset" style="white-space: nowrap; text-align: center;" class="List_Button2" value="<BOC:I18N name="reset"/>" onclick='confirm("你確認要取消本次上傳嗎?")'/>
</td>
</tr>
</table>
</form>
<!-- end 文件上傳-->
<form>
<table>
<tr class="title_tr" >
<TH width="10%" style="white-space: nowrap; text-align: center;color: red"><%=worry %></TH>
</tr>
<tr class="title_tr" >
<TH width="10%" style="white-space: nowrap; text-align: center;color: green"><SPAN><%=right %></SPAN></TH>
</tr>
</table>
</form>
I. 在jsp里控制from
用隱藏和顯示div
<div id="form1" style="display:none">
<c:if test="${value eq '1'}" var="vname">
<script>document.getElementById("form1").style.display = "block";</script>
</c:if>
內容111
</div>
<div id="form2" style="display:none">
<c:if test="${value eq '2'}">
<script>document.getElementById("form2").style.display = "block";</script>
</c:if>
內容222
</div>
J. 怎麼在jsp中設置from提交方法
<form action="提交路徑" method="提交方式" onsubmit="return 方法名">