I need formatting java code snippets at my blogs so i use an eclipse plugin, simply you can copy html code to editor.
java2html Eclipse Plugin
I think the most practical way to format html and xml code snippets is using:
http://www.manoli.net/csharpformat
Thanks to Truong Hong Thi for sharing
Edit: I also found a brilliant wordpress plugin for formatting source code.
SyntaxHighlighter
Easy to use, just add source language=’java’ tag
public class FileComponent implements Serializable{
private String fileName;
private String contentType;
private int size;
private String localPath;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
I upgraded maven 2.0.4 to 2.0.7 and the i couldn’t compile the existing projects because of filtering problem – filtering files couldn’t be read, the source of problem was maven-assembly-plugin. I think such kind of incongruities generally may occur. The simplest solution of such problems is simply renaming the maven folder ….m2repositoryorgapache and installing the project again for full download of all maven and maven plugins
The details of the problem and the solution is below:
http://jira.codehaus.org/browse/MASSEMBLY-178
Using Tomcat 5.5.17 after starting application, jsp pages couldn’t be rendered and the following error is taken with an empty page. To fix the problem simply check the commons-el.jar versions and also remove geronimo-spec-jsp.jar from WEB-INFlib directory if this jar is not already excluded:
java.lang.VerifyError: (class: org/apache/jasper/runtime/PageContextImpl, method: getExpressionEvaluator signature: ()Ljavax/servlet/jsp/el/ExpressionEvaluator;) Wrong return type in function
at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:99)
at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:61)
at org.apache.jsp.pages.P60.Common.StandardPageParentTemplate_jsp._jspService(StandardPageParentTemplate_jsp.java:87)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Sonsuza dek yatan sanma ölüdür,
Tuhaf çağlarda ölüm de ölür.
Korku Öyküleri Antolojisi – Karanlıkta 33 Yazar kitabında en beğendiğim öykülerden biri Adsız Kent, ve yazarı H.P. Lovecraft‘in diğer kitapları ve öykülerini okumak için sabırsızlanıyorum
Creating Dynamic Components at JSF is really easy but because of performance problems and the large number of components to generate i choose different way at project. A simple sample:
Use datagrid/datatable object to add your components:
<h:panelgrid id="grid1″ styleclass="panelGrid" columns="2″></h:panelgrid> <hx:commandexbutton id="newComponentBtn"
action="#{pc_DynaComponentView.addNewComponent}" styleclass="commandExButton"
type="submit" value="New Component">
</hx:commandexbutton>
Sample JSF:
<h:form id="form1" styleclass="form"> <h:panelgrid id="grid1" styleclass="panelGrid" columns="2"></h:panelgrid>
<hx:commandexbutton id="newComponentBtn"
action="#{pc_DynaComponentView.addNewComponent}" styleclass="commandExButton"
type="submit" value="New Component"></hx:commandexbutton>
<h:panelgrid id="grid1" styleclass="panelGrid" columns="2"></h:panelgrid>
<hx:commandexbutton id="newComponentBtn"
action="#{pc_PageView.addNewComponent}" styleclass="commandExButton"
type="submit" value="New Component"></hx:commandexbutton>
</h:form>
Sample Code at Backing Bean:
public void addNewComponent() {
// create sample components
HtmlSelectOneListbox listbox = new HtmlSelectOneListbox();
HtmlInputText text1 = new HtmlInputText();
text1.setValue("TEST");
List valueList = new ArrayList();
SelectItem selectItem = new SelectItem("TEST1", "TEST1");
valueList.add(selectItem);
selectItem = new SelectItem("TEST2", "TEST2");
valueList.add(selectItem);
UISelectItems items = new UISelectItems();
items.setValue(valueList);
listbox.getChildren().add(items);
grid1 = getGrid1();
// Add components
grid1.getChildren().add(listbox);
grid1.getChildren().add(text1);
}
..IBMRationalSDP6.0rwdeclipsepluginscom.ibm.etools.jsf.
runtime.ri_6.0.0runtimejsf-impl.jar added to project lib.
com.xxx.model.data.messages.messages.properties edited.
faces-config.xml :
<application>
<variable-resolver>com.ibm.faces.databind.SelectItemsVarResolver</variable-resolver>
<property-resolver>com.ibm.faces.databind.SelectItemsPropResolver</property-resolver>
<locale-config>
<default-locale>tr</default-locale>
</locale-config>
<message-bundle>com.hbtr.model.data.messages.messages</message-bundle>
</application>
I’m moving from blogger to wordpress
)
See also cemreceren.blogspot.com