wobencmlz 2015-10-13 07:35 采纳率: 0%
浏览 1704

跪求JSP接口问题。悬赏人民币200元

先有JSP程序,想在JSP程序里面嵌入一段代码,代码是以asp写的。想嵌入到JSP程序中,实现单点登录系统。
jsp 程序如下 :

 <%@ include file="/html/portlet/ext/jsp_portlet/init.jsp"%>
<%@ page import="com.liferay.portal.kernel.dao.jdbc.DataAccess"%>
<%@ page import="com.liferay.portal.kernel.language.LanguageUtil" %>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.File"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>


<%
    String title = LanguageUtil.get(pageContext, "mydocument.head.title");
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName();
%> 
<table width="100%">

    <%
        try
        {
            System.out.println("++++++++++++++++++++++++++File.separator"+File.separator);
            String userid =  String.valueOf(session.getAttribute("USER_ID"));
            String sql ="select  saip_org_util.SetClientInfo(221,"+userid+",1) from dual "; 
            String sql_v="select v.catalogname, v.operatorname, v.processinstname, to_char(v.starttime,'mm-dd,hh24:mi') starttime,v.workitemid,v.CREATOR,substr(v.processinstdesc,1,50) processinstdesc from  saip_wf_todo_list_v v where rownum<=30 order by v.PROCESSDEFID,v.starttime desc ";  
            //System.out.println(sql+"\n"+sql_v);
            Connection conn = DataAccess.getConnection();
            PreparedStatement ps1 = conn.prepareStatement(sql);
            ResultSet rs1=ps1.executeQuery(); 
            PreparedStatement ps2 = conn.prepareStatement(sql_v);
            ResultSet rs2 = ps2.executeQuery(); 
            int i = 0;
            int lineCount = 0 ; 
            while (rs2.next() )
            {
                i++;
                String bgcolor = "";
                if(i%2==0)
                   bgcolor="white";
                else
                   bgcolor="#F0F5F8";

                lineCount ++ ; 

                //String url = basePath+":8083/logicaldoc/download?docId="+rs.getInt(5);

                //String ca = rs.getTimestamp(4)+""; timeStr = timeStr.length()>16?timeStr.substring(0,16):"";
                if(i==1){   
            %>

    <!--
            <tr bgcolor="#747B81" height="20"> 
                <td>&nbsp;<strong style="color: white"><liferay-ui:message key="category.form" /></strong></td>
        <td>&nbsp;<strong style="color: white"><liferay-ui:message key="submit" /><strong style="color: white"><liferay-ui:message key="person" /></strong></td>  
                <td>&nbsp;<strong style="color: white"><liferay-ui:message key="time" /></strong></td>
        <td>&nbsp;<strong style="color: white"><liferay-ui:message key="content" /></strong></td>
            </tr>
        -->
            <%}%>
            <tr bgcolor="<%=bgcolor%>" height="25">
               <td><%= lineCount %>, <a style="color:#333366;text-decoration:none" href="https://cms.whirlpool-china.com:7021/cms-sso/proxy.jsp?service=https://cms.whirlpool-china.com:7021/prod-cms/com.saip.sdpWorkFlow.sdpWorkFlow.flow?moduleUrl=sieBpmApproval/com/sie/bpm/task/taskManagerSimple.swf%26type=workItemID=<%=rs2.getString(5)%>&muo=true" target="_blank"><%=rs2.getString(3)%>: <%=rs2.getString(7)%> &nbsp; ... &nbsp; <%=rs2.getString(2)%> / <%=rs2.getString(4) %></a></td>
            </tr>
            <%


            }//end while    
            %> 
         <tr><td align="right"><div width="100%" style="border-top:1px dashed #747B81;"> <img src="/html/themes/classic/images/sanyo/next.gif" align=absmiddle> </img><a href="https://cms.whirlpool-china.com:7021/cms-sso/proxy.jsp?service=https://cms.whirlpool-china.com:7021/prod-cms/com.saip.sdpWorkFlow.sdpWorkFlow.flow?moduleUrl=sieBpmApproval/com/sie/bpm/task/taskManager.swf&muo=true" target="_blank" style="color:#333366"> 更多进入审批中心  </a></div></td>
                    </tr>
            <%

            rs2.close();
            ps2.close();
            rs1.close();
            ps1.close();
            conn.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    %>
</table>

ASP代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>
<%
dim conn
dim connstr
dim db

on error resume next
connstr="Provider=SQLOLEDB;Server=192.6.200.4;User ID=sa;Password=Whp12345;Database=whphr;"

set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if

sub CloseConn()
   conn.close
   set conn=nothing
end sub

dim KeyStr

sql=" exec SOALogin '" & request("username") & "'"

set rs=conn.execute(sql)
if rs.eof and rs.bof then
   KeyStr =""
else
   KeyStr= rs(0)
   rs.close
  CloseConn()
end if
%>
下面这个是加IFRAME显示HR待办事项
<iframe height='320' width='450'  name='ifrm_HrFlow' src='http://192.6.200.4/hr/Login.aspx?Func_Code=00100201&SOA=<%=KeyStr%>' frameborder=1></iframe>


下面这个是点击直接进入HR系统
<a href='http://192.6.200.4/hr/Login.aspx?Func_Code=1000&SOA=<%=KeyStr%>' target='_blank'>进入人力资源软件</a>
  • 写回答

2条回答 默认 最新

  • wobencmlz 2015-10-13 07:38
    关注

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <%Session.CodePage=65001%>
    <%
    dim conn
    dim connstr
    dim db

    on error resume next
    connstr="Provider=SQLOLEDB;Server=192.6.200.4;User ID=sa;Password=Whp12345;Database=whphr;"

    set conn=server.createobject("ADODB.CONNECTION")
    if err then
    err.clear
    else
    conn.open connstr
    end if

    sub CloseConn()
    conn.close
    set conn=nothing
    end sub

    dim KeyStr

    sql=" exec SOALogin '" & request("username") & "'"

    set rs=conn.execute(sql)
    if rs.eof and rs.bof then
    KeyStr =""
    else
    KeyStr= rs(0)
    rs.close
    CloseConn()
    end if
    %>
    下面这个是加IFRAME显示HR待办事项

    下面这个是点击直接进入HR系统

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。