jsp实现点击链接,在另一页面获取链接的文本内容

求大侠指点!!!!!!!详细的说就是,a.jsp中的链接是从数据库中读出来的文章标题,我是想在a页面点击这些链接,然后转到b.jsp中处理能得到这个文章标题对应的文章内容,现在就是在b页面无法获取a中的链接文本啊!!!!真的钱了 解决了我一定默默祈祷,祝您工作开心顺利!!

jsp中实现两个页面之间的传值方法如下:
举例说明:
建立两个JSP页面传值,tes1.jsp和test2.jsp。代码如下:
<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%>
<%
Stringpath=request.getContextPath();
StringbasePath=request.getScheme()+"://"+request.getServerName()
+":"+request.getServerPort()+path+"/";
%>
>
<html>
<head>
<basehrefbasehref="<%=basePath%>">

<title>MyJSP'test1.jsp'startingpagetitle>
<metahttp-equivmetahttp-equiv="pragma"content="no-cache">
<metahttp-equivmetahttp-equiv="cache-control"content="no-cache">
<metahttp-equivmetahttp-equiv="expires"content="0">
<metahttp-equivmetahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
<metahttp-equivmetahttp-equiv="description"content="Thisismypage">
<metahttp_equivmetahttp_equiv="refresh"content="5">

<scriptlanguagescriptlanguage="javascript"type="text/javascript">
functionexecute(){
varobj=document.getElementById("name");
document.form1.action="alipay/test2.jsp?param="+obj.value;
document.form1.submit();
}
script>
head>
<bodyonloadbodyonload="execute();">
<formnameformname="form1"method="post">
<table>
<tr>
<td>
测试JSP页面传值<inputtypeinputtype="text"id="username"value="luodada">
</td>
</tr>
</table>
</form>
body>
html>
tset2.jsp的代码如下:
<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%>
<%
Stringpath=request.getContextPath();
StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
>
<html>
<head>
<basehrefbasehref="<%=basePath%>">
<title>MyJSP'test2.jsp'startingpagetitle>
<metahttp-equivmetahttp-equiv="pragma"content="no-cache">
<metahttp-equivmetahttp-equiv="cache-control"content="no-cache">
<metahttp-equivmetahttp-equiv="expires"content="0">
<metahttp-equivmetahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
<metahttp-equivmetahttp-equiv="description"content="Thisismypage">

head>
<body>
<%
Stringvalue=request.getParameter("param");
out.print("从test1.jsp传递过来的值是"+value);
%>
body>
html>
具体思路如下:
在JSP页面传值test1.jsp中,通过JavaScript把文本框中的值获取出来,,使test1.jsp在加载进来的时候马上执行页面跳转;
在JSP页面传值test2.jsp中通过request.getParameter("参数名称");来获取test1.jsp传递过来的值即可。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-04-30
a.jsp里面跳转的url=......jsp?title="标题"; 或者你就写成 <%request.setparameter("title","标题") %>

b.jsp <% =request.getparameter("title") %> 就可以获取到标题了!本回答被提问者采纳
相似回答