怎样在Servlet里面得到js页面out打印的文本框值? - 爱问答

(爱问答)

怎样在Servlet里面得到js页面out打印的文本框值?

怎样在Servlet里面得到js页面out打印的文本框值?

为什么用了int bookpnum=Integer.valueOf(request.getParameter("bookpnum"));还是得不到这个值。

方式只有一种。

步骤:

1、获取response对象

2、获取response的printwriter对象

3、通过printwriter的pring方法输出js

示例代码:

123456789   public void doGet(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         PrintWriter out = response.getWriter();//通过servlet的doget方法获取response对象,通过getWriter方法获取PrintWriter对象         out.flush();//清空缓存         out.println("<script>");//输出script标签         out.println("alert('此用户名已存在,请重新输入!');");//js语句:输出alert语句         out.println("history.back();");//js语句:输出网页回退语句         out.println("</script>");//输出script结尾标签     }  


下一篇:求全图。。

上一篇:cssci数据库可以用citespace做category分析吗

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?