将值从jsp传递到servlet [英] passing value from jsp to servlet

查看:70
本文介绍了将值从jsp传递到servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此特定问题上,我需要您的帮助 我想将.jsp程序中的隐藏输入类型的值传递给servlet程序

I need your help in this particular issue I want to pass the value of a hidden input type in a .jsp program to a servlet program

我在做什么基本上就是这个

what I am doing is basically this

<input type="hidden" name="articleId" id="articleId" value=" <%request.getParameter("articleId");%>"/>

从servlet中获取值

and from the servlet I am getting the value

String articleId = request.getParameter("message");
        PrintWriter out = response.getWriter();
        out.println(articleId);

它没有显示任何想法. jsp的form方法是post,而servlet的方法是doPost

It doesn't print any think . the jsp form method is post and the servlet method is doPost

任何想法为什么它不传递参数?

any Ideas why it doesn't pass the parameter?

推荐答案

您使用了错误的参数,应执行以下操作:

You used wrong parameter, should do as following:

String articleId = request.getParameter("articleId");
PrintWriter out = response.getWriter();
out.println(articleId);

这篇关于将值从jsp传递到servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆