java吧 关注:1,252,288贴子:12,737,375
  • 1回复贴,共1

额,也帮我看看问题呗····

只看楼主收藏回复


package foo;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
public class AdvisorTagHandler extends SimpleTagSupport{
private String user;
public void doTag() throws JspException, IOException{
getJspContext.getout().write("Hello" + user + "<br>");
getJspContext.getout().write("Your advice is:" + getAdvice() );
}
public void setUser(String user){
this.user=user;
}
String getAdvice(){
String[] adviceString = {"That color's not working for you.",
"You should call in sick.","You might want to rethink that haircut()."};
int random = (int) (Math.random() * adviceStrings.length);
return adviceStrings[random];
}
}



1楼2012-02-22 16:39回复
    额 谢谢 !!!!!!!!


    3楼2012-02-22 16:44
    回复