ASP或者PHP转换成JSP

黑夜愁客 2008-05-10 10:13:08
ASP:
<%

if request.form("loginUsername") = "f" then
response.write "{ success: true}"
else
response.write "{ success: false, errors: { reason: 'Login failed. Try again.' }}"
end if

%>

或者PHP
<?php
$loginUsername = isset($_POST["loginUsername"]) ? $_POST["loginUsername"] : "";

if($loginUsername == "f"){
echo "{success: true}";
} else {
echo "{success: false, errors: { reason: 'Login failed. Try again.' }}";
}
?>

请问如何将上面的asp(php)转成jsp.
谢谢。http://extjs.com/learn/Tutorial:Basic_Login。我想把这个demo改成jsp的。
...全文
207 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
黑夜愁客 2008-05-14
  • 打赏
  • 举报
回复
天灾难测。。。。
爱心无限。。。
黑夜愁客 2008-05-14
  • 打赏
  • 举报
回复
楼上的那样做还不是一样啊
jnt52 2008-05-11
  • 打赏
  • 举报
回复
<%@ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Login</title>
</head>
<body>
<%

String userName = request.getParameter("loginUsername");
if(userName !=null && "liceven".equals(userName)){
out.print("success: true");
}else{
out.print("success: false, errors: { reason: 'Login failed. Try again.'}");
}

%>

</body>
</html>
黑夜愁客 2008-05-11
  • 打赏
  • 举报
回复
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Login</title>
</head>
<body>
<%
if("liceven".equals(request.getParameter("loginUsername")))
{
out.print("success: true");
}
else
{
out.print("success: false, errors: { reason: 'Login failed. Try again.'}");
}
%>
</body>
</html>

it doesn't work.......
黑夜愁客 2008-05-11
  • 打赏
  • 举报
回复
还是老样子哦。。。。。。不行
黑夜愁客 2008-05-11
  • 打赏
  • 举报
回复
哦,回去试试看。
Lanee 2008-05-11
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 yexin218 的回复:]
用out.println()?
[/Quote]

恩纳,用out.println()和response.write效果是一样滴~~

然后request.form("loginUsername") 其实写成request("loginUsername") 就成
和request.gerParameter("loginUsername")效果是一样滴~

有什么问题么?
黑夜愁客 2008-05-11
  • 打赏
  • 举报
回复
M... is for the million things she gave me,


O... means only that she's growing old,


T... is for the tears she shed to save me,


H... is for her heart of purest gold;


E... is for her eyes, with love-light shining,


R... means right, and right she'll always be.


Put them all together, they spell "MOTHER,"
A word that means the world to me.
黑夜愁客 2008-05-10
  • 打赏
  • 举报
回复
可是还是没能很好解决哦。
黑夜愁客 2008-05-10
  • 打赏
  • 举报
回复
用out.println()?
zhuangwei517 2008-05-10
  • 打赏
  • 举报
回复
<%
if("f".equals(request.gerParameter("loginUsername")))
{
out.print("success: true")
}
else
{
out.print("success: false, errors: { reason: 'Login failed. Try again.'}");
}
%>
黑夜愁客 2008-05-10
  • 打赏
  • 举报
回复
说的当然是那样的了。想学ext.可是都没有很好的教程
i_saw_you 2008-05-10
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 yexin218 的回复:]
可是还是没能很好解决哦。
[/Quote] 有问题的地方发出来,盲写的代码肯定有问题
黑夜愁客 2008-05-10
  • 打赏
  • 举报
回复
extjs还真的不容易哦

81,092

社区成员

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

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