jsp页面使用传参的java步骤 页面报500错
jsp页面使用传参的java方法 页面报500错
在做项目时,页面的所有参数是从java文件得到的
java文件为 Constant.java 该类里面定义了内部类Propertypright
jsp页面进行调用
如上 页面自身并未报错,但是在左边项目jsp上出现红色小×
在浏览器上点击跳转出现如下错误
对此表示很纠结~~ 有人遇到过没有哦~~
------解决方案--------------------
使用s标签:
或者直接JSP:
------解决方案--------------------
类实例化过了吗?
表示没这么用过啊。
------解决方案--------------------
struts2和java代码貌似不可以直接套用吧
------解决方案--------------------
建议检查你的那个有红色x的jsp。解决了之后再访问
------解决方案--------------------
编译出错了。。
在做项目时,页面的所有参数是从java文件得到的
java文件为 Constant.java 该类里面定义了内部类Propertypright
public static final class Propertypright{
public static final String js = "01"; //局属
public static final String yhmr = "02";//用户默认
public static final String jus="局属";
public static final String yonghmr="用户默认";
public static final String print(String num) { //num用于判断是否选中该项
String seljs= "";
String selyhmr = "";
StringBuffer sb = new StringBuffer();
if(num.equals(js)){
seljs = "selected='selected'";
}else if(num.equals(yhmr)){
selyhmr ="selected='selected'";
}
sb.append(" <option value='"+js+"' "+seljs+">" +jus+"</option>");
sb.append("<option value='"+yhmr+"' "+selyhmr+">" +yonghmr+"</option>");
return sb.toString();
}
}
jsp页面进行调用
<td>产权:</td>
<td>
<select name="wattmeter.propertyright">
<%=Constant.Propertypright.print("%><s:property value="wattmeter.propertyright"/> <%")%>
</select>
</td>
如上 页面自身并未报错,但是在左边项目jsp上出现红色小×
在浏览器上点击跳转出现如下错误
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 88 in the jsp file: /page/archives/wattMeter/wattMeterUpdate.jsp
对此表示很纠结~~ 有人遇到过没有哦~~
------解决方案--------------------
使用s标签:
<s:property value="@类路径.Constant.Propertypright@print(wattmeter.propertyright)"/>
或者直接JSP:
<%=Constant.Propertypright.print(((强制转换属性类型)request.getAttribute("wattmeter")).getPropertyright())%>
------解决方案--------------------
类实例化过了吗?
表示没这么用过啊。
------解决方案--------------------
struts2和java代码貌似不可以直接套用吧
------解决方案--------------------
建议检查你的那个有红色x的jsp。解决了之后再访问
------解决方案--------------------
编译出错了。。