Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page
- import="java.util.*, bloggen.domain.Post, bloggen.io.PostDao, dk.au.hum.imv.persistence.db.JDBCConnectionFactory, bloggen.io.UserDAO, bloggen.domain.User"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>Insert title here</title>
- </head>
- <body>
- <%@ include file="Header.jsp"%>
- <legend>Ny brugeranmeldelse</legend>
- <form action="Index.jsp" method="post">
- <fieldset>
- <div class="blog-header">
- <h1 class="blog-title">BLOGGEN</h1>
- <p class="lead blog-description">Den officielle BLOG</p>
- </div>
- <table>
- <tr>
- <td><h1>New Post</h1></td>
- </tr>
- <tr>
- <td>Genre</td>
- <td><select name="genre">
- <option value="Jazz">Jazz</option>
- <option value="Rock">Rock</option>
- <option value="Hiphop">Hiphop</option>
- <option value="Pop">Pop</option>
- <option value="Electronic">Electronic</option>
- </select></td>
- </tr>
- <tr>
- <td><p>Title</p></td>
- <td><input type="text" name="postTitle"></td>
- </tr>
- <tr>
- <td><p>Text</p></td>
- <td><textarea rows="4" cols="50" type="text" name="Text"> </textarea>
- </td>
- </tr>
- </table>
- <input type="submit" value="submit" name="submit">
- </fieldset>
- </form>
- <%
- String genre = request.getParameter("genre");
- String title = request.getParameter("postTitle");
- String text = request.getParameter("Text");
- long id = model.getUserId();
- User user = UserDAO.getUserById(id);
- if (request.getParameter("submit") != null) {
- JDBCConnectionFactory.initManualConnectionHandling("jdbc:mysql://student.hum.au.dk:3306/u201507985",
- "u201507985", "Butm51uR", "com.mysql.jdbc.Driver");
- PostDao.Post(title, user.getUserName(), text, genre);
- }
- %>
- <%
- JDBCConnectionFactory.initManualConnectionHandling("jdbc:mysql://student.hum.au.dk:3306/u201507985",
- "u201507985", "Butm51uR", "com.mysql.jdbc.Driver");
- ArrayList<Post> NewPosts = PostDao.getAllPosts();
- %>
- <div class="container">
- <div class="blog-header">
- <h1 class="blog-title">Forum</h1>
- <p class="blog-description">Under her skulle vores post gerne
- komme</p>
- <hr>
- </div>
- <div class="col-sm-8 blog-main">
- <div class="blog-header">
- <h2 class="blog-title">
- <strong> Music </strong>
- </h2>
- </div>
- </div>
- <%
- for (Post Newposts: posts) { %>
- }
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement