JSP-helloWorld

JSP---HelloWorld! 第一个JSP—HelloWorld!每一次的"初恋"都带着神秘感,揭开JSP神秘的面纱! JSP也是j2ee的一个规范。 JSP(java service Page),是由sun公司倡导、许多公司参与一起建立的动态网页技术标准。 JSP与html的区别是在网页中嵌入java代码和JSP标记,形成.jsp的文件。 JSP开发的web应用是跨平台的,既能在Linux下运行,也能在其他操作系统上运行。 刚学过了Servlet,后学的JSP,据说是因为我们使用Servlet,在返回页面给客户端时太多 阅读详情

代码:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>/**关键改此处的 pageEncoding 为 utf-8 ,不然会导致中文乱码*/
    <%--这里面的注释在浏览器端不可见 --%>
    <!-- 导入相应的包(这里面的注释在浏览器端不可见) -->
    <%@page language="java" import="java.text.SimpleDateFormat"%>
    <%@ page import="java.util.Date"%>
<!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=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
   alert("yibin");
</script>
<style type="text/css">
  #time{
     color:#ff0;
     width:120px;
     height:60px;
     background:#0ff;
  }
  #fun{
     color:#0f0;
     width:120px;
     height:60px;
     background:#00f;
  }
</style>
</head>

<body>
    <!-- jsp = html + java组合,以.jsp后缀结束 -->
    <%  
       //java code
       String text = "welcome yibin to eclipse!易斌";
       out.print(text);
       out.print("<hr/>");
       SimpleDateFormat formatT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       Date date = new Date(System.currentTimeMillis());
       String formatTime = formatT.format(date);
       out.print(formatTime);
       
    %>
    <%!  //function
        public int add(int a,int b){
    	   int res = a + b;
    	   return res;
        }
        public boolean isLeapYear(int y){/**判断闰年 */
        	if((y%4==0&&y%100!=0)||y%400==0){
        		return true;
        	}else{
        		return false;
        	}
        }
    %>
    <div id="time"><%= formatTime %></div> <!--调用函数-->
    <div id="fun"><%= add(1,2) %></div>
    <%
       int count = 0,s = 1994, d = 2017;
       for(int y=s;y<=d;y++){
    	   if(isLeapYear(y)){
    		   count++;
    	   }
       }
       String str = "从"+s+"年到"+d+"年,共有"+count+"个闰年";
       out.print(str);
    %>
</body>
</html>

执行结果:












我的第一个JSP之helloworld 我的第一个JSP之helloworld! 输出helloworld的四中方式。 有详细的图片! 立即下载

相关推荐

hello world.jsp

hello world.jsp document for temperatory storage and personal use only.bla bla

javaWeb之jsp(一)输出hello world

out.println()的使用 此处定义的str为jsp局部变量 &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//E...

亮君然的博客 1万+

JSP入门之HelloWorld程序实例

主要介绍了JSP入门之HelloWorld程序,结合实例形式分析了jsp入门程序HelloWorld的原理与运行过程,需要的朋友可以参考下

第一课--jsp文件创建与运行--hello world

这学期开始学习JSP&Servlet,昨天上了第一节课,教我们在myeclipse中创建jsp文件以及运行第一个jsp文件--helloworld.jsp,以下为学习总结,经供参考: 首先打开MyEclipse 2019 首先new一个web project,创建好名字,例如:helloworld 在设置好工程名字后记得点击next,到以下界面: 如果想在创建好的工程中找到we...

Jzandth的博客 5253

【软件介绍】RVC本地部署使用方法

【摘要】RVC是一款功能强大的开源语音转换工具,具有实时处理、多音效选择、高质量音频处理等特点。文章详细介绍了RVC的安装与使用方法:1)配置Python环境;2)根据电脑系统选择对应安装包解压;3)启动程序进入浏览器操作界面。重点讲解了声音克隆的关键步骤:建议使用短音频素材,选择合适训练方法(推荐pm或rmvpe),设置100次训练轮数,生成的模型文件存入weights文件夹。最后通过上传音频即可实现声音克隆。操作过程需注意保持程序运行状态,并提供了相关资源下载地址。

心动的那一刻,记忆便盛开了花 2977

msfvenom制作windows/linux/android/ios木马

msfvenom选项如下 -p, --payload<payload> 指定 payload(攻击荷载)。如果使用自定义payload,请使用'-'或者stdin指定。 -l, --list [module_typel列出指定模块的所有可用资源。模块类型包括:payloads, encoders, nops, all -n, --nopsled <length>为payload预先指定一个NOP滑动长度。 -f, --format <format>指定输出格式(使

Cwillchris的博客 2732

第一个JSP网页,输出hello world

%%>就是嵌套着java的代码,如果不使用<%%>就会报错,需要导入jsp的api(如果不导入jsp.api就会报错),类似于servlet的启动<%%>外的是属于h5代码。编写输出第一个Jsp页面,过于简单,由于jsp是属于Java Server Pages,仍然是需要用到Tomcat。

weixin_73603602的博客 1625

boost::circular_buffer缓行缓冲区

1、circular_buffer实现了一个环形缓冲区,空间大小是固定的,当到达容器末尾时,将自动利用容器另一端的位置空间。 2、当程序需要容纳大量的元素,但多数情况下仅保存较少数量元素时可以使用circular_buffer_space_optimized,他可以有效的减少内存的占用,提高程序的运行效率。 3、主要接口: 4、实现一个生产者---消费者模式示例: #inc...

小米的修行之路 791

【JSP初学】JSP 的编写和运行/包含指令

jsp

qq_56494741的博客 2619

Freeswitch DTMF 按键无法接收问题修复

freeswitch 在接收到 update后,会更新成新的 payload type,但是给的200响应,仍然是旧的,这时候就会导致手机侧认识需要发送旧的payload,所以发到 fs 后就会导致直接丢包,不去处理RTP包了。呼叫时需要设置通道变量 rtp_manual_rtp_bugs=ACCEPT_ANY_PAYLOAD ,这时候FS 就不会对包的payload进行判断,直接判定通过。应该修复 freeswitch 给响应时,应该根据收到的 payload 发送给手机,但是一直未找到正确的路径。

2301_81507069的博客 373

《UDS协议从入门到精通》系列——图解0x34:请求下载

上传下载类服务之0x34-请求下载,图解请求+响应格式,直观易懂,快速上手!!

车载系统攻城狮 4927

JSP_HelloWorld

概念: JSP- - -Java Server Page 本身就是一个Servlet 直接在HTML中内嵌JSP代码 第一个JSP程序 HelloWorld文件(在C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\test下【test为项目名称】) <html> <head> <title>Hello World<

星星点灯 762

【AI】获取各类AI大模型api-key的快速教程(OpenAI、Gemini、Claude、DeepSeek)

【AI】获取各类AI大模型api-key的快速教程(OpenAI、Gemini、Claude、DeepSeek)

funfan的博客 2946

JSP输出HelloWorld和Servlet输出HelloWorld

一.新建Web工程 (1)更新插件以获取Dynamic Web Project:Eclispe→Help→Install New Software→下拉选择后等一会 就会出现需要更新的东西如下图 下拉选择Web,XML,Java EE and OSGI Enterprise Development,再选中其中的 然后按next进行下载。之后重启eclipse就会出现web工程。...

Emon的博客 1万+

抖音小程序:解决获取手机号报错 getPhoneNumber:fail auth deny,登录注册时需要获取用户手机号,getPhoneNumber一直提示错误(Uniapp抖音小程序报错也能解决)

抖音字节小程序获取手机号报错getPhoneNumber:fail auth deny,抖音 小程序 获取手机号 报错 getPhoneNumber:fail auth ,抖音小程序获取手机号始终返回拒绝,抖音小程序获取手机号,已经过了试运营期但依旧报错如何解决,调用 tt.getPhoneNumber 接口报错,登录注册时需要获取用户手机号,getPhoneNumber一直提示getPhoneNumber:fail auth deny,此能力仅支持小程序通过试运营期后可用,默认获取权限,无需申请;unia

✅ 精选推荐文章 4304

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

JSP 说helloworld

这是我学习JSp的helloworld 由于初学就不说原理了,直接来上代码! 1整体架构如下: 2 user.java代码 package com.syw; public class User { private String username; public String getUsername() { return username; } public vo

SelfImprovement 1575

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

在eclipse当中如何做一个jsp的helloWorld?

1.jsp的helloWorld:做jsp的实验步骤非常简单。在eclipse当中,右键点击代表你WebModule的根目录的WebContent。new/jsp 即可。例 1.1<%@ page contentType="text/html; charset=GBK"%><html><%!private int accessCount = 0;%><%!...

mark_to_win的专栏 790

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

创建一个视图JSP文件的helloWorld.jsp

让我们创建下面的JSP文件的helloWorld.jsp,在WebContent文件夹在你的eclipse项目。要做到这一点,右键单击WebContent文件夹中的项目资源管理器,然后选择“新建”>“JSP文件。该文件将被要求的情况下,返回的结果是success,这是一个字符串常量“成功”的定义在Action接口: <%@ page contentType="text/ht...

dengjuanshou7445的博客 314

从HelloWorld.jsp理解JSP技术的运行内幕

众所周知,JSP和Servlet之间有着内在的血缘关系。1.HelloWorld.jsp代码:         String message = "Hello World!";    %>    这个文件非常简单,仅仅定义了一个String的变量,并且输出。把这个文件放到Tomcat的webapps/ROOT/目录下,启动Tomcat,在浏览器中访问http://localhost:808

2264

老紫竹Java EE培训教程(2) - 认识JSP的HelloWorld

原文地址:http://www.java2000.net/p12520我们先看第一个HellWorld程序,别看代码多,我只是顺便介绍一下几种输出HelloWorld!的方式而已。源代码如下"UTF-8"%>  /**   *  老紫竹JavaEE培训教程(2)-认识JSP的HelloWorld   */%> // 这是单行注释%>Hello World!"Hello World!"%> 

老紫竹的专栏 3488

JSP+Extjs4.2--第一个应用HelloWorld

之前一直听说Extjs很强大,最近有点空就果断学习一下~ 由于我主攻的是J2EE领域,所以这里就用jsp+Extjs来演示自己对Extjs的学习过程,按照惯例,第一个应用就来个HelloWorld吧。   第一步:下载Extjs   ExtJS 目前的最新版本是 4.2,我们可以从官方网站下载最新版本的Extjs。 下载地址:http://cdn.sencha.com/ext/gp...

545

Jsp HelloWorld的小程序

[code="jsp"] [/code]

张玉龙 94

JAVA-一个简单的JSP程序(HelloWorld)

  相关资料: 《21天学通Java Web开发》   实例代码: 1.在虚拟目录下新建一个“HeoolWorld.jsp”文件。2.“HeoolWorld.jsp”文件内容如下: 1 &lt;html&gt; 2 &lt;head&gt; 3 &lt;title&gt;第一个JSP程序&lt;/title&gt; 4 &lt;/head&gt...

weixin_33807284的博客 871
上一篇: Jsp 基本入门
下一篇: JSP 文件中文乱码的类型分析及解决方案
yibin94
博客等级 码龄11年 78粉丝 158原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值