都说JAVA的优势在web方面,但我学JAVA一年来不知道java在网络方面有什么用处
鄙人不才,只会写些简单俄罗斯方块/扫雷一些小游戏,简单图形界面,如教学管理系统之类的,脑子笨拙,是在参不透。还望有缘人指点,能给我上个实例代码就万分感激,交定这个朋友了,谢谢来帖的各位朋友
鄙人不才,只会写些简单俄罗斯方块/扫雷一些小游戏,简单图形界面,如教学管理系统之类的,脑子笨拙,是在参不透。还望有缘人指点,能给我上个实例代码就万分感激,交定这个朋友了,谢谢来帖的各位朋友
解决方案 »
- ServletActionContext.getRequest().getRealPath(savaPath);现在已经不能用了。用什么替换
- 个人用户如何申请服务器和域名
- 数据插入的问题
- 数据库连接问题,高手帮忙看下,谢谢
- telnet 开源项目 jta 看的郁闷,有谁用过?
- 遇到一个奇怪的ORACLE问题
- 请问怎么样在TOMCAT运行窗口把具体报错的行数显示出来啊?急啊
- 【求教高手】公认比较好的三层架构的网站框架是什么样的?还有关于struts...
- 在UNIX下不同用户之间的文件访问!!
- EJB 问题 + apusic2.0{lookup}
- 将日期转换成字符串再转换回来结果不一致 Date date 与 new Date(date.toString()) 不一致。。为什么
- 请问如何解决oracle blob字段 的乱码问题?
(备注2:现在脑子里困惑,java如何实现网站后台,java在写网站时能写些什么,如何写之类的,因为本人最近要为公司写几个网站,还望高人指教)
去百度一下JSP STRUTS SERVLET 这几个关键字
没什么难度的!
循序渐进学习,并且结合项目
在实际中总结,在学习中实践
import java.io.PrintWriter;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;public class ss extends HttpServlet { /**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the GET method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
} /**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the POST method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}}
祝你成功!!!
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'succ.jsp' starting page</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 rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<h1>成功</h1>
<a href="show.do?pageCode=1&pageSize=5">浏览</a>
</body>
</html>
servlet用来做控制层,调用class来处理数据。
class来操作数据库
等