Modern software engineering _ first week exercise _ 14th questions, first week of Software Engineering
I. Development of the HelloWorld program based on Android
The development environment and tool of this program are: AndroidStudio1.5 + Android5.1.1 mobile phones;
Development Process:
1. File → New Project
2. Enter your project name Hello_World, select the location of your project, and select "Next"
3. Select the platform used by the program you want to develop, select the SDK version as needed, and then "Next"
4. Select a default Activity mode and select "Next"
5. Name the generated Activity and select "Finish"
6. The Hello_World Android program is complete!
Running on a real machine
The main code of the Activity is:
Public class MainActivity extends AppCompatActivity {
@ Override
Protected void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. activity_main );
}
}
The main code of activity_main.xml is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
Ii. J2EE development-HelloWorld web page program
Development Environment: MyEclipse2015 + atat8.0 + 360 browser.
1. File → New → Web Project
2. Enter the project name HelloWorld and select the Java version and runtime environment, as shown in my settings. This step can also change the path of the project. Click Finish to create the project.
3. Select the Tomcat server environment and click the "Add Deployments" icon to Add the project to the server,
4. Start the Tomcat server. Open the browser and enter http: // localhost: 8080/HelloWorld/in the address to browse the project you created. The project interface is shown in the following figure:
The code for index. jsp is:
<% @ Page language = "java" import = "java. util. *" pageEncoding = "ISO-8859-1" %>
<%
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 'index. 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>
This is my JSP page. <br>
</Body>
</Html>