问题
I'm going rephrase my previous question. We have a website on our server that was developed by our parent company (across the globe in Taiwan) using NetBeans. Nothing on the server is from NetBeans, no references, build files, project files, or anything. Just the necessary files the server needs to run the website. I've been given the responsibility of maintaining this website because they no longer support us. So, I copied/pasted the entire website, from the domain folder, over to my local computer and imported it into my NetBeans. As I go into the source code, I get a whole bunch of errors. Basically 95% of the import
statements are erroring out because it can't find the specified "symbol", or the package simply "doesn't exist".
I've tried working with the Project properties -> Libraries and adding libraries and/or JAR/Folder that I believe the source code is trying to reference..but it doesn't seem to do the trick, or I'm not doing it right. I just need to get these darn references working.. here is a small list of the import statements from the file in question (RecordAdd.java):
package asp.easp;
import asp.SessionBean1;
import com.icesoft.faces.component.ext.HtmlCommandButton;
import com.icesoft.faces.component.ext.HtmlCommandLink;
import com.icesoft.faces.component.ext.HtmlDataTable;
import com.icesoft.faces.component.ext.HtmlInputText;
import com.icesoft.faces.component.ext.HtmlInputTextarea;
import com.icesoft.faces.component.ext.HtmlMessage;
import com.icesoft.faces.component.ext.HtmlOutputText;
import com.icesoft.faces.component.ext.HtmlPanelGrid;
import com.icesoft.faces.component.ext.HtmlSelectOneMenu;
import com.icesoft.faces.component.jsfcl.data.DefaultSelectedData;
import com.icesoft.faces.component.jsfcl.data.DefaultSelectionItems;
import com.icesoft.faces.component.jsfcl.data.DefaultTableDataModel;
import com.icesoft.faces.component.jsfcl.data.SelectInputDateBean;
import com.icesoft.faces.component.panelpopup.PanelPopup;
import com.icesoft.faces.component.paneltabset.PanelTab;
import com.icesoft.faces.component.paneltabset.PanelTabSet;
import com.icesoft.faces.component.selectinputdate.SelectInputDate;
import com.icesoft.faces.component.selectinputtext.SelectInputText;
import com.sun.rave.faces.data.DefaultSelectItemsArray;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import java.util.ArrayList;
import java.util.Collection;
import javax.faces.FacesException;
import javax.faces.convert.DateTimeConverter;
import javax.faces.model.ListDataModel;
import util.RecordDetailInfoBean;
import asp.ApplicationBean1;
import asp.RequestBean1;
import com.coretronic.util.DateConvert;
import com.icesoft.faces.component.ext.HtmlSelectOneRadio;
import com.icesoft.faces.component.jsfcl.data.CachedRowSetWrapperDataModel;
import com.icesoft.faces.context.effects.Appear;
import com.icesoft.faces.context.effects.Effect;
import com.sun.data.provider.impl.CachedRowSetDataProvider;
import com.sun.jsfcl.data.CachedRowSetDataModel;
import com.sun.sql.rowset.CachedRowSetXImpl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Calendar;
You can see a picture of the file hierarchy of the website in the link above to my previous question. Can somebody please help me get these references working in my project? I have very little experience in JavaEE, so please assume I don't know anything, because I don't. The stuff I do know that I've mentioned is what I've come to find after working on this for a week now. I can provide any additional information you need about the project. Thank you very much in advance.
回答1:
You should always first figure which application server the webapp is currently running in. You should namely have a copy of the very same server in your local development environment. That can be Tomcat 6/7, Glassfish 2/3, JBoss AS 5/6 or something. "Java EE" is an abstract API and the application server is a concrete implementation which contains the real libraries, such as the javax.*
ones. I don't do Netbeans (I am an Eclipse user), so I can't go in detail, but you should at least integrate the application server in your IDE and import the project as a Java EE project and associate it with the application server in there. This way the javax.*
imports should work. At least, if the IDE is a bit smart.
According the com.sun.rave.*
imports, which is part of the (fortunately) for long dead Woodstock component library for JSF, I guess that the webapp was originally developed in Netbeans 6.x (max 6.7) and that target application server is Glassfish v2. That IDE shipped with a so-called Visual JSF Editor which allowed you to drag'n'drop web UI components together (and generated hard-to-maintain code). I'd suggest to get a copy of Netbeans 6.7 which was the latest which shipped with Glassfish 2.1 and Woodstock. You can download it here. Pick the one of the 2nd column, saying "Java" (not "Java SE"!). It's 238MB.
The com.icesoft.faces.*
imports are from the IceFaces JSF component library. Seeing this in combination with the Woodstock imports, I guess that the project was ever migrated from Woodstock to IceFaces after Woodstock died. The IceFaces libraries (and all other webapp-specific libraries) should be available in the /WEB-INF/lib
folder. When the project is on a proper manner imported, the IDE should already have taken all JARs in the /WEB-INF/lib
folder in the build path. Again, I'm not sure about Netbeans, but at least Eclipse (for Java EE) does that automagically.
Good luck with maintaining the project. This is definitely not going to be easy if you haven't ever touched Java EE. If you want a bit more background info about Woodstock, check my answer on this question: Where is Visual Web Editor for JavaServer Faces on Netbeans Last but not least, I strongly recommend to take a pause of about half a year or longer and play around with simple Java EE tutorials/examples/projects first so that you get better overall idea. Going from nothing to JSF is a pretty steep and long traject. I'd suggest to get yourself through Java EE web development, where do I start and what skills do I need?
来源:https://stackoverflow.com/questions/6392726/javaee-netbeans-library-referencing