web应用基砒
Web应用基础
A p ache struts The Apache Software Foundation Struts Published: Tue May 27 00: 05: 25 EST 2008 Apache I Struts 2 I str Recent Threads Roadmap FAQ list, and see for yourselfe Apache Struts have to say about using it? Browse the user mailing ckstart FAC Website Stats Thank [ANN] Practcal Apache Struts2 Web 2.0 Projects 52] REST and Plugin ideas The breadcrumbs have been served! Struts 1.2: calling an action by javascript 2008 mentation ovember 3-7 Technologies Struts 2.1.2 Recent Releases 0.11.1(GA) Struts 1.3.9 Scroll down for more about Apache Struts, the Apache Struts project, and struts for Newbies Struts 13.8 26 May 2008- Struts 2.1.2 Beta Release Prior Releases he latest release 2.1.2, which was promoted to""on 26 March 2008 http://jakarta.apacheorg/struts
Apache Struts http://jakarta.apache.org/struts
Spring Spi ng Framework springone Documentation Downloads Support Developmen Welcome to the home of the Spring Framework, the leading ° Projects full-stack Java/JEE application framework. Led and sustained by Spring Source, Spring delivers significant benefits for many projects, increasing development productivity and runtime performance while Improving test coverage and application quality nt posts Springone 2008 Kicks off Submitted by Adam Fitzgerald on Wed, 2008-06-11 06: 59 The first day of Springone 2008 got off to a great start. Rod Johnson gave his Sign up for our News ding room only crowd and gave a detailed presentation of features in Spring 2.5 as well as discussing some of the new Springsource 0 http://www.springframework.org/
Spring http://www.springframework.org/
Hello world public class Hello World public static void main(String[] args)t System. out. printin ("Hello world! 以下情况怎么办? 改变消息内容 以不同方式输出这个消息 附上HTML标签而非文本
HelloWorld public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } 以下情况怎么办? 改变消息内容 以不同方式输出这个消息 附上HTML标签而非文本
Hello World revised, v1) public class HelloworldWith CommandLine t public static void main(String[] args)t if(args length>0)t System. out. println(args[O] else t System. out. printIn("Hello World! )i 现在无需改变代码就可以 更改消息内容但消息显示 方式无法方便地改变
HelloWorld (Revised, v1) public class HelloWorldWithCommandLine { public static void main(String[] args) { if(args.length > 0) { System.out.println(args[0]); } else { System.out.println("Hello World!"); } } 现在无需改变代码就可以 更改消息内容 ,但消息显示 方式无法方便地改变
Interface > MessageProvider String getMessage0 Plements > HelloWorldMessage Provider String getMessageo
Interface implements > MessageProvider String getMessage() > HelloWorldMessageProvider String getMessage()
Interface > MessageRenderer void render void setMessgeProvider(Message Provider provider) MessageProvider getMessageProvidero implements > StandardoutMessageRenderer void render void setMessgeProvider(MessageProvider provider) Message Provider getMessage Provider
Interface implements > MessageRenderer void render() void setMessgeProvider(MessageProvider provider) MessageProvider getMessageProvider() > StandardOutMessageRenderer void render() void setMessgeProvider(MessageProvider provider) MessageProvider getMessageProvider()
Hello WorldMessageProvider public class HelloWorldMessageProvider implements MessageProvider t public String getMessageo i return Hello world!
HelloWorldMessageProvider public class HelloWorldMessageProvider implements MessageProvider { public String getMessage() { return "Hello World!"; } }
StandardOutMessageRenderer public class standardOutMessageRenderer implements MessageRenderer t public MessageProvider messageProvider null; public void renders if (messageProvider ==null)t throw new RuntimeException ("Message Provider is null ") System. out. printIn(messageProvider getMessageo): public void setMessageProvider(MessageProvider provider this messageProvider provider public Message Provider getMessageProvidero t return this. message Provider;
StandardOutMessageRenderer public class StandardOutMessageRenderer implements MessageRenderer { public MessageProvider messageProvider = null; public void render() { if (messageProvider == null ) { throw new RuntimeException ("Message Provider is null"); } System.out.println(messageProvider.getMessage()); } public void setMessageProvider (MessageProvider provider) { this.messageProvider = provider; } public MessageProvider getMessageProvider() { return this.messageProvider; } }
Hello World revised, v2) public class HelloWorld Decoupled i public static void main(String[] args)t MessageRenderer mr new StandardoutMessageRenderer: MessageProvider mp new HelloWorldMessageProvidero mr. setMessageProvider(mp); mr render 还有一个小问题: 若想改变消息提供和显示 者还要改变代码
HelloWorld (Revised, v2) public class HelloWorldDecoupled { public static void main(String[] args) { MessageRenderer mr = new StandardOutMessageRenderer; MessageProvider mp = new HelloWorldMessageProvider(); mr.setMessageProvider(mp); mr.render(); } } 还有一个小问题: 若想改变消息提供和显示 者还要改变代码