﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-java小毛孩-最新评论</title><link>http://www.blogjava.net/lihang-87/CommentsRSS.aspx</link><description /><language>zh-cn</language><pubDate>Wed, 25 Mar 2009 13:36:03 GMT</pubDate><lastBuildDate>Wed, 25 Mar 2009 13:36:03 GMT</lastBuildDate><generator>cnblogs</generator><item><title>re: 一道关于Struts的面试题</title><link>http://www.blogjava.net/lihang-87/archive/2009/03/26/261947.html#262176</link><dc:creator>无印之路</dc:creator><author>无印之路</author><pubDate>Thu, 26 Mar 2009 09:40:00 GMT</pubDate><guid>http://www.blogjava.net/lihang-87/archive/2009/03/26/261947.html#262176</guid><description><![CDATA[做出来了。<br>Hello.jsp<br>&lt;s:from action=”HelloAction” mothod=”post”&gt;<br>	&lt;s:textfield name=&quot;helloform.content&quot;&gt;&lt;/s:textfield&gt;<br>	&lt;s:submit value=&quot;提交&quot;&gt;&lt;/s:submit&gt;<br>&lt;/s:from&gt;<br><br>HelloAction.java<br>import javax.servlet.http.HttpServletRequest;<br>import org.apache.struts2.ServletActionContext;<br><br>import com.opensymphony.xwork2.ActionSupport;<br><br>public class HelloAction extends ActionSupport {<br><br>	private HelloForm helloform;<br>	 <br>	public HelloForm getHelloform() {<br>		return helloform;<br>	}<br>	public void setHelloform(HelloForm helloform) {<br>		this.helloform = helloform;<br>	}<br><br>	public String input(){<br>		HttpServletRequest request = ServletActionContext.getRequest();<br>		<br>		if(helloform.getContent().equals(&quot;Hello&quot;)){<br>			String input=helloform.getContent();<br>			request.setAttribute(&quot;input&quot;,&quot;hello world!&quot;);<br>		}else{<br>			request.setAttribute(&quot;input&quot;,&quot;输入错误！&quot;);<br>		}<br>		System.out.println(helloform.getContent());<br>		return SUCCESS;<br>	}<br>}<br><br>Sayhllo.jsp<br><br>&lt;body&gt;<br>    &lt;%=request.getAttribute(&quot;input&quot;) %&gt;<br> &lt;/body&gt;<br><img src ="http://www.blogjava.net/lihang-87/aggbug/262176.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lihang-87/" target="_blank">无印之路</a> 2009-03-26 17:40 <a href="http://www.blogjava.net/lihang-87/archive/2009/03/26/261947.html#262176#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>