1 25 26 package net.killingar.forum.wiki; 27 28 import net.killingar.forum.internal.managers.ForumManager; 29 import net.killingar.wiki.impl.SimpleNode; 30 31 public class UserNode extends SimpleNode 32 { 33 public UserNode( 34 String text, 35 int lineCount, 36 int startIndex, 37 int endIndex) 38 { 39 super(text, lineCount, startIndex, endIndex); 40 } 41 42 public String createHTML(ForumManager manager, long id) throws java.sql.SQLException 43 { 44 return "<a HREF=\"user.View.action?userID="+id+"\">"+manager.getUser(id).toString()+"</a>"; 45 } 46 47 public String toString() 48 { 49 try 50 { 51 javax.servlet.http.HttpServletRequest req = webwork.action.ServletActionContext.getRequest(); 53 ForumManager manager = (ForumManager)req.getSession().getAttribute("manager"); 54 55 if (getText().equalsIgnoreCase("current")) 56 { 57 return createHTML(manager, manager.getUserID()); 58 } 59 else 60 { 61 try 62 { 63 long l = Long.parseLong(getText()); 64 return createHTML(manager, l); 65 } 66 catch (NumberFormatException e) 67 { 68 return e.toString(); 69 } 70 } 71 } 72 catch (java.sql.SQLException e) 73 { 74 return e.toString(); 75 } 76 } 77 } 78 | Popular Tags |