Home java Java Forum, how to implement the creation of topics (new pages) by...

Java Forum, how to implement the creation of topics (new pages) by users?

Author

Date

Category

I write site, Spring MVC

For frontend answers Bootstrap + JSP

Here is the task, the user creates a new topic on the forum (for example: we will discuss politics)

Accordingly, a new view should appear with the new address “/ newpage1” how to implement it?


Answer 1, Authority 100%

Create standard JSP for all those, Ala:

& lt;% @ Page Language = "java" contenttype = "text / html; charset = ISO-8859-1 "
PageNcoding = "ISO-8859-1"% & gt;
& lt;% @ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"% & gt;
& lt; html & gt;
 & lt; Head & gt;
  & lt; Title & gt; $ {subject.name} & lt; / title & gt;
 & lt; / Head & gt;
 & lt; Body & gt;
  & lt; div & gt;
    $ {subject.text}
  & lt; / div & gt;
 & lt; / body & gt;
 & lt; / html & gt;

and on request on the topic fill it

@ requestmapping (value = "/ subject", Method = RequestMethod.get)
Public String DeleteBasketProduct (@RequestParam ("Subject") String SubjectName, ModelandView ModelandView) {
  Database DB = New Database (); // Your own implemented repository that will return the stored topic
  Subject SB = DB.GetSubject (SubjectName); // Your theme model
  ModelandView.addobject ("Subject", SB);
  Return "subjectName.jsp";
}
Previous articleclass Point C++
Next articlePHP session duration

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions