views:

23

answers:

2

hi I am working about a project.I was working with JBuilder2008 till last and my codes was true and my projefct whould work successfully.for today I have got to work with MyEclipse. and I have gote a problem: request.setCharacterEncoding("UTF-8"); has got a red line below 'setCharacterEncoding' and it has below problem message: The method setCharacterEncoding(String) is undifined for the type HttpServletRequest could you tell me what shall I do? tanks advance for helping me.

A: 

I think that the problem is that your Eclipse is configured to use an older version of the servlet APIs; see this forum post. (Right at the end.) The method is certainly present in the Java Servlet 2.4 APIs.

(FWIW, I pick up my Java Servlet APIs via an explicit Maven dependency, so I'm not hostage to the default version implied by my IDE settings.)

Stephen C
tank you for your attention, but my problem is immutable yet.I think its better to have some comment about my changes.first of all its better to say that I have changed my server to WebLogic10.x from webLogic 8.x , and you have better to know that I have generated Hibernate from my tables. I hope to find the best soloution about my problem.thank you for your attention and helping and advising me.
pesareshamshir
please give me answer for my question and problem, wich I have writen at blow lines.
pesareshamshir
I'm not sure that I can. I use plain Eclipse (not MyEclipse) and I pick up my Servlet APIs from Maven. I'll retag this question and see if that helps.
Stephen C
A: 

Inside MyEclipse IDE, please add 'javaee.jar' in your Project's build-path. This will solve your mentioned error about "request.setCharacterEncoding("UTF-8") "

Usually, during run-time (within web-server container) this jar will be already in classpath. But during development inside IDE, you may face this compile time error.

You will find this JAR at path depending upon your installation path:For example,

C:\MyEclipse6.0\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820\data\libraryset\EE_5
lucentmind