I would like to make pretty URLs for my web projects on Java.
For example, I have URLs like these:
or
But it isn't so pretty and userfriendly...
I want to make links like these:
Сan you help me with this? How can I get it?
It's possible to use any Java frameworks or libs if it's help.
Thank you!
Update: I found solution - Spring MVC with Controller
's @RequestMapping("/Putin")
annotation for example.
Context Framework allows you to do just that. For instance the examples you gave could be mapped like this in a view:
@View(url="regex:/web/<year:\\d{4}>/<month:\\d{2}>/<day:\\d{2}>/<specifier>")
@PageScoped
public class ArticleView extends Component implements ViewComponent {
@PathParam
private long year;
@PathParam
private long month;
@PathParam
private long day;
@PathParam
private String specifier;
@Override
public void initialize(ViewContext context) {
System.out.println(year+"/"+month+"/"+day+"/"+specifier);
// Then do something
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With