刚学ssh框架做了一个项目 jsp页面无法获取action的值,求教啊。。。以下是代码
  页面都正常跳转 就是取不到值 用的是iframe框架
  main.jsp可以获取,不过main.jsp指向的top.jsp页面无法获取值
  Action部分代码    
  private static final long serialVersionUID = 1L;  
  private UserService userService;  
  private User user;    
  public String login(){        
  List<User> list=new ArrayList<User>();
 list=userService.login(user);      
   if(list.size()>0){           
      return  SUCCESS;      
      }else{            
      return ERROR;         
          } 
    }

        public User getUser() {         
         return user;   
    }

        public void setUser(User user) {        
             this.user = user;  
       }

       jsp页面获取值部分(top.jsp)

        <td width="59%" valign="bottom"><div align="center"
       class="STYLE1">当前用户:${user.username}</div></td>

       struts配置文件 
<struts>    
    <package name="ngbaojia" namespace="/" extends="struts-default">
           <action name="login"  class="UserAction"  method="login">
             <result name="success">main.jsp</result>
             <result name="error">login.jsp</result>
            </action>
        </package> 
</struts>
suannai0314
鹳狸媛 楼主的这个问题解决了么?下边的答案能解决问题么?如果可以麻烦点击答案旁的√采纳哦~如果没有也可以将自己的答案贴上然后进行采纳的。
大约 6 年之前 回复

3个回答

最近刚刚也遇到了这个问题 根本原因是请求的action到达main.jsp页面之后这个请求就已经结束 加载top.jsp时其实是从新发起了页面请求 这个请求已经与之前的action无关 返回的只是是top页面

虽然没明白你的意思
但是初步看了下
main.jsp可以获取
top.jsp页面无法获取值

<action name="login"  class="UserAction"  method="login">
         <result name="success">main.jsp</result>//肯定只认 main.jsp
         <result name="error">login.jsp</result>
        </action>

楼主请说清楚

charmingyb
charmingyb 谢谢您的回答,main.jsp是frame框架,包括top.jsp,left.jsp....等等,我想在top.jsp里面获取东西,之前没有找到办法,现在找到了,frame可以这样传递参数document.write("<frame src='top.jsp?para=<%=user.getUsername() %>' scrolling='No' noresize='noresize' id='topFrame' />");
大约 6 年之前 回复

如果上面就是你要的解决方法,而且已经解决了问题的话,那我就不发表意见了!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SSH框架jsp页面与Action的值传递
jsp页面 &lt;ahref="xx.action?userName=xx"xx.action里面 privateStringuserName publicvoidsetUserName(StringuserName){ this.userName=userName; } publicStringgetUsername(){ returnusername ...
jsp页面无法获取action参数
我用的是struts2 action中有参数message(action中有对应的get方法) 成功登陆后页面中我用$message来显示登陆成功的信息 可是发现都接收不到 希望高手能够帮忙解决下!rn这是我的actionrnpackage action;rnrnimport javax.servlet.http.HttpSession;rnrnimport org.apache.struts2.ServletActionContext;rnrnimport manager.UserManager;rnimport model.User;rnrnimport com.opensymphony.xwork2.ActionSupport;rnrnpublic class UserAction extends ActionSupportrnrn private String username;rn private String password;rn private UserManager userManager;rn private String message;rn private User user;rnrn public void setUserManager(UserManager userManager) rn this.userManager = userManager;rn rn public void setUsername(String username) rn this.username = username;rn rn public void setPassword(String password) rn this.password = password;rn rn public String getMessage() rn return message;rn rn public User getUser() rn return user;rn rn public String login()rn rn User user = userManager.login(username, password);rn if (user==null) rn message="用户名或密码错误";rn return INPUT;rn rn HttpSession session = ServletActionContext.getRequest().getSession();rn session.setAttribute("user", user);rn this.user= user;rn return SUCCESS;rn rnrn这是我的struts.xml文件rnrnrnrn rn rn rn rn /user/success.jsprn /login.jsprn rn rn rn
SSH框架不进action是怎么回事啊?
在学校好好的,然后把项目拿到公司里面来然后就不进action了rn下面是部分代码,麻烦各位大神帮忙分析一下。。。rnaction代码:rn[code=java]rnpublic String login() rn System.out.println("----->+进来了么?");rn userVo.setMess(null);rn rn // request对象rn HttpServletRequest request = ServletActionContext.getRequest();rnrn try rn User user = ub.login(userVo.getUser());rnrnrn if (user != null) rn rn request.getSession().setAttribute(Const.USER, user);rn rn return Action.SUCCESS;rn else rn userVo.setMess("登陆失败!");rn return Action.INPUT;rn rn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn return Action.ERROR;rn rn[/code]rnstruts配置文件代码:rn[code=java]rnrn rn rn rn /selbyid.html?pageIndex=1&sel=uprn /login.jsprn rn[/code]rn前台form代码:rn[code=java]rnrn[/code]
action如何获取JSP页面的值?
用的struts2 框架rnj1.jsp form 的input框里 hidden 一个属性str 并且 include j2.jsprnj1 和 j2 都有各自的formrnj2.jsp 提交按钮到 actionrnrn请问在action里 如何拿到 j1.jsp里的str?rnrequest.getParameter("str") 好像拿不到
跪求 SSH框架 action接不到JSP页面的值
以下是 action的 代码rnrnpackage com.tc.test.action;rnrnimport java.io.File;rnimport java.io.IOException;rnimport java.util.ArrayList;rnimport java.util.List;rnrnimport org.apache.struts2.ServletActionContext;rnrnimport com.bj.framework.action.BaseAction;rnimport com.tc.test.bo.UploadFile;rnimport com.tc.test.service.IUploadService;rnrnpublic class TestUploadAction extends BaseActionrn //service 模型rn private IUploadService uploadServiceImpl;rn //上传文件存放路径rn private String path="f:/file";rn //uploadFile实体类rn private UploadFile uploadFile;rn //上传文件集合rn private List upload=new ArrayList();rn //上传文件名集合rn private List uploadFileName;rn //上传文件类型集合rn private List uploadContentType;rnrn public String add() rn try rn rn uploadServiceImpl.saveUploadFile(uploadFile,getPath(),upload,uploadContentType,uploadFileName);rn catch (Exception e) rn e.printStackTrace();rn rn return "requery";rn rn rn public String query()rn list=this.uploadServiceImpl.findAll();rn return "query";rn rn rn public String addPage()rn return "addPage";rn rn rn public IUploadService getUploadServiceImpl() rn return uploadServiceImpl;rn rn public void setUploadServiceImpl(IUploadService uploadServiceImpl) rn this.uploadServiceImpl = uploadServiceImpl;rn rnrn public String getPath() rn return path;rn rnrn public void setPath(String path) rn this.path = path;rn rnrn public UploadFile getUploadFile() rn return uploadFile;rn rnrn public void setUploadFile(UploadFile uploadFile) rn this.uploadFile = uploadFile;rn rnrn public List getUpload() rn return upload;rn rnrn public void setUpload(List upload) rn this.upload = upload;rn rnrn public List getUploadFileName() rn return uploadFileName;rn rnrn public void setUploadFileName(List uploadFileName) rn this.uploadFileName = uploadFileName;rn rnrn public List getUploadContentType() rn return uploadContentType;rn rnrn public void setUploadContentType(List uploadContentType) rn this.uploadContentType = uploadContentType;rn rnrnrnrnrn以下是JSP页面的代码rnrn<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>rn<%@ taglib prefix="s" uri="/struts-tags"%>rn<%rnString path = request.getContextPath();rnString basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";rn%>rnrnrnrn rn rn rn 文件上传rn rn rn rn rn rn rn rn rn rn rn rn 上传文件rn rn rn rn 上传人rn rn rn rn rn rn 文件rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn以下是实体的内容 所有属性都已经set get application和struts也已经配置 rnrnpackage com.tc.test.bo;rnrnimport java.util.Date;rnrn/**rn * Dic entity. @author MyEclipse Persistence Toolsrn */rnrn@SuppressWarnings("serial")rnpublic class UploadFile implements java.io.Serializable rnrn // Fieldsrn private String uploadId;rn private String uploadPerson;rn private String uploadFileName;rn private String uploadPath; rn private String uploadContentType;rn private Date uploadTime;rn rn //constructorrn public UploadFile() rn rn rn //methodsrn public String getUploadId() rn return uploadId;rn rn public void setUploadId(String uploadId) rn this.uploadId = uploadId;rn rn public String getUploadPerson() rn return uploadPerson;rn rn public void setUploadPerson(String uploadPerson) rn this.uploadPerson = uploadPerson;rn rn public String getUploadFileName() rn return uploadFileName;rn rn public void setUploadFileName(String uploadFileName) rn this.uploadFileName = uploadFileName;rn rn public String getUploadContentType() rn return uploadContentType;rn rn public void setUploadContentType(String uploadContentType) rn this.uploadContentType = uploadContentType;rn rn public Date getUploadTime() rn return uploadTime;rn rn public void setUploadTime(Date uploadTime) rn this.uploadTime = uploadTime;rn rnrn public String getUploadPath() rn return uploadPath;rn rnrn public void setUploadPath(String uploadPath) rn this.uploadPath = uploadPath;rn rn
跪求,SSH框架 action 接不到JSP页面的值
以下是 action的 代码
求问ssh框架中jsp页面传给action指定方法,action无法自动获取
求问ssh框架中jsp页面传给action指定方法,action无法自动获取,jsp中name也指定了,action无法get到textfiled传进去的值
SSH jsp页面得不到Action的值!急
RT.为什么呀?rnrn调试的时候我看employeelist中是有值的.rnSystem.out.println(employeelist.size()); 这句输出1了 说明有值rn但是在jsp页面我用的rnrn rn/s:iterator> rnrn输出为0 说明没有得到.rnrn高手帮一下!谢谢了!rnrnrn=================Action方法rn public List employeelist;rnrn public List getEmployeelist() rn return employeelist;rn rnrn public void setEmployeelist(List employeelist) rn this.employeelist = employeelist;rn rnrn public String list_Emp() rn tryrn //employeelist=new ArrayList();rn employeelist=(List)employeeManager.getEmps(); //返回employee表的数据.rn System.out.println(employeelist.size());rn catch (Exception e) rn System.out.println(e.toString());rn finally rn return SUCCESS;rn rn rn
ajax可以获取action得值,action无法获取ajax得值
![图片说明](https://img-ask.csdn.net/upload/201905/25/1558795199_996063.png)rn![图片说明](https://img-ask.csdn.net/upload/201905/25/1558795217_560805.png)rnrnrn简单描述rnajax与struts得传值问题rnajax可以从后台action取值rn但是后台接收不到ajax发过来得值,显示为nullrnrnrn如图,三个弹窗rn弹窗1,打印前台中employeeNo2得值,成功打印rn弹窗2,打印从后台获取得数据值,成功打印rn弹窗3,打印从后台获取employeeNo2得值,NULLrnrnaction中得两个输出均为nullrnrn--------------------------------------------------rnajax可以从action取值,rn说明struts配置没有问题,action也好好执行了rnrn试过好几种ajax传值书写格式,均为nullrnrn十分不解,求问
新手刚学习玩SSH框架,一个SSH的项目
各位大神,小弟学完SSH框架。这个天想研究一下基于SSH框架完成的项目来提高一下。求大神给点资源,小弟万分感激。。
action取不到jsp页面的值,求教
rn[b]Action:[/b]rnpublic class UserAction extends ActionSupportrn private static final long serialVersionUID = 1L;rn private String name;rn public String add() throws Exception rn // TODO Auto-generated method stubrn System.out.println("name="+name);rn return SUCCESS;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rnrnrn[b]jsp页面[/b]rnrn aaarn rn rn rn rnrn rnrn[b]struts.xml:[/b]rnrnrn rn rn rn rn rn rn /1_2.jsprn rn rn rnrnrn那个超链接可以取到值,form不管是从text中取值还是直接把值写到form的action属性里,全部取不到值rn超链接打印输出name=aaa,form打印输出name=nullrnrn求教
jsp页面无法获取action传来的session
//登录rn public ActionForward doLogin(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response)throws IOException rn UserForm userForm = (UserForm) form;rn UserInfo ui=userForm.getUserInfo();rn ui=ub.login(ui.getDyzh(), ui.getPwd());rn session=request.getSession();rn session.setAttribute("current_user", ui);rn request.setAttribute("if_user", "yes");rn return mapping.findForward("updatePwd");rnrn rnrn//修改密码rn public ActionForward doUpdatePwd(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response)throws IOExceptionrn rn UserForm userForm = (UserForm) form;rn UserInfo ui=userForm.getUserInfo();rn UserInfo ui2=ub.getUserByNamePwd(ui.getDyzh(), ui.getPwd());rn ub.updatePwd(ui.getDyzh(), ui.getNewPwd());rn ub.updateState(ui.getDyzh(),1);rn UserInfo ui3=(UserInfo)session.getAttribute("current_user");rn ui3.setPwd(ui.getNewPwd());rn ui3.setState(1);rn session.setAttribute("current_user", ui3);rn return mapping.findForward("main");rn rn rnrnrn上面两个方法是action里的方法,由上可知:rn在登录方法里,我创建了session.setAttribute("current_user", ui);rn在修改密码方法里,我为session赋了新值session.setAttribute("current_user", ui3);rn然后转发到main.jsp页面:return mapping.findForward("main");rn可是我在main.jsp页面里却无法获得session:session.getAttribute("current_user")rn为什么?rn
SSH框架Action中Service无法注入?
[img=https://img-bbs.csdn.net/upload/201707/05/1499223836_103737.png][/img]rnrnBookAction.javarnpackage com.it.action;rnrnimport javax.annotation.Resource;rnrnimport org.apache.struts2.convention.annotation.Action;rnimport org.apache.struts2.convention.annotation.Namespace;rnimport org.apache.struts2.convention.annotation.ParentPackage;rnimport org.apache.struts2.convention.annotation.Result;rnrnimport org.springframework.context.annotation.Scope;rnimport org.springframework.stereotype.Controller;rnrnimport com.it.po.BookInfo;rnimport com.it.po.PageInfo;rnimport com.it.service.BookService;rnrn/**rn *rn * @author adminrn *rn */rn@Controller(value="bookAction")rn@Scope(value="prototype")rn@Namespace(value="/book")rn@ParentPackage(value="struts-default")rnpublic class BookAction rn @Resource(name="bookService")rn private BookService bookService;rn rn private PageInfo page;rn private BookInfo book;rnrn @Action(value="findPage", results=rn @Result(location="/show.jsp")rn )rn //showrn public String findBook()rn if(page==null)rn page=new PageInfo();rn page.setCp(1);rn rn page.setPs(5);rn System.out.println("---service---"+bookService);rn page=bookService.findPage(page);rn return "success";rn rn @Action(value="addBook",results=rn @Result(type="redirect",location="/book/findPage")rn )rn //保存rn public String saveBook()rn bookService.save(book);rn return "success";rn rn rn rnrnrnBaseDao.javarnpackage com.it.dao;rnrnimport com.it.po.PageInfo;rnrn/**rn * rn * @author adminrn *rn */rnpublic interface BaseDao rn PageInfo findPage(int cp,int ps,String hql,Object...values);rn void saveEntity(Object obj);rnrnrnrnBaseDaoImp.javarnpackage com.it.dao.imp;rnrnimport java.util.List;rnrnimport org.hibernate.HibernateException;rnimport org.hibernate.Query;rnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.orm.hibernate4.HibernateCallback;rnimport org.springframework.orm.hibernate4.support.HibernateDaoSupport;rnimport org.springframework.stereotype.Repository;rnrnimport com.it.dao.BaseDao;rnimport com.it.po.BookInfo;rnimport com.it.po.PageInfo;rn@Repository("baseDaoImp")rnpublic class BaseDaoImp extends HibernateDaoSupport implements BaseDao rn rn @Autowiredrn public void setSupportSessionFactory(SessionFactory sessionFactory) rn super.setSessionFactory(sessionFactory);rn rn rn @Overridern public PageInfo findPage(int cp, int ps, String hql, Object... values) rn // TODO Auto-generated method stubrn //获取session对象rn return this.getHibernateTemplate().executeWithNativeSession(new HibernateCallback() rnrn @Overridern public PageInfo doInHibernate(Session session) throws HibernateException rn // TODO Auto-generated method stubrn //查询业务rn String hql_list=hql.substring(hql.indexOf("from"));rn Query query_total=session.createQuery(hql);rn Query query_list=session.createQuery(hql_list);rn if(values!=null&&values.length>0)rn for(int i=0;i books=query_list.list();rn Long totalRec=(Long) query_total.uniqueResult();rn PageInfo page=new PageInfo(cp, ps, totalRec, books);rn rn rn rn rn return page;rn rn );rnrnrnBookDaoImp.javarnrnpackage com.it.dao.imp;rnrnimport org.springframework.stereotype.Repository;rnrn@Repository("bookDaoImp")rnpublic class BookDaoImp extends BaseDaoImprnrnrnrnBookInfo.javarnrnpackage com.it.po;rnrnrnimport javax.persistence.Column;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.GenerationType;rnimport javax.persistence.Id;rnimport javax.persistence.SequenceGenerator;rnimport javax.persistence.Table;rnrnimport org.springframework.stereotype.Repository;rnrn/**rn * 数据持久层rn * @author adminrn *rn */rn@Repositoryrn@Table(name="bookinfo")rnpublic class BookInfo rn @Idrn @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="book")rn @SequenceGenerator(name="book",sequenceName="seq")rn @Column(name="b_id")rn private Long bid;rn @Column(name="b_name")rn private String bname;rn @Column(name="b_price")rn private Long bprice;rn @Column(name="b_no")rn private Long bno;rn public Long getBid() rn return bid;rn rn public void setBid(Long bid) rn this.bid = bid;rn rn public String getBname() rn return bname;rn rn public void setBname(String bname) rn this.bname = bname;rn rn public Long getBprice() rn return bprice;rn rn public void setBprice(Long bprice) rn this.bprice = bprice;rn rn public Long getBno() rn return bno;rn rn public void setBno(Long bno) rn this.bno = bno;rn rn public BookInfo(Long bid, String bname, Long bprice, Long bno) rn super();rn this.bid = bid;rn this.bname = bname;rn this.bprice = bprice;rn this.bno = bno;rn rn public BookInfo() rn super();rn // TODO Auto-generated constructor stubrn rn rnrnrnrnPageInfo.javarnpackage com.it.po;rnrnimport java.util.List;rnrn/**rn * 页码数据持久层rn * @author adminrn *rn */rnpublic class PageInfo rn private int cp;rn private int ps;rn //注意:totalRec必须是Long类型的数据rn private Long totalRec;rn private List list;rn private Long getTotalPage()rn return (totalRec-1)/ps+1;rn rn //get、set方法rn public int getCp() rn return cp;rn rn public void setCp(int cp) rn this.cp = cp;rn rn public int getPs() rn return ps;rn rn public void setPs(int ps) rn this.ps = ps;rn rn public Long getTotalRec() rn return totalRec;rn rn public void setTotalRec(Long totalRec) rn this.totalRec = totalRec;rn rn public List getList() rn return list;rn rn public void setList(List list) rn this.list = list;rn rn rn public PageInfo(int cp, int ps, Long totalRec, List list) rn super();rn this.cp = cp;rn this.ps = ps;rn this.totalRec = totalRec;rn this.list = list;rn rn public PageInfo() rn super();rn // TODO Auto-generated constructor stubrn rn rnrnrnrnBookService.javarnrnpackage com.it.service;rnrnimport javax.annotation.Resource;rnimport javax.transaction.Transactional;rnrnrnimport org.springframework.stereotype.Service;rnrnimport com.it.dao.imp.BookDaoImp;rnimport com.it.po.BookInfo;rnimport com.it.po.PageInfo;rnrn@Service("bookService")rnpublic class BookService rn @Resource(name="bookimp")rn private BookDaoImp bookimp;rn rn //查询rn public PageInfo findPage(PageInfo pageinfo)rn String hql="select count(*) from BookInfo";rn return bookimp.findPage(pageinfo.getCp(), pageinfo.getPs(), hql);rn rn @Transactionalrn //保存rn public void save(BookInfo book)rn bookimp.saveEntity(book);rn rn rn rnrnrn配置文件rn[img=https://img-bbs.csdn.net/upload/201707/05/1499224238_672902.png][/img]rnrnapplication.xmlrnrn rn rn rn rn rn rn rn rn rn rn rn rn 1rn 20rn 1800rn 2rn 0rn 2rn 1800rn 30rn truern falsern rn rn rn rn rn rn rn org.springframework.orm.hibernate4.SpringSessionContextrn rn truern rn org.hibernate.dialect.OracleDialectrn rn truern rn rn rn rn rn com.it.porn rn rn rn rn rn rn rn rn rn rnrnrnrn页面.jsp文件rn[img=https://img-bbs.csdn.net/upload/201707/05/1499224471_462501.png][/img]rnrnrn运行结果:rn七月 05, 2017 10:58:12 上午 org.apache.jasper.compiler.TldLocationsCache tldScanJarrn信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.rn---service---nullrnrnrn页面显示错误:rnStruts Problem ReportrnrnStruts has detected an unhandled exception:rnrnMessages: rnFile: com/it/action/BookAction.javarnLine number: 44rnStacktracesrnrnjava.lang.NullPointerExceptionrn com.it.action.BookAction.findBook(BookAction.java:44)rn
jsp页面通过request.put(list)获取action的值
[b]Action部分: [/b]rnrnMap request = (Map) ActionContext.getContext().get("request");rn List list = productService.list();rn //测试有没有值过来rn for (Product product : list) rn System.out.println(product.getName());rn rn //发送至jsprn request.put("list", list);rn return "success";rn[b]Jsp页面部分:[/b]rn//s标签rn<%@ taglib prefix="s" uri="/struts-tags"%>rnrnrn rn rn rn rn rn rnrn rn rn[b]Struts.xml部分:[/b]rn rn /admin/adminproduct.jsprnrnrnrn第一次发帖,大家多多指教;rn这次是在作业过程发现一个bug,苦苦查询无解,老师非常cai,ssh整合讲了一点皮毛就结课了;rn作业全程百度+回顾以前知识,bug为红色字体部分,[b]必须删除[/b],不然Jsp页面无法显示数据;rn希望各位不吝赐教。
自定义标签怎样获取action或者jsp页面的值
RT 其中value=&quot;m.id&quot;是我的action中的属性
JSP页面获取action传递过来的值
first class: ————————————–actionpublic String getUser(){ List<User> list = userService.finAll(); //ActionContext.getContext().getValueStack().set("list", list.get(0));//引号内的list就是Jsp页面s标签里卖弄的value
SSH框架action中获取服务器端ip,端口,项目名
"http://" + org.apache.struts2.ServletActionContext.getRequest() .getRemoteAddr()    + ":" + org.apache.struts2.ServletActionContext.getRequest() .getServerPort()      + org.apache.struts2.S
SSH框架项目,怎么内部另一个action?
action2的一个方法涉及到一些service的使用,这些service又调用了dao进行hql数据库查询;rn我现在如何在action1(或者随便一个普通类)的一个方法中调用action2的这个方法呢?我直接new了调用的话,action2里面用到的service又需要自己新建,我再手动初始化新建了service,紧接着service用到的dao又需要新建,到最后dao查询数据库时候的hibernate session还是为null,不知道从哪里获取了.rn问题总结起来就是,我之前是用来响应web页面的action逻辑,现在要求socket接收到一个特定指令后也走这个逻辑,可以直接用这个action的逻辑么?还是怎么写?
ssh框架:action重定向
重定向到某个页面:type=”redirect” 重定向到某个action:type=”redirectAction” struts默认的返回值是input,表示出现错误,可以转到错误页面 &amp;lt;action name=&quot;customer_*&quot; class=&quot;customerAction&quot; method=&quot;{1}&quot;&amp;gt; &amp;lt;result name=&quot;input...
SSH框架之Action
package cn.itcast.oa.view.action;import java.util.List;import javax.annotation.Resource;import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller;import cn.i
刚学NET2.0,做了一个简单的小站~
http://www.vanmedia.cn/
刚学数据库,求教
[code=Delphi(Pascal)] rnSQLString :='select * from user_master where a=:a and b=:b';rn sql.add(SQLString);rn parameters.ParamByName('a').Value:=trim(combobox1.Text);rn parameters.ParamByName('b').Value:=trim(edit1.Text);[/code]rn这是判断用户名,密码是否对的代码,其中SQL语句中:a=:a and b=:brnrn=: 这个符号怎么解释?
求教,刚学VB
下午刚看VBrn界面设计和关联都很简单rnrn怎么将VB和SQL2000连接不是很明白rnrn在我的主界面设计了一个控件comobox ,实现能连接到数据库中的具体一张表中的一个字段,在软件运行中点击下拉条,可以选择到数据库中这张表中的所有字段名称rn问题:1、怎么和SQL2000连接rn 2、怎么将这个COMOBOX控件实现字段名称
刚学EJB,求教
在看EJB的书,乐思的,,rn看了一半,好象没什么很深的东东,但好象什么都没看懂,,rn请大侠指教,,,
刚做了一个网站的框架?来看看啊。
不会往下做了。大家参谋一下好吗?成功后一定给分的。rn哪儿不好。多多提点意见。
一个简单的SSH框架项目
13-基于SSH框架的新闻信息发布平台,ssh写的一个比较简单的新闻发布系统,有完整代码
ssh框架项目,一个创业项目
这是一个小型的SSH项目,在其中有管理员,普通用户,专家三个项目。
这是一个ssh框架项目
回访项目,这个项目是做回访用的,是用ssh框架。
SSH一个简单的SSH框架学习项目
一个简单的SSH框架学习项目,大家可以下载看看。
刚学c++ 一串代码编译错误 求教
#include rnusing namespace std;rnint main()rnrn    char ch;rn    ch="A";rn    cout<
刚学DataGrid,抄了段代码求教!
今天刚接触DataGrid,照模样写了段代码,但是提示以下3个错误,实在不解,求教!rnE:\Asp.Net_Home\TyFtp\UserList.aspx.cs(41): “TyFtp.UserList_dg”并不包含对“CurrentPageIndex”的定义rnE:\Asp.Net_Home\TyFtp\UserList.aspx.cs(36): “TyFtp.UserList_dg”并不包含对“DataSource”的定义rnE:\Asp.Net_Home\TyFtp\UserList.aspx.cs(37): 非静态的字段、方法或属性“System.Web.UI.Control.DataBind()”要求对象引用rnrn代码如下!rnrn.aspx代码:rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn.cs代码:rn public class UserList_dg : System.Web.UI.Pagern rn private void Page_Load(object sender, System.EventArgs e)rn rn // 在此处放置用户代码以初始化页面rn if (!IsPostBack) BindGrid();rn rn rn public void BindGrid()rn rn string strconn=ConfigurationSettings.AppSettings["TyConn"];rn SqlConnection conn=new SqlConnection(strconn);rn conn.Open();rn DataSet ds=new DataSet();rn SqlDataAdapter da=new SqlDataAdapter("Select * From UserAccounts",conn);rn da.Fill(ds);rn //绑定rn UserList_dg.DataSource=ds;rn UserList_dg.DataBind();rn rn public void UserList_Page(object sender,DataGridPageChangedEventArgs e)rn rn UserList_dg.CurrentPageIndex = e.NewPageIndex;rn BindGrid();rn
这个jsp页面中的action=j_security_check是怎么回事啊??代码在里面
这是登陆的部分,整个系统用jboss作服务器 rnrnrn CyberTester Loginrn rn rnrnrnrn rnrn Login to CyberTesterrnrn rn rn rn rn User Email : rn rnrn rn Password : rn rnrn rn rn rn rnrnrnrnrn rnrnrnrnrnrnrn rn
struts2框架action获取不到 的值
rn 修改任务rn rn 序号:rn $pro.id rn 任务名称:rn rn 开始时间:rn rn 结束时间:rn rn 责任人:rn rn rn rnrn响应的updateAction 可以获得表单的值 为什么div表单的值无法获得呢???怎也让action获得 表的的$pro.id的值呢??????????????
ssh框架无法获得页面传入的值
我的页面代码是这样的:rn[code=Java]rnrn rn 公告添加rn rn rn rn 添加公告rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rnDAO里的代码是这样的:rn[code=Java]rnpublic void addNotice(AbstractdormNoticeInfo dormNoticeinfo) //添加新的公告rn Session session=getSession();rn Transaction tra=session.beginTransaction();rn System.out.println("dormNotice="+dormNoticeinfo);rn session.save(dormNoticeinfo);rn tra.commit();rn session.close();rn rn rn[/code]rnrn运行结果报错如下:rn[code=Java]rndormNotice=nullrn2010-7-4 9:00:38 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet default threw exceptionrnjava.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entityrn at org.hibernate.event.SaveOrUpdateEvent.(SaveOrUpdateEvent.java:40)rn at org.hibernate.event.SaveOrUpdateEvent.(SaveOrUpdateEvent.java:23)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)rn at com.txsm.crm.dao.impl.DormNoticeDAO.addNotice(DormNoticeDAO.java:20)rn at com.txsm.crm.service.impl.DormService.addNotice(DormService.java:22)rn at com.txsm.crm.action.DormNoticeAction.addNotice(DormNoticeAction.java:34)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rnrn[/code]
学习用ssh框架
初学SSH所需要的包,补足一部分缺少的,最近最新版本的struts,spring,hibernate
action在JSP页面中无法传参
这主要是传入MajorNo来执行删除rn报错:[code=text]org.springframework.dao.InvalidDataAccessResourceUsageException: could not load an entity: [com.jygzxt.po.major.Major#0101]; SQL [select major0_.Major_no as Major1_0_0_, major0_.Major_name as Major2_0_0_, major0_.DeptAdmin_no as DeptAdmin3_0_0_, major0_.DepartAdmin_Name as DepartAd4_0_0_ from jygzxtw.major major0_ where major0_.Major_no=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not load an entity: [com.jygzxt.po.major.Major#0101]rn[/code]rn在JSp页面中:rn
struts1.2 Action无法传值到jsp页面
代码如下rnrnpublic class ListArticleAction extends Actionrn public ActionForward execute(ActionMapping mapping,ActionForm form,rn HttpServletRequest request,HttpServletResponse response)rn Connection conn = null;rn tryrn conn = getDataSource(request,"sqlServer").getConnection();rn articleBean abean = new articleBean();rn abean.setConn(conn);rn List data = abean.ListArticle();rn request.setAttribute("articleList",data);rn return mapping.findForward("success"); rn catch(SQLException e)rn e.printStackTrace();rn return mapping.findForward("failed");rn rn rnrnrnrnrn<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>rn<%@ taglib uri="http://struts.apache.org/tags-bean"prefix="bean" %>rn<%@ taglib uri="http://struts.apache.org/tags-html"prefix="html" %>rn<%@ taglib uri="http://struts.apache.org/tags-logic"prefix="logic" %>rnrnrnrn rn rn rn rn rn rn rn 文章预览rn rn rn rn rn rn rn 编辑rn 删除rn rn rn rn 作者: rn 分类: rn 时间: rn rn rn rn rn 未添文章!rn rn rn rn 增加文章rn rn rn rn rnrnrnrn数据库中已有数据,其它的配置都已完成,但页中查找不到数据库数据。
刚做了个电影项目
我朋友刚做了个电影项目,它把数据库那部分的内容传了给我,但是我不知道怎么安装上去,请前辈指点.谢谢
SSH框架/JSP Servlet 从Action中传递数据到JSP页面
使用 ActionContext进行传值: 例子:public String login({ if(this.userService.loginUser(user)==null||this.userService.loginUser(user).size()==0) { return "fail"; } else{
Struts2下Action得不到JSP页面值
除了属性名称不匹配、Get/Set方法没写之外,还有一种情况会导致Action得不到JSP页面中的值(JSP页面用标签textfield 如:),如果在JSP页面中指定了元素的disable属性为true,Action将不会得到页面中这一元素的值,可以通过readonly属性替代。...
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件