首页 > 编程知识 正文

jsp文件写标题的代码,创建jsp文件,开头报错

时间:2023-12-27 22:26:42 阅读:324794 作者:KDRQ

本文目录一览:

求jsp代码,题目如下:

rect.jsp

%@ page language="java" pageEncoding="utf-8"%

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

/head

body

form action="com.jsp" method="post"

请输入正方形的边长: input type="text" name="length" width="100px"

br/ br/

input type="submit" value="submit"

/form

/body

/html

com.jsp

%@ page language="java" pageEncoding="utf-8"%

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

/head

body

%

String length=request.getParameter("length");

float s=0;

try{

s=Float.parseFloat(length);

}

catch (Exception e)

{

out.print("请输入有效数值brbr");

s=0;

}

%

正方形周长为: %=4*s %br/

正方形面积为: %=s*s %br/

/body

/html

怎么在jsp中输入页面标题

%@page contentType="text/html" pageEncoding="UTF-8"%

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

""

html

head

meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

titleJSP Page/title

/head

body

h1Hello World!/h1

/body

/html

把titleJSP Page/title中“JSP Page”换成你的页面标题,即可。。。

编写用户注册于登录的JSP页面的全部程序代码

3个jsp文件,第一个是login.jsp,第二个是judge.jsp,第三个是afterLogin.jsp

%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%

%@ page import="java.util.*" %

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title登录页面/title

/head

body

form name="loginForm" method="post" action="judgeUser.jsp"

table

tr

td用户名:input type="text" name="userName" id="userName"/td

/tr

tr

td密码:input type="password" name="password" id="password"/td

/tr

tr

tdinput type="submit" value="登录" style="background-color:pink" input type="reset" value="重置" style="background-color:red"/td

/tr

/table

/form

/body

/html

%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%

%@ page import="java.util.*" %

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title身份验证/title

/head

body

%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

String password = request.getParameter("password");

if(name.equals("abc") password.equals("123")) {

%

jsp:forward page="afterLogin.jsp"

jsp:param name="userName" value="%=name%"/

/jsp:forward

%

}

else {

%

jsp:forward page="login.jsp"/

%

}

%

/body

/html

%@ page language="java" contentType="text/html; charset=GB18030"

pageEncoding="GB18030"%

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title登录成功/title

/head

body

%

request.setCharacterEncoding("GB18030");

String name = request.getParameter("userName");

out.println("欢迎你:" + name);

%

/body

/html

JSP 的首页头部 标题 关键词 网页描述应该怎么写代码啊

在head 标签里添加以下标签

1.这里写关键词,多个关键词可以用逗号分开

meta http-equiv="keywords" content="keyword1,keyword2,keyword3"

2.这里写描述

meta http-equiv="description" content="This is my page"

jsp中如何通过一个.js文件动态生成标题

function settitle(){

document.title = 'xxxxxx';

}

什么时候调用 根据你的逻辑来

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。