| |

VerySource

 Forgot password?
 Register
Search
View: 929|Reply: 5

Code problem How to use a hyperlink to pass parameters Get parameters on this page Online

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2019-12-27 17:34:19
| Show all posts |Read mode
<% out.print ("<a href =\" searchnews.jsp? p = "+ i +"\">" + 2+ "</a>&nbsp;&nbsp;");%>

out.print (request.getParameter ("p")); (how is it null?)
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-2 14:48:01
| Show all posts
No way?
Reply

Use magic Report

1

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-3 12:42:01
| Show all posts
Is it empty after you click on the link?
Reply

Use magic Report

1

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-4 23:36:01
| Show all posts
if ((String) session.getAttribute ("data") == "123");
Finally, do n’t have a semicolon, it ’s right to test it on my platform after removing it, the environment is the same as yours.
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-5 09:09:01
| Show all posts
On this page. . . <% = I%> isn't it?
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-6 14:00:01
| Show all posts
There are now three pages ① → ② → ③,
<% out.print ("<a href =\" searchnews.jsp? p = "+ i +"\">" + 2+ "</a>&nbsp;&nbsp;");%>

out.print (request.getParameter ("p")); (how is it null?)
Assuming these statements are on ②, the request built-in object here refers to the request sent by ① page to ② page.
In order to get the parameters from the hyperlink, it must be the request of ② page through the hyperlink to ③ page
Objects can only be obtained using request.getParameter ("p").
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list