<%@page contentType="text/html" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%><html>
<head>
<title>Div 演示</title>
<sx:head />
</head>
<body>
<sx:div cssStyle="border:1px solid black;height:25px;width:500px"
href="ServerTime" updateFreq="1000" highlightColor="#ffcdee">
服务器当前时刻
</sx:div>
</body>
</html>
<package name="default" extends="struts-default">
<action name="ServerTime" class="com.struts2.ServerTime">
<result>servertime.jsp</result>
</action>
servertime.jsp 是返回的数据,内容是:${currentTime}
${requestScope.currentTime}
ServerTime action 就做了一个传值ublic class ServerTime extends ActionSupport {
private String currentTime; public String getCurrentTime() {
return new Date().toString();
} public void setCurrentTime(String currentTime) {
this.currentTime = currentTime;
}}
-------------
计划在 div 中显示 时间字符串。但实际显示的却是 ${currentTime} ${requestScope.currentTime}
这是怎么回事?
解决方案 »
- 怎么解决JSP页面存储查询mysql数据库的中文字段信息都是乱码
- 关于在tomcat上配置一个简单的ServerSocket程序启动错误的问题。
- CAS单点登录能不能去掉证书验证啊
- 怎么样用http把图片上传到服务器的指定目录
- 100分 分页求解
- 怎样在浏览器中打开POWERPOINT(.ppt)文件
- 在上传时要将form表单设置为二进制的这样就得不到其他数据了怎么处理这个
- Tomcat5配置,当用到java bean类,那类放在哪个目录下呢??
- 有没有人试过配置iis6.0(win2003)+resin-ee-3.0.2+jdk-1.4.1
- jsp tag的问题
- 百度、google搜索条
- jsp网站与搜索引擎之间的问题
private Date now;
public Date getNow() {
return now;
} public void setNow(Date now) {
this.now = now;
} public String execute() throws Exception{
now = new Date();
return SUCCESS;
}
}
<%@ page language="java" pageEncoding="gb2312" isELIgnored="false"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
服务器当前时间为:<font color="red"><s:date name="now" format="yyyy-MM-dd HH:mm:ss"/></font>
<br>
服务器当前时间为:<font color="red">${currentTime}</font>
</body>
</html>package com.struts2;import com.opensymphony.xwork2.ActionSupport;
import java.util.Date;public class ServerTime extends ActionSupport {
private String currentTime;
private Date now;
public Date getNow() {
//return now;
return now = new Date();
} public void setNow(Date now) {
this.now = now;
} public String getCurrentTime() {
//return currentTime;
return currentTime = new Date().toString();
} public void setCurrentTime(String currentTime) {
this.currentTime = currentTime;
}/* public String execute() throws Exception { //没这个也没关系。
currentTime = new Date().toString();
now = new Date();
return this.SUCCESS;
}*/
}