当前位置: 代码迷 >> Java Web开发 >> jsp form表单action传值乱码有关问题
  详细解决方案

jsp form表单action传值乱码有关问题

热度:7241   发布时间:2013-02-25 21:10:45.0
jsp form表单action传值乱码问题
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String id = request.getParameter("id");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
   
  <title>专辑详细信息</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="css/common.css" rel="stylesheet" type="text/css"/>

  </head>
  <body onload="init()">
  <div id="page" class="page_top1" style="margin:5px">
  <a href="jsp/song/manage.jsp" target="main">歌曲维护</a>
  <a href="jsp/song/albumManage.jsp">专辑维护</a>
  <a href="jsp/song/artsitManage.jsp">歌手维护</a>
  <br><br>
  <form id="form" action="" method="post">
  <table cellpadding="0" cellspacing="0">
  <tr><td align="right">专 辑 名:</td><td><input type="text" name="albumName" size="30"/></td></tr>
  <tr><td align="right">歌 手 名:</td><td><input type="text" name="art" size="30"/></td></tr>
  <tr><td align="right">发行时间:</td><td><input type="text" name="date"/></td></tr>
  <tr><td align="right">图 片:</td><td><input type="text" name="pic" size="60"/></td></tr>
  <tr><td align="right" valign="top">描 述:</td><td><textarea id="miaoshu" name="detail" rows="10" cols="60"></textarea></td></tr>
  <tr><td align="center"></td><td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="submit-button" value="提交" onclick="return go()"/></td></tr>
  </table>
  </form>
  </div>
  </body>
  
  <script type="text/javascript" src="${pageContext.request.contextPath}/jquery/jquery.js"></script>
  <script type="text/javascript">

  function init(){
$.ajax({
url:"song/songManage_getAlbumDetail",
type:"POST",
dataType: "json",
data: {"ids":<%=id%>},
success: function(msg) {
var album = eval(msg);
if(album.length>0){
for(var i=0;i<album.length;i++){
$("input[name=albumName]").attr("value",album[i].name);
$("input[name=art]").attr("value",album[i].singer);  
$("input[name=date]").attr("value",album[i].date);  
  相关解决方案