aspose file tools*
The moose likes JSP and the fly likes Change a comment in a jsp file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Change a comment in a jsp file" Watch "Change a comment in a jsp file" New topic
Author

Change a comment in a jsp file

Ayoub Zemmouri
Greenhorn

Joined: Jun 19, 2013
Posts: 2
hi
in a jsp page i have an image and comments below it, then a comment area (<form ..> <textarea>), i want my users to be able to change their comments, when they click the modifiy bouton (<a href=...>) i want the comment to apear in the comment area to be modify here's what i've tryed to do but not working

<%
"<a href='&?id_commentaire="+id_commentaire +"'><img src='images/mod.gif'></a>"+


String commm=request.getParameter("#id_commentaire");


if(commm!=null){

Class.forName("com.mysql.jdbc.Driver");
Connection connect = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/atelier","root","");
ResultSet resultat = cnt.createStatement().executeQuery("SELECT * FROM comment WHERE id_commentaire='"+commm+"'");

String comen=resultat.getString("7");
out.print(
"<form action='/Atelier/CreerCommentaire' method='get'>"

+"<textarea name='comment' id='comment' value='"
+comen
+"'cols='25' rows='10'></textarea>"
+"</p>"
+"<input type='submit' id='sf_submit' value='Publier'>"
+"<input type='reset' id='sf_reset' value='Annuler'>"
+"</p>"
+"</form>"
);

}else{
for( int i = 0 ; i < listCours.size() ; i++ ){
out.print(
"<form action='/Atelier/CreerCommentaire' method='get'>"

+"<input type='hidden' name ='idCou' value='"
+listCours.get(i).getId_cour()
+"'>"
+" <p>"
+" <textarea name='comment' id='comment' cols='25' rows='10'></textarea>"
+"<p>"
+" <input type='submit' id='sf_submit' value='Publier'>"
+"<input type='reset' id='sf_reset' value='Annuler'>"
+" </p>"
+"</form>"
);}

}
%>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Why are you generating HTML in Java strings inside (obsolete) Java scriptlets? The whole point of a JSP is to be able to create the HTML using template text.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ayoub Zemmouri
Greenhorn

Joined: Jun 19, 2013
Posts: 2
i coied the code from a servlet ....... but i don't think that makes any diffrence it's still supposed to work
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Why would you copy code from a servlet into a JSP? That makes no sense at all. What are you actually trying to accomplish by doing that?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Change a comment in a jsp file