标签:get font eset put reset res from 姓名 ota
1.html表单
<form class="f1" action="from" method="get"> <table border="1"> <tbody> <tr> <th align="center">表头</th> </tr> <tr> <td class=“left” width=40% align="right"><label for="t1">姓 名:</td> <td class="right"><input type="password" name="Password" /></td> </tr> <tr> <td class=“left” width=40% align="right">密 码:</td> <td class="right"><input type="password" name="Password" /></td> </tr> <tr> <td class=“left” width=40% align="right">确认密码:</td> <td class="right"><input type="password" name="Pass"></td> </tr> <tr> <td class=“left” width=40% align="right">性 别:</td> <td class="right"><input type="radio" id="1" name="ssex" value="nan" />男 <input type="radio" id="2" name="ssex" value="nv" />女</td> </tr> <tr> <td class=“left” width=40% align="right">学历:</td> <td><select id="selc" name="place"> <option value="benke">本科</option> <option value="zhuanke">专科</option> <option value="shuoshi">硕士</option> <select></td> </tr> <tr> <td class=“left” width=40% align="right"><label for="txtarea">自我介绍:</label></td> <td><textarea id="txtarea"></textarea></td> </tr> <tr> <td class=“left” width=40% align="right">兴 趣:</td> <td><input type="checkbox" id="cbox1" name="dushu" value="c1">读书 <input type="checkbox" id="cbox2" name="yundong" value="c2">运动 <input type="checkbox" id="cbox3" name="chihe" value="c3">吃喝 </td> </tr> <tr> <td class=“left” width=40% align="right">头像:</td> <td><input type="file" name="shangchuan" /></td> </tr> <tr> <td></td> <td class=“left” width=40% align="center" rowspan=2><input type="submit" value="提 交" /> <input type="reset" value="重 置" /> </tr> </tbody> </table> </form>
2.用户登录验证jsp
1.jsp
<form action="2.jsp" method="get" > <table border="1"> <tbody> <tr><th align="center">用户登录</th></tr> <tr ><td > 姓 名:</td> <td ><input type="text" name="name" /></td> </tr> <tr><td >密 码:</td> <td ><input type="password" name="paw" /></td> </tr> <tr><td> </td> <td class=“left” width=40% align="center" rowspan=2> <input type="submit" value="提 交" /> <input type="reset" value="重 置" /> </tr> </tbody> </table> </form>
2.jsp
<% String name=request.getParameter("name"); String paw=request.getParameter("paw"); session.setAttribute("name",name); session.setAttribute("paw",paw); %> 姓名:<%=name%> 密码:<%=session.getAttribute("paw") %>
3.图书类
Book.java
public class Book { private String name; private String author; private double price; private int amount; public Book(String name, String author, double price, int amount) { super(); this.name = name; this.author = author; this.price = price; this.amount = amount; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } public double totalPrice(){ return amount*price; } }
Ebook.java
public class Ebook extends Book { @Override public double totalPrice() { // TODO Auto-generated method stub return (super.totalPrice())/3; } public Ebook(String name, String author, double price, int amount) { super(name, author, price, amount); // TODO Auto-generated constructor stub } }
BookTest.java
public class BookTest { public static void main(String[] args) { // TODO Auto-generated method stub Book book=new Book("Java", "张三", 30, 2000); Book ebook=new Ebook("Java", "张三", 30, 2000); System.out.println(book.totalPrice()); System.out.println(ebook.totalPrice()); System.out.println(book.totalPrice()+ebook.totalPrice()); } }
4.水仙花
shuixian.java
public class shuixian { /** * 题目:打印出100-999之间所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。 * 例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。 * 1.程序分析:利用for循环控制100-999个数,每个数分解出个位,十位,百位。* */ public static void main(String[] args) { for(int i=100;i<=999;i++) { int geWei,shiWei,baiWei; baiWei=i/100; shiWei=(i-baiWei*100)/10; geWei=i-baiWei*100-shiWei*10; if(i==geWei*geWei*geWei+shiWei*shiWei*shiWei+baiWei*baiWei*baiWei) { System.out.println(i); } } } }
标签:get font eset put reset res from 姓名 ota
原文地址:http://www.cnblogs.com/molip/p/7422378.html