当前位置: 代码迷 >> Java Web开发 >> jsp`路径好像错了`哪位高手帮小弟我看看`
  详细解决方案

jsp`路径好像错了`哪位高手帮小弟我看看`

热度:719   发布时间:2016-04-13 22:40:37
jsp`路径好像错了``谁帮我看看``
如题找不到路径``如下图报错(其他的链接都可以)

<dl class="leftmenu">
<dd><div class="title"><span><img src="<%=basePath%>/images/leftico01.png" /></span>公司管理</div>
      <ul class="menuson">
        <li class="active"><cite></cite><a href="<%=basePath%>/mycompany/company.action" target="rightFrame">公司信息管理</a><i></i></li>
      </ul>
    </dd> 
<dd><div class="title"><span><img src="<%=basePath%>/images/leftico02.png" /></span>发票管理</div>
      <ul class="menuson">
      <li><cite></cite><a href="<%=basePath%>/mycharge/charge.action" target="rightFrame">收费单管理</a><i></i></li>
        <s:if test="#session.SESSION_USER.level != 2">
          <li><cite></cite><a href="<%=basePath%>/myinvoice/invoice.action" target="rightFrame">发票信息管理</a><i></i></li>
        </s:if>
        <li><cite></cite><a href="<%=basePath%>/mytoll/toll.action" target="rightFrame">发票收费管理</a><i></i></li>
         <li><cite></cite><a href="<%=basePath%>/mytransfer/transfer.action" target="rightFrame">移交发票管理</a><i></i></li>
      </ul>
    </dd> 

这个是JSP的
下面是要跳转的页面
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
  String basePath = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="<%=basePath%>/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=basePath%>/css/pagination.css" />
<script type="text/javascript" src="<%=basePath%>/js/jquery.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/jquery.pagination.js"></script>

<script type="text/javascript">
var bool =false;
 function initPage()
  {
var opt = {callback: pageselectCallback};
opt['items_per_page']=<s:property value="pager.everyPage"/>;
    opt['current_page']=<s:property value="pager.currentPage"/>;
    opt['num_display_entries']=5;
    opt['num_edge_entries']=1;
    opt['prev_text']='上一页';
    opt['next_text']='下一页';
    var htmlspecialchars ={ "&":"&amp;", "<":"&lt;", ">":"&gt;", '"':"&quot;"}
    $.each(htmlspecialchars, function(k,v){
        opt.prev_text = opt.prev_text.replace(k,v);
        opt.next_text = opt.next_text.replace(k,v);
    })
    return opt;
  }

 $(document).ready(function()
  {
      var opt = initPage();
      $("#Pagination").pagination(<s:property value="pager.totalCount"/>, opt);
  });

 function pageselectCallback(page_index, jq){
   if(bool)
 {
     window.location.href='<%=basePath%>/mycharge/charge.action?pager.everyPage=<s:property value="pager.everyPage"/>&pager.currentPage='+page_index;
 }
 bool =true;//设置临时变量 否则会进入死循环中
 return false;
}
 
function edit(invoiceid)
{
   window.location.href="<%=basePath%>/mycharge/charge!manager.action?invoiceid="+invoiceid;
}
function comfirm(invoiceid)
{
   window.location.href="<%=basePath%>/mycharge/charge!comfirm.action?invoiceid="+invoiceid;
}
function change(invoiceid)
{
   window.location.href="<%=basePath%>/mycharge/charge!change.action?invoiceid="+invoiceid;
}
var msg = '<s:property value="msg"/>';
if (msg != '') {
alert(msg);
}
</script>

</head>
<body>
<div class="place">
<span>位置:</span>
<ul class="placeul">
<li><a href="#">首页</a></li>
<li><a href="#">发票管理</a></li>
<li><a href="#">发票收费管理</a></li>
</ul>
</div>

<div class="rightinfo">
<table class="tablelist">
<thead>
<tr>
<th>序号<i class="sort"><img src="<%=basePath%>/images/px.gif" /></i></th>
<th>企业名称</th>
<th>收款项</th>
<th>到期时间目</th>
<th>付款方式</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<s:iterator id="invoice" value="invoices" status="rowNum">
<tr>
<td><s:property value="#rowNum.index + 1"/></td>
<td><s:property value="#invoice.tbCompany.companyname"/></td>
<td><s:property value="#invoice.payItem"/></td>
<td><s:property value="#invoice.tbCompany.companydate"/></td>
<td><s:if test="#invoice.payWay==1">转账</s:if><s:else>现金</s:else></td>
<td><s:date name="#invoice.createdate" format="yyyy-MM-dd"/></td>
<td>
 <s:if test="#invoice.tbUser == null">
 
   <a href="javascript:void(0)" class="tablelink" onclick="edit('<s:property value="#invoice.invoiceid"/>')">修改</a>
    <s:if test="#session.SESSION_USER.level != 2">
   <a href="javascript:void(0)" class="tablelink" onclick="comfirm('<s:property value="#invoice.invoiceid"/>')">确认收款</a>
   </s:if>
   <a href="javascript:void(0)" class="tablelink" onclick="change('<s:property value="#invoice.invoiceid"/>')">客户信息变更</a>
  
  </s:if>
  <s:else>移交状态中...</s:else>
</td>
</tr>
</s:iterator>
</tbody>
</table>

<div class="pagin">
    <div id="Pagination" class="pagination"></div>
    <div class="message">共&nbsp;<i class="blue"><s:property value="pager.totalCount"/>&nbsp;</i>条记录,当前显示第&nbsp;<i class="blue"><s:property value="pager.currentPage + 1"/>&nbsp;</i>页</div>
</div>
</div>
<script type="text/javascript">
$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
  
    <package name="chargePack" namespace="/mycharge" extends="oa_default" >
     <action name="charge" class="chargeAction">
     <result name="input">/WEB-INF/jsp/charge/main.jsp</result>
     </action>
    </package>
    
</struts>

上面这个是struts的配置
下面是ACTION
package com.esp.db.web.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import com.esp.db.dao.jpa.base.Criteria;
import com.esp.db.dao.jpa.base.Restrictions;
import com.esp.db.service.base.CompanyRepository;
import com.esp.db.service.base.InvoiceRepository;
import com.esp.db.service.pojo.TbCompany;
import com.esp.db.service.pojo.TbInvoice;
import com.esp.db.service.pojo.TbUser;
import com.esp.db.web.base.action.BaseAction;
import com.opensymphony.xwork2.Action;

@SuppressWarnings("all")
public class ChargeAction extends BaseAction{
private TbInvoice invoice;

private long invoiceid;

private List<TbInvoice> invoices = new ArrayList<TbInvoice>();

private List<TbUser> users = new ArrayList<TbUser>();

@Autowired
private InvoiceRepository invoiceRepository;

public String execute()
{
TbUser temp = (TbUser) this.sessionMap.get("SESSION_USER");
Criteria<TbInvoice> c = new Criteria<TbInvoice>();

int currentPage = pager.getCurrentPage();// 当前页数
int pageSize = pager.getEveryPage();
Pageable pageable = new PageRequest(currentPage, pageSize);
c.add(Restrictions.desc("createdate", null, true));
if (temp.getLevel().equals("2"))
{
c.add(Restrictions.eq("tbCompany.tbUser.userid", temp.getUserid(), true));
}
c.add(Restrictions.ne("state", "1", true));
Page<TbInvoice> page = this.invoiceRepository.findAll(c, pageable);
invoices = page.getContent();
pager.setTotalCount((int) page.getTotalElements());

return Action.INPUT;
}

public String manager()
{
this.invoice = this.invoiceRepository.findOne(this.invoiceid);
return Action.SUCCESS;
}

public String change()
{
this.invoice = this.invoiceRepository.findOne(this.invoiceid);
users = getBaseService().find("from TbUser where level = '2' and userid !=" + invoice.getTbCompany().getTbUser().getUserid());
return "change";
}

public String commitChange() throws Exception
{
TbInvoice tbInvoice = this.invoiceRepository.findOne(invoice.getInvoiceid());
tbInvoice.setTbUser(invoice.getTbUser());
this.getBaseService().save(tbInvoice);
return this.execute();
}

public String comfirm() throws Exception
{
this.invoice = this.invoiceRepository.findOne(this.invoiceid);
invoice.setState("1");
this.getBaseService().save(invoice);
return this.execute();
}

public String commit() throws Exception
{
TbInvoice tbInvoice = this.invoiceRepository.findOne(invoice.getInvoiceid());
tbInvoice.setPayWay(invoice.getPayWay());
this.getBaseService().save(tbInvoice);
return this.execute();
}

public TbInvoice getInvoice()
{
return invoice;
}

public void setInvoice(TbInvoice invoice)
{
this.invoice = invoice;
}

public long getInvoiceid()
{
return invoiceid;
}

public void setInvoiceid(long invoiceid)
{
this.invoiceid = invoiceid;
}

public List<TbInvoice> getInvoices()
{
return invoices;
}

public void setInvoices(List<TbInvoice> invoices)
{
this.invoices = invoices;
}

public List<TbUser> getUsers()
{
return users;
}

public void setUsers(List<TbUser> users)
{
this.users = users;
}


}

最后截一张大概框架求大大帮忙

------解决思路----------------------
struts里的jsp路径给错了,不要加web-inf这一层
------解决思路----------------------
在result里的地址/WEB-INF前加上两个.试试,当前路径应该是在namespace下的

------解决思路----------------------
你要通过action 然后返回到jsp页面啊  不能直接访问jsp的  
你这样访问不到不说,就算能访问到也没值
通过对应的action 方法 return "sucess"
配置
 <result name="success">/WEB-INF/jsp/charge/main.jsp</result>
不要用name="input"   出现参数类型异常或者验证错误的时候才会跳转到input对应的页面
------解决思路----------------------
引用:

解决了····action跳转web-inf··的问题···要重新部署一下就行了···

除了修改的是页面文件,修改其他的类文件或者配置文件都需要redeploy的才能生效吧。。。
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!