Enterprise javaweb development projects - a simple implementation of adding functionality (including code)

The realization of a project javaweb

Upon completion of java development environment to build,
first created in the eclipse compiler to a dynamic web project,
and then create a WebContent index.jsp file, we can start to build.
As shown below:
Here Insert Picture Description
Then we can start writing code javaweb simply needed; the
next are all hand knock code, there knocking on the wrong or the wrong place a lot of understanding.
The corresponding code attributes are the basics before the introduced one by one again, there is a need to read the previous blog about it;

<%@page contentType=“text/html;charset=UTF-8”>

<HTML>
<head>
<title> Zhao Lei home page </ title>
<body>

<%
request.setCharacterEncoding(“utf-8”);
String aName = request.getParameter(“name”);
request.setAttribute(“value”,aName);
%>
String iNsert = request.getParameter(“insert”);
<%

<H1> Welcome to my home page </ h1>
<img src = "Image / zhaolei.jpg" alt = "twentyOnePolits" width = "350">
<the p-> hedgehog who Hello everyone, I'm Zhao Lei, you it? </ P>
<from Method = "POST">
<%
IF (the request.getAttribute ( "value") == null) {
%>

< input type=“text” name=“name” value=" “> value=”<%=request.getAttribute(“value”)%>" >
<%
}else{
%>
< input type=“text” name=“name” value="<%= request.getAttribute(“value”)%>" >
<%
}
%>
< select name=“insert”>
< option value=“请选择” selected > 请选择 < /option>
< option value=“文艺青年” >文艺青年 < /option>
< option value=“文艺大叔”> 文艺大叔 < /option>
< option value=" 小姐姐" > 小姐姐 < /option>
< /select>
< input type=“submit” value=“提交”>
< /form>

<%
if(aName !=null && aName.trim().length() >0 {
%>
hi!
<%= aName %>
<%=iNsert%>
<%
}
%>

< /body>
< /html>

Can then be added to the server to run up TomCat
effect is as follows:

Here Insert Picture Description

Published 12 original articles · won praise 0 · Views 171

Guess you like

Origin blog.csdn.net/weixin_45722104/article/details/104371700