JSP中怎样.........

rocsnake 2003-04-05 02:56:41
JSP中怎样使用XML,让JSP自动生成客户端脚本,应用XSL显示样式显示,但是服务端没有XML物理文件
...全文
39 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
icecloud 2003-04-06
  • 打赏
  • 举报
回复
其实生成xml最重要的是用<%@ page contentType="text/xml; charset=UTF-8" %>
设定文档类型

然后剩下的就是你用rs去循环生成tag的过程了
rocsnake 2003-04-05
  • 打赏
  • 举报
回复
xsl中怎样使用JAVASCRIPT
xsl中怎样应用外部JAVASCRIPT,如common.js
zxhong 2003-04-05
  • 打赏
  • 举报
回复
e.g.
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
</head>
<body>
<%
if(request.getParameter("testc")!=null){
try{
javax.servlet.ServletInputStream in = request.getInputStream();
int c = in.read();
byte []b=new byte[1000];
int len = 0;
while(c!=-1){
b[len] = (byte)c;
len++;
c = in.read();
}
String str = new String(b,0,len);
str=new String(str.getBytes("GBK"),"UTF-8");
out.println(str);
}catch(Exception e){
out.println(e.getMessage());
}
}
%>

<div id="divDisplay">The response will be put in here</div>
<input type="button" onclick="sendData();" value="Send it!">
<script>
function sendData(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST", "t.jsp?testc=23;34;", false);
xmlhttp.Send("中文");
alert(xmlhttp.responseText);
}
</script>
</body>
</html>
9441 2003-04-05
  • 打赏
  • 举报
回复
JSP这样写
<%@ page contentType="text/xml" %>
<?xml version="1.0"?>
<SOAP:Envelope xmlns:SOAP="urn:schemas-xmlsoap-org:soap.v1">
<SOAP:Header></SOAP:Header>
<SOAP:Body>
<m:GetTime xmlns:m="urn:myserver/soap:gettime">
<time><%=new java.util.Date()%>,<%=request.getReader()%></time>
</m:GetTime>
</SOAP:Body>
</SOAP:Envelope>

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧