Java http请求后重新导入jsp文件
我想重定向到doPost中的jsp文件,doPost是我的jsp文件位置Java http请求后重新导入jsp文件,java,jsp,Java,Jsp,我想重定向到doPost中的jsp文件,doPost是我的jsp文件位置 -WEB-INF ---jsp -----transaction.jsp 和doPost: 使用-GetContextFile获取文件路径: 文件的路径为http://someDomainIcantShow.com/usr/IBM/WebSphere/wp_profile/installedApps/appID/ServletsPEAR.ear/ServletsP.war/WEB-INF/jsp/Transaction.
-WEB-INF
---jsp
-----transaction.jsp
和doPost:
使用-GetContextFile获取文件路径:
文件的路径为http://someDomainIcantShow.com/usr/IBM/WebSphere/wp_profile/installedApps/appID/ServletsPEAR.ear/ServletsP.war/WEB-INF/jsp/Transaction.jsp
正如预期的那样,但我仍然收到404错误。因此我使用RequestDispatcher使用forward方法进行重新设置。是否使用ear/ServletsP.war中的jsp重定向?不,这是我的问题。为什么不使用response.sendRedirectjsp?
String path = getContecxFile(m_TRANSACTION_JSP);
try {
response.sendRedirect(path);
} catch (IOException e) {
// TODO Auto-generated catch block
MLogger.error("fali to init transaction", m_className);
}
private String getContecxFile(String jsp) {
ServletContext context = getServletContext();
String fullPath = context
.getRealPath("/WEB-INF/jsp/" + jsp);
return fullPath;
}