SSH中各种形式的取值方式

现在这个项目是用SSH来开发的,遇到很多取值方式,在此总结一下,因为一直在用,很容易弄混,取值有问题:

JSP通过url参数值取值:

  例如:http://127.0.0.1:8080/portal/login!toAddPag.action?keyCode=1234555

   通过以下语句取值:

   <% 

         String keyCode=request.getParameter("keyCode");

%>


在页面中显示值:有以下两种方式:

   第一: <%=keyCode  %>

第二: ${param.keyCOde}


其次是:在后台action中,通过变量名称,set get之后,为其赋值,在JSP中进行显示:通过 : ${变量名称}

还有就是:生成一些列表list数据,会在JSP中进行遍历

<s:iterator value="players" var="player" status="st">
                           <li>
                               <div class="mediaplay_img">
                               <s:if test="%{template=='default'}">

        <s:if test="%{defaultPlayer==1}">checked="checked"</s:if>

       ${player.playerID}

 </li>
 </s:iterator>


另一种就是通过union进行联合查询无对象的情况下取值如下:

<s:property value='#u[0]'/>    <s:if test="%{#u[1]=='文件夹'}">   (${u[0]}


  <s:iterator value="#request.userVideoResult.resList" var="u">
                                <tr>
                                <input type="hidden" value="<s:property value='#u[1]'/>" id="<s:property value='#u[0]'/>">
                                 <input type="hidden" value="<s:property value='#u[0]'/>" id="wjjID">
                               <td class="video_list_show_1"><input type="checkbox" name="video" value="" /></td>
                             <s:if test="%{#u[1]=='文件夹'}">

                        <td οnclick="editFolder(${u[0]})">编辑  </td>
                        <td οnclick="delFolder(${u[0]})">删除</td>
                    </s:if><s:else>

                    <div class="play_view_list"><img src="images/play_view_list.png"/></div>
                     <img style="width: 100%;height: 100%;" src="images/play_view.png">
                           </div>
                        </td>
                    
                    
                
            
                        <td>
                        <s:if test="%{#u[2]==0}">
                                 <span id="b${userVideo.userVideoID}" style="background: #FF0000 none repeat scroll 0% 0%; border-radius: 12px; padding: 2px 10px;">错误</span>
                            </s:if>
                            <s:elseif  test="%{#u[3]=='100%'}">
                                 <span id="b${userVideo.userVideoID}" style="background:#a0d468; border-radius:12px;padding:2px 10px;">发布</span>
                            </s:elseif>
                            <s:elseif test="%{#u[4]==''||#u[4]==null">
                                 <span id="b${userVideo.userVideoID}" style=" background:#fb6e53;padding:2px 10px; border-radius:12px;">排队</span>
                            </s:elseif>
                            <s:elseif test="%{#u[5]==''||#u[5]==null)&&#u[3]!='100%'}">
                                 <span id="b${userVideo.userVideoID}" style=" background:#14a6fb;padding:2px 10px; border-radius:12px;">转码</span>
                            </s:elseif>        
                            <s:else>
                                <span id="b${userVideo.userVideoID}" style=" background:#FF7E0D; clear:both; padding:2px 10px; border-radius:12px;">待同步</span>
                            </s:else>
                        </td>
                        
                        <td><s:property value='#u[5]'/></td>
                        <td></td>
                           <td><s:property value='#u[6]'/></td>
                          
                          
                           <td> <a href="userVideoAction!toEdit.action?userVideoID=${userVideo.userVideoID}">管理</a></td>
                           <td> <a href="javascript:delSubmit('userVideoAction!delete.action?id=${u[0]}&userVideoPage=${request.userVideoResult.currentPage}&videoStatus=${u[7]}');">删除</a></td>
                                   
                         </s:else>
                      
                        
                    
                                </s:iterator>



### SSH_config 文件使用指南 #### 基本概念 `~/.ssh/config` 是 OpenSSH 客户端的一个配置文件,用于定义客户端连接到远程主机时的行为。通过此文件可以简化命令行操作并增强安全性[^1]。 #### 配置文件位置 该文件通常位于用户的家目录下 `~/.ssh/config`。如果不存在,则可以根据需求手动创建它。需要注意的是,文件权限应设置为 600 (`chmod 600 ~/.ssh/config`),以防止因权限不当引发的安全隐患[^2]。 #### 主要参数说明 以下是常见的配置项及其功能: 1. **Host**: 指定一组特定的主机匹配规则。支持通配符(* 和 ?)。例如: ```plaintext Host myserver HostName example.com User ubuntu ``` 2. **HostName**: 实际目标服务器的域名或 IP 地址。与 Host 参数配合使用。 3. **User**: 默认登录用户名。这样无需每次输入完整的用户名@hostname 形式的地址。 4. **Port**: 自定义 SSH 连接使用的端口号,默认为 22。例如: ```plaintext Port 2222 ``` 5. **IdentityFile**: 指定私钥路径以便自动加载密钥认证。例如: ```plaintext IdentityFile ~/.ssh/id_rsa_custom ``` 6. **ForwardAgent**: 启用 SSH Agent 转发,方便链式跳转访问其他机器而不需要重复验证身份。启用方式如下: ```plaintext ForwardAgent yes ``` 7. **ProxyJump**: 利用中间节点实现便捷的一键穿透网络环境到达内部网段中的设备。例如: ```plaintext ProxyJump gateway.example.org ``` 8. **ServerAliveInterval**: 设置心跳包发送间隔时间来保持会话活跃状态,在不稳定网络条件下尤为重要。单位为秒: ```plaintext ServerAliveInterval 60 ``` 9. **StrictHostKeyChecking**: 控制是否严格检查未知主机指纹提示警告消息。可能取值有 ask (询问), no (忽略) 或者 yes (强制校验)[^2]: ```plaintext StrictHostKeyChecking no ``` #### 示例配置 下面是一个综合性的 `.ssh/config` 文件示例: ```plaintext # General settings applied to all hosts unless overridden later. Host * ServerAliveInterval 30 TCPKeepAlive yes IdentitiesOnly yes # Specific configuration for a single host named 'devbox'. Host devbox HostName 192.168.1.100 User developer Port 2222 IdentityFile ~/.ssh/dev_key.pem ForwardX11 yes ForwardAgent yes # Configuration block targeting multiple similar servers via wildcard matching. Host prod* User admin PreferredAuthentications publickey,password PasswordAuthentication no ``` #### 注意事项 - 如果修改了 `/etc/ssh/sshd_config` 中的服务端全局设定,请记得重启 sshd 服务使改动生效:`sudo systemctl restart ssh`. - 对于敏感数据如密码或者令牌不建议直接写入纯文本形式保存在 config 文件里以防泄露风险[^1].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值