Check your code in the php for something like $this->$property_name.
You should have it as $this->property_name [without dollar sign]
Cannot forward after response has been committed JSP Error J2EE
This would happen if you try to forward the request twice.
Say you are forwarding to page result.jsp like this
getServletConfig().getServletContext().getRequestDispatcher( "/result.jsp").forward(request,response);
if you have the same call down the line, BINGO.. you are forwarding it twice.. Have your variables to be sent multiple times but forward them at once.
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml maven on war
You might come across this error when building a web application on maven using the command
mvn war:war
This would be caused if maven is not aware of where the web.xml file is located.
If you follow the standard maven directory structure as
src/main/java src/main/resources src/main/webapp
You would have to copy the contents of WebContent [WEB-INF AND META-INF] to src/main/webapp folder – there maven would get it as expected.
Maven J2EE Eclipse: Hello world in J2EE and Maven on Eclipse
Step by step tutorial on J2EE and Maven on IDE Eclipse
Here is a simple yet basic tutorial for a J2EE application using maven and Eclipse from the scratch showing you step by step.
This tutorial assumes you know the basics of Maven and J2EE. This is just a step by step tutorial to show the marriage of the two.
Also, it is assumed that you have installed maven and tomcat on your machine which are fairly easy to do with simple googling.
Lets Start
1. Create simple Hello world module on Eclipse
1.a Open Eclipse Go to file->new->Dynamic Web Project
1.b Name the project as MavenEclipseJ2EE and hit Finish
We have finished the first step.
Now, maven expects some kind of folder structure. Well, you can do it in your own way and make extra configuration, or you can accept what is accepted as standard and have fun.. I go with the standard maven directory structure.
Here is the maven structure
src/main/java
src/main/resource
src/main/webapp
These are going to the source folders. So lets create them.
2. Creating source folders that are acceptable by maven
2.a Go to terminal or how ever you would create folders and create the folders as:
MavenEclipseJ2EE/src$ mkdir main
MavenEclipseJ2EE/src$ mkdir main/java
MavenEclipseJ2EE/src$ mkdir main/resources
MavenEclipseJ2EE/src$ mkdir main/webapp
2.b Go back to Eclipse, select the project and hit F5 or right click on Project and hit refresh. You will see the newly created folders under src
2.c Right click on the project, select properties, select build path and hit source tab
2.d You would see the previous source folder there. Select it and hit remove to remove it. We do this since we are changing the source folders
2.e Then hit the button add folder, expand src, expand main and select the java, resources and webapps only. Hit OK and hit OK again to finish creating source files.
Cool, so our folder structure is ready for Maven. Now lets move to the maven itself.
Maven relies highly on the pom.xml file that we would put on the project root folder. Lets do that.
Continue to part two
The BASEDIR environment variable is not defined correctly This environment variable is needed to run this program
BASEDIR environment not define error and its solution
Are you working on J2EE with Tomcat?
Trying to run Tomcat from the command line and got this problem?
I got this while working on apache-tomcat 7.
Here is how I solved it.
The basedir environment will complain if you have either the JAVA_HOME and/or the CATALINA_HOME paths are not correctly set on the environment variables.
where to get the environment variable? -> in /etc/environment.
Once you make sure paths are set correctly, the next would be allowing the shell scripts to have the executable permissions.
Basically I would do
sudo chmod 777 -R /PATH/TO/TOMCAT/bin
This, as you know is not advisable if for production or networked environments as it will allow all to execute.
Now, you should be able to startup tomcat as
./startup.sh
by going into the tomcat’s bin folder.
Recommended
What is can not access member of class with modifiers and its solution?
See what the no persistence provider error mean for entity manager and how to solve it
Cannot send session cache limiter – headers already sent Error in php Session
Well, Session have both plus and minus parts, but we do use them largely in PHP. So, while developing have you come across Cannot send session cache limiter – headers already sent error but you can’t find any echoed part on the given file? I have got this problem and found out that there is a left over space at the end of the file.
So check if you have spaces either at the beginning or at the end of your file and remove that.
Change default source directory src/java in eclipse for java project
Prepare directory structure for maven by changing the default src
Probably you are using maven and wanted to change the directory structure.
Since maven recommends the standard src/main/java src/main/resource you might want to change it that way
Here is how to do it in eclipse.
First create the folder structure on the project in which ever way you would want to do it. I would use simple command like mkdir folderName
to create it.
1. right click on the project, and hit refresh, make sure the folders you created are listed there.
2. Right click on the project, select properties and select java build path
3. Go to source tab
4. select and remove the current source folder, by default it would be src folder
5. Hit the Add newthen select your folder structure there.

maven directory structure
This would change the original structure of the your java project from src to the one maven compatible.
See how to use maven to create starter boilerplate application
Get started with step by step j2ee and maven tutorial using eclipse
Can you solve these cool algorithm problems? See their solution as well
How do you find the maximum consecutive sum from the given array
You are given billion numbers and to look for a couple of missing numbers
From list of numbers in array, find those that are complementary to the given number
Using If else conditional statement on where condition mysql
Using if / else on the mysql would be much easier to express with simple query. Her we go:
Assume you have the following table:
+--------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+----------------+ | file_id | int(11) | NO | PRI | NULL | auto_increment | | file_path | text | NO | | NULL | | | file_name | varchar(120) | NO | MUL | NULL | | | file_size | bigint(20) | YES | | NULL | | | file_content | text | NO | MUL | NULL | | +--------------+--------------+------+-----+---------+----------------+
Then you want to collect records either by file_id or by file_size based on the file_size, if the file size above some value, check the name of the file to contain xls, otherwise, consider only files that have file id more than y
select * from file where if (file_size > x, file_name like '%.xls', file_id > y)
YUP!
Render hidden element with out decorator in Zend Framework
When you add hidden element on the zend form, you would see the hidden elements taking up places wrapped by dt dd tags.
To get rid of that and view only the hidden element, do:
$form->addElement(‘hidden’, ‘somename’, array(‘decorators’=>’ViewHelper’)); – this would render it without the decorators.
Regex for individual words in php
This is a simple check for words that you might want to check if the given string is this word or that word. Possible utilization could be: when you allow the user to upload file, you might want to get only certain type of file only like in the case of image jpeg, jpg, and gif only
if (preg_match('/jpeg|jpg|gif/i')){ //do uploading }else{ $message = "supported file types are ..."; }