Monday, March 14, 2016

HOW TO USE SPRINGFORM:ERROR TAG

To use Spring Form Error Tag, you have to follow following steps.

Your JSP Page should look like this:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>About Us Page</title>
    </head>
    <body>      
        <sf:form method="POST" action ="/SpringBasics/redirect.aspx" modelAttribute="basicClass">
            FirstName: <sf:input path="firstName" />
            <sf:errors path="firstName" />
        <br/>
            <input type="submit" value="Redirect Page" />    
        </sf:form>
    </body>
</html>


Tuesday, February 9, 2016

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'xxx' available as request attribute

While trying to use Spring MVC form Tags, I come across following exception


java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'userInput' available as request attribute

Below is my JSP Code with Spring Tags

<%@page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="st"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="sf"%>
<!DOCTYPE html>
<html>
    
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>About Us Page</title>        
        <st:url var="bootstrapp_theme" value="/resources/css/bootstrap-theme.css" />
        <st:url var="bootstrapp_css" value="/resources/css/bootstrap.css" />
        <st:url var="jquery" value="/resources/js/jquery-2.2.0.js" />
        <st:url var="bootstrapp_js" value="/resources/js/bootstrap.js" />
        <link href="${bootstrapp_theme}" rel="stylesheet" />
        <link href="${bootstrapp_css}" rel="stylesheet" />        
        <script src="${jquery}" ></script>
        <script src="${bootstrapp_js}" ></script>
        
        
    <body>
        <h1 class="text-center">ABC CORPORATION</h1>
        
        <sf:form method="POST" action ="/SpringBasics/redirect">
            
            <table>
                <tr>
                
                    <td>Login ID: &nbsp;&nbsp;<input type="text" name="userName" />
                       <br> Email: &nbsp;&nbsp;<sf:input type="email" path="email" />
                       <br> My Label: &nbsp;&nbsp;<sf:label id="lbl1" path="myLabel"   />
                         
                    </td>
                </tr>
                <tr>
                    
                    <td>Password:&nbsp;&nbsp;<input type="number"  name="extension" /></td>
                </tr>
            </table>


            <input type="submit" value="Redirect Page" />
        </sf:form>
    </body>
</html>


To  resolve it I created a properties class which is defined below


package springbasics;



/**
 *
 * @author Zeeshan
 */

public class userInput {

    protected String _email;

    protected String _myLabel;

    public String getMyLabel() {
        return _myLabel;
    }

    public void setMyLabel(String _myLabel) {
        this._myLabel = _myLabel;
    }

    public String getEmail() {
        return _email;
    }

    public void setEmail(String _email) {
        this._email = _email;
    }


}

and change my JSP Code from 
        
<sf:form method="POST" action ="/SpringBasics/redirect">

To

<sf:form method="POST" action ="/SpringBasics/redirect" modelAttribute="userInput" >


Also change my controller class parameter From 

@RequestMapping(value = "/", method = GET)
    public String aboutUs() {     
        return "aboutus";      
    }

To

@RequestMapping(value = "/", method = GET)
    public String aboutUs(userInput obj) {     
        return "aboutus";      
    }


This resolve the above error message. 

If suggested solution help you in solving your issue then please comment to increase its credibility.

Thanks.


Thursday, January 28, 2016

SCRIPT AUTOMATICALLY EXECUTE ON CONSOLE OPENING

Dear Linux Lovers,

If you want to load a shell script automatically whenever console is opened by user then right it in " .bashrc " file. The file exists in user home directory. To edit .bashrc simply write


vi .bashrc   /*To open in VI*/

or any other editor which you love.

Enjoy Linux World.

No Launcher Load in Ubuntu





Sometimes UBUNTU does not show launcher due to some problem and in that case we have to re-install the O/S again. I come across this problem several times but today I did some research and found this easiest solution which work for me and I hope that It will work for you as well.

Follow below steps to get your UBUNTU launcher back:

1) Press CTRL+ALT+DTL in vm ware (3 Buttons combine) to open your processes window inside Virtual Machine.

2) Go to 3rd Tab (Disk) and double click on /dev/sda1. This will open your Files Explorer.

3) Now press CTRL+F for searching and find TERMINAL.

4) Open TERMINAL.

5) Write " sudo apt-get update "

6) Write " sudo apt-get install unity " to install Unity which will display you LAUNCHER.

7) Write " sudo reboot " to reboot your Virtual Machine.


After your computer / Virtual Machine is reboot, you can see your LAUNCHER back.

Above steps resolve my problem and if does the same in your case then please comment so the reliability of the post will increase.

Thanks.



Sunday, January 17, 2016

Unable to run mksdcard SDK tool.

During configuration of Android IntelliJ on UBUNTU, you might come across subjected message. Following command will help you in resolving this issue.

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
 
 
 

HOW TO REMOVE ALL JDK FROM UBUNTU

Following command will remove all JDK versions from your computer in UBUNTU

 sudo apt-get purge openjdk-*

In case if above code help you then please leave a comment for its authenticity to others.


Sunday, December 27, 2015

PASSING SUMMARIZED VALUES FROM SUB-REPORT TO MAIN-REPORT IN CRYSTAL REPORTS

Dear All, this time what I am going to share with you is passing summarized variables from sub-reports to main-reports in crystal reports. Here, we have different ways to pass summarized fields from sub-report to main-report and vice-versa but what I am going to share with you is quite simple and easy as well.

Below I am describing the steps through which you can perform this task.
  1. Just create a new Crystal report and call it “mainpage.rpt”.
  2. Now add formula field and name it what you like. I am giving it name “mainTotal”
  3. Edit “mainTotal” formula field and write in it shared numbervar x; [note:  you can take any type like Boolean , etc.]
  4. Now, add a sub-report in main report and also create a formula fields.[Repeat step 2 and 3]
  5. Now switch to main report again.
  6. Right click on sub-report. You will see in menu option “Change Subreport Links. Click on it.
  7. Bring that “mainTotal” field in “fields to link”  and uncheck checkbox having “Select data in subrport based on field”.
  8. Press OK Button.

Hey All………. Congrates. You have created your first report that is able to share values between main report and sub-report.

Kindly see below image where to keep sub-report and summarized variable so that if you are receiving value of previous section not current section then you can make necessary changes and get the correct one report.




If above post help you then please leave a comment.


Docker Tutorial

 I have listed all the necessary commands of Docker below. In case if any is missing or if any improvement required, please share in comment...