【发布时间】:2023-04-05 21:59:01
【问题描述】:
在一个jsp页面中说x.jsp,我有
if (some task =true)
{
//show xml at run time
List <User_Registration> list = dao.selectemailmobile(login); //here m getting data from Db and m getting it perfectly alright
response.sendredirect("page.jsp?list="+list)
//i wanted to pass this list parameter as List<Bean> list=List<Bean>();
//this page will show xml at run time
}
else
{
//some status code
//this working fine
}
我尝试了什么
1.将此(列表)参数作为我显示的列表传递,但是当我检索它时,它会说
cannot cast from string to List<Bean>
为此,我也尝试输入强制转换,但没有任何反应。
2.在 session 中设置该列表
unchecked cast from object to List<Bean>
3.使用请求调度器
i get same cannot cast from string to List<Bean>
我的那个 xml 页面的代码
<%@ page language="java" contentType="text/xml; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="com.xml.*" %>
<%@page import="com.beans.*" %>
<%@page import="java.util.*" %>
<%@page import="com.xml.ForgotPasswordXml"%>
<%!java.util.List<User_Registration> list= null; %>
<%try{
HttpSession session2=request.getSession();
System.out.println("hii");
list=(List<User_Registration>)request.getAttribute("list");
//list=(java.util.List<User_Registration>)request.getParameter("list");
System.out.println(list.toString());
}catch(Exception e)
{
e.printStackTrace();
}
%>
<%=ForgotPasswordXml.xml(list)%>
任何帮助将不胜感激。谢谢
【问题讨论】: