| |

VerySource

 Forgot password?
 Register
Search
View: 944|Reply: 6

Seeking a solution

[Copy link]

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-30 08:40:01
| Show all posts |Read mode
I want to get the path of the current page, such as: I open http: //localhost/test/login.jsp after logging in, and enter the page inside, can I get this path in the program code and get http: // localhost / test / login.jsp, get http: //localhost/test/main.jsp on the main page.
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-5 21:45:01
| Show all posts
Yes, but you need to combine it yourself
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-6 14:45:01
| Show all posts
application.getRealPath ("/ test / main.jsp")
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-6 19:00:02
| Show all posts
String path = "http: //" + request.getServerName () + request.getContextPath () + request.getRequestURI ();
Reply

Use magic Report

1

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-11 15:30:02
| Show all posts
request.getRequestURI ();
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-19 16:00:01
| Show all posts
You can use request.getRequestURI (); is equivalent to request.getRequestServerletPath (); this is not obtained after removing the full domain name.
request.getRequestURL (); is all addresses;
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-11 18:15:01
| Show all posts
request.getRequestURL()
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