0

I dont really know how to ask that question and the title might be missleading, but basicly I want to use an URL that looks like this:

http://www.domain.WE/Forum/THREAD-ID/PAGENUMBER/

Do i have to create folders for each thread and for each page in the directory? or is there an other way to achive that, where i can have just one page that loads the content?

I am using JSP and javascript

i would be happy with some keywords i could google

user3438815
  • 211
  • 3
  • 12
  • this is normally how an MVC framework works so that if your url is `http://www.domain.WE/Forum/THREAD-ID/PAGENUMBER/` then `Forum` is your controller, `THREAD-ID` and `PAGENUMBER` are your parameters – CodeGodie Mar 04 '15 at 17:17
  • http://stackoverflow.com/questions/2060128/java-front-controller – Quentin Mar 04 '15 at 17:22

2 Answers2

0

you can use the url to submit parameters using http GET which basically takes the form similar to:

http://someaddress/someappname/somepage.jsp?attr1=val1&attr2=val2

attr being attribute names and val being the values for those attributes that you want to send.

Similar question here

you can look up also look up REST and web services if you want your URL to control the path and/or provide parameters.

Community
  • 1
  • 1
suvartheec
  • 3,484
  • 1
  • 17
  • 21
0

I dont know much about how JSP works but what you’re after is a router, which can live either on the client or on the server.

Backbone Router is a pretty no-frills implementation. Other popular client routers (although most work on the server) are director or page.

If you wanted to write one yourself (likely unnecessary) you just need something that will react to a URL change, run a regex over it to extract parts and map from one state to another. Sounds more complicated than it is, but in reality just use one that has already been written and battle tested.

Matt Styles
  • 2,442
  • 1
  • 18
  • 23